Add debug logging for flaky session tests (#193279)

## Summary

Add settings to the ES Test cluster to enable debug logs so that if this
test fails in the future, we will have more logs to investigate the
issue.


__Related:__ https://github.com/elastic/kibana/issues/152260
This commit is contained in:
Sid 2024-09-18 19:01:45 +02:00 committed by GitHub
parent 004631b6c2
commit de51a1a94e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 33 additions and 0 deletions

View file

@ -25,6 +25,7 @@ import { FtrProviderContext } from '../../ftr_provider_context';
export default function ({ getService }: FtrProviderContext) {
const supertest = getService('supertestWithoutAuth');
const esSupertest = getService('esSupertest');
const es = getService('es');
const security = getService('security');
const esDeleteAllIndices = getService('esDeleteAllIndices');
@ -150,6 +151,15 @@ export default function ({ getService }: FtrProviderContext) {
});
}
async function addESDebugLoggingSettings() {
const addLogging = {
persistent: {
'logger.org.elasticsearch.xpack.security.authc': 'debug',
},
};
await esSupertest.put('/_cluster/settings').send(addLogging).expect(200);
}
describe('Session Concurrent Limit cleanup', () => {
before(async () => {
await security.user.create('anonymous_user', {
@ -166,6 +176,7 @@ export default function ({ getService }: FtrProviderContext) {
beforeEach(async function () {
this.timeout(120000);
await es.cluster.health({ index: '.kibana_security_session*', wait_for_status: 'green' });
await addESDebugLoggingSettings();
await esDeleteAllIndices('.kibana_security_session*');
});

View file

@ -17,6 +17,7 @@ import { FtrProviderContext } from '../../ftr_provider_context';
export default function ({ getService }: FtrProviderContext) {
const supertest = getService('supertestWithoutAuth');
const esSupertest = getService('esSupertest');
const es = getService('es');
const security = getService('security');
const config = getService('config');
@ -116,6 +117,15 @@ export default function ({ getService }: FtrProviderContext) {
.expect(200);
}
async function addESDebugLoggingSettings() {
const addLogging = {
persistent: {
'logger.org.elasticsearch.xpack.security.authc': 'debug',
},
};
await esSupertest.put('/_cluster/settings').send(addLogging).expect(200);
}
describe('Session Global Concurrent Limit', () => {
before(async function () {
this.timeout(120000);
@ -138,6 +148,7 @@ export default function ({ getService }: FtrProviderContext) {
await security.testUser.setRoles(['kibana_admin']);
await es.indices.refresh({ index: '.kibana_security_session*' });
await es.cluster.health({ index: '.kibana_security_session*', wait_for_status: 'green' });
await addESDebugLoggingSettings();
await supertest
.post('/api/security/session/_invalidate')
.set('kbn-xsrf', 'xxx')

View file

@ -17,6 +17,7 @@ import { FtrProviderContext } from '../../ftr_provider_context';
export default function ({ getService }: FtrProviderContext) {
const supertest = getService('supertestWithoutAuth');
const esSupertest = getService('esSupertest');
const es = getService('es');
const security = getService('security');
const esDeleteAllIndices = getService('esDeleteAllIndices');
@ -88,9 +89,19 @@ export default function ({ getService }: FtrProviderContext) {
return cookie;
}
async function addESDebugLoggingSettings() {
const addLogging = {
persistent: {
'logger.org.elasticsearch.xpack.security.authc': 'debug',
},
};
await esSupertest.put('/_cluster/settings').send(addLogging).expect(200);
}
describe('Session Invalidate', () => {
beforeEach(async () => {
await es.cluster.health({ index: '.kibana_security_session*', wait_for_status: 'green' });
await addESDebugLoggingSettings();
await esDeleteAllIndices('.kibana_security_session*');
await security.testUser.setRoles(['kibana_admin']);
});