Skip to content

Commit

Permalink
[8.15] Add debug logging for flaky session tests (elastic#193279) (el…
Browse files Browse the repository at this point in the history
…astic#193437)

# Backport

This will backport the following commits from `main` to `8.15`:
- [Add debug logging for flaky session tests
(elastic#193279)](elastic#193279)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT
[{"author":{"name":"Sid","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-09-18T17:01:45Z","message":"Add
debug logging for flaky session tests (elastic#193279)\n\n## Summary\r\n\r\nAdd
settings to the ES Test cluster to enable debug logs so that if
this\r\ntest fails in the future, we will have more logs to investigate
the\r\nissue.\r\n\r\n\r\n__Related:__
https://github.com/elastic/kibana/issues/152260","sha":"de51a1a94e73ab4f2e3df06f75f3b25b0209f084","branchLabelMapping":{"^v9.0.0$":"main","^v8.16.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","backport:all-open"],"title":"Add
debug logging for flaky session
tests","number":193279,"url":"https://github.com/elastic/kibana/pull/193279","mergeCommit":{"message":"Add
debug logging for flaky session tests (elastic#193279)\n\n## Summary\r\n\r\nAdd
settings to the ES Test cluster to enable debug logs so that if
this\r\ntest fails in the future, we will have more logs to investigate
the\r\nissue.\r\n\r\n\r\n__Related:__
https://github.com/elastic/kibana/issues/152260","sha":"de51a1a94e73ab4f2e3df06f75f3b25b0209f084"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/193279","number":193279,"mergeCommit":{"message":"Add
debug logging for flaky session tests (elastic#193279)\n\n## Summary\r\n\r\nAdd
settings to the ES Test cluster to enable debug logs so that if
this\r\ntest fails in the future, we will have more logs to investigate
the\r\nissue.\r\n\r\n\r\n__Related:__
https://github.com/elastic/kibana/issues/152260","sha":"de51a1a94e73ab4f2e3df06f75f3b25b0209f084"}}]}]
BACKPORT-->

Co-authored-by: Sid <[email protected]>
  • Loading branch information
kibanamachine and SiddharthMantri authored Sep 19, 2024
1 parent d57d9fa commit b8653b2
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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', {
Expand All @@ -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*');
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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);
Expand All @@ -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')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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']);
});
Expand Down

0 comments on commit b8653b2

Please sign in to comment.