hxtree/galaxyops

speed up unit test by making parallel again

Closed this issue · 5 comments

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Unit test coverage is increasing but test are taking a while in CI.

Describe the solution you'd like
A clear and concise description of what you want to happen.

With mongo db test each test needs to run on a unique database to avoid bleed over of information when running in parallel

beforeEach(async () => {
const dbName = test-db-${Math.random().toString(36).substring(7)};
await client.db(dbName).collection('yourCollection').deleteMany({});
});

Also on PR we changed it to run every test verses only test for packages that had changes. This help prevent breaking changes, but may of not been necessary.

Describe alternatives you've consideredAdd any other context or screenshots about the feature request here.

A clear and concise description of any alternative solutions or features you've considered.

We already setup and tear down data but in order to run in parallel databases between each test should be isolated. This is particularly a concern for service e2e-spec tests.

Additional context
Add any other context or screenshots about the feature request here.

None

Added pattern:
#546

The new pattern of creating a unique collection for each test based on a uuid is used in many services, just need to implement in all services to close out ticket.

3 remaining services to migrate.

grep -ir 'beforeAll' --include="*.e2e-spec.ts" --exclude-dir="cdk.out" --exclude-dir="common" -A 1000 | grep 'Mongoose'
services/character-sheet/src/modules/affiliation/affiliation.e2e-spec.ts- MongooseModule.forRootAsync({
services/character-sheet/src/modules/affiliation/affiliation.e2e-spec.ts- MongooseModule.forFeature([
services/player-achievements/src/module/player-achievements/player-achievements.e2e-spec.ts- MongooseModule.forRootAsync({
services/player-achievements/src/module/player-achievements/player-achievements.e2e-spec.ts- MongooseModule.forFeature([
services/instances/src/module/instances/instance.e2e-spec.ts- MongooseModule.forRootAsync({
services/instances/src/module/instances/instance.e2e-spec.ts- MongooseModule.forFeature([

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 30 days.

This issue was closed because it has been stalled for 30 days with no activity. Please open a new issue if the issue is still relevant, linking to this one.