Skip to content

fix(e2e-tests): handle flakiness of logging retention tests MONGOSH-2050 #2431

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 14, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 21 additions & 11 deletions packages/e2e-tests/test/e2e.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1821,8 +1821,11 @@ describe('e2e', function () {

// Add the newly created log file
paths.push(path.join(customLogDir.path, getLogName(shell.logId)));
// Expect 6 files to be deleted and 5 to remain (including the new log file)
expect(await getFilesState(paths)).equals('00000011111');

await eventually(async () => {
// Expect 6 files to be deleted and 5 to remain (including the new log file)
expect(await getFilesState(paths)).equals('00000011111');
});
});
});

Expand Down Expand Up @@ -1874,10 +1877,13 @@ describe('e2e', function () {
await shell.waitForPrompt();

paths.push(path.join(customLogDir.path, getLogName(shell.logId)));
// 3 log files without mongosh_ prefix should remain
// 2 log file with mongosh_ prefix should be deleted
// 2 log files with mongosh_ prefix should remain (including the new log)
expect(await getFilesState(paths)).to.equal('1110011');

await eventually(async () => {
// 3 log files without mongosh_ prefix should remain
// 2 log file with mongosh_ prefix should be deleted
// 2 log files with mongosh_ prefix should remain (including the new log)
expect(await getFilesState(paths)).to.equal('1110011');
});
});

it('should delete files once it is above logMaxFileCount', async function () {
Expand Down Expand Up @@ -1913,8 +1919,10 @@ describe('e2e', function () {
await shell.executeLine('config.get("logMaxFileCount")')
).contains('4');

// Expect 7 files to be deleted and 4 to remain (including the new log file)
expect(await getFilesState(paths)).to.equal('00000001111');
await eventually(async () => {
// Expect 7 files to be deleted and 4 to remain (including the new log file)
expect(await getFilesState(paths)).to.equal('00000001111');
});
});
});

Expand Down Expand Up @@ -1959,9 +1967,11 @@ describe('e2e', function () {
await shell.executeLine('config.get("logRetentionGB")')
).contains(`${4 / 1024}`);

// Expect 6 files to be deleted and 4 to remain
// (including the new log file which should be <1 MB)
expect(await getFilesState(paths)).to.equal('00000001111');
await eventually(async () => {
// Expect 6 files to be deleted and 4 to remain
// (including the new log file which should be <1 MB)
expect(await getFilesState(paths)).to.equal('00000001111');
});
});
});

Expand Down