Skip to content

Commit

Permalink
Updates multiple providers concurrent sessions test (elastic#175352)
Browse files Browse the repository at this point in the history
## Summary

This PR is for troubleshooting
elastic#149091

It duplicates the timeout check per session from the `...legacy
sessions` test (see elastic#174748) for
the `...multiple providers` test.

Note: we are not seeing the additional log of 'Failed to write a new
session', in any of the recent failures.

Could not reproduce the issue with a flaky test runner:
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/4949
  • Loading branch information
jeramysoucy authored and CoenWarmer committed Feb 15, 2024
1 parent 481700e commit a417eaa
Showing 1 changed file with 22 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -199,17 +199,35 @@ export default function ({ getService }: FtrProviderContext) {
});

it('should properly clean up sessions that exceeded concurrent session limit even for multiple providers', async function () {
this.timeout(100000);
this.timeout(160000);

log.debug(`Log in as ${testUser.username} and SAML user 3 times each with a 0.5s delay.`);

const basicSessionCookieOne = await loginWithBasic(testUser);
await retry.tryForTime(20000, async () => {
expect(await getNumberOfSessionDocuments()).to.be(1);
});

const samlSessionCookieOne = await loginWithSAML();
await setTimeoutAsync(500);
await retry.tryForTime(20000, async () => {
expect(await getNumberOfSessionDocuments()).to.be(2);
});

const basicSessionCookieTwo = await loginWithBasic(testUser);
await retry.tryForTime(20000, async () => {
expect(await getNumberOfSessionDocuments()).to.be(3);
});

const samlSessionCookieTwo = await loginWithSAML();
await setTimeoutAsync(500);
await retry.tryForTime(20000, async () => {
expect(await getNumberOfSessionDocuments()).to.be(4);
});

const basicSessionCookieThree = await loginWithBasic(testUser);
await retry.tryForTime(20000, async () => {
expect(await getNumberOfSessionDocuments()).to.be(5);
});

const samlSessionCookieThree = await loginWithSAML();

log.debug('Waiting for all sessions to be persisted...');
Expand All @@ -221,7 +239,7 @@ export default function ({ getService }: FtrProviderContext) {
await runCleanupTaskSoon();
log.debug('Waiting for cleanup job to run...');
await retry.tryForTime(30000, async () => {
// The oldest session should have been removed, but the rest should still be valid.
// The oldest sessions should have been removed, but the rest should still be valid.
expect(await getNumberOfSessionDocuments()).to.be(4);
});

Expand Down

0 comments on commit a417eaa

Please sign in to comment.