Skip to content

Conversation

lerouxb
Copy link
Contributor

@lerouxb lerouxb commented Mar 10, 2022

Basically: only calculate a userDataDir once. Only delete it if/when we ask for the "firstRun" experience explicitly and then during cleanup after all the tests.

@lerouxb
Copy link
Contributor Author

lerouxb commented Mar 11, 2022

The windows flake is just the same windows flake we're trying to fix elsewhere: #2891 (comment)

import { inspect } from 'util';
import { ObjectId, EJSON } from 'bson';
import { promises as fs } from 'fs';
import { promises as fs, rmdirSync } from 'fs';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a specific reason that this method needs to be synchronous?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cleanup() in index.ts is synchronous and I need to call it there.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See

function cleanup() {
keychain.reset();
const disableStartStop = process.argv.includes('--disable-start-stop');
if (!disableStartStop) {
debug('Stopping MongoDB server and cleaning up server data');
try {
crossSpawn.sync('npm', ['run', 'stop-server'], {
// If it's taking too long we might as well kill the process and move on,
// mongodb-runer is flaky sometimes and in ci `posttest-ci` script will
// take care of additional clean up anyway
timeout: 30_000,
stdio: 'inherit',
});
} catch (e) {
debug('Failed to stop MongoDB Server', e);
}
try {
fs.rmdirSync('.mongodb', { recursive: true });
} catch (e) {
debug('Failed to clean up server data', e);
}
}
}

@lerouxb lerouxb merged commit b8ff371 into main Mar 11, 2022
@lerouxb lerouxb deleted the e2e-first-run branch March 11, 2022 16:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants