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
Change Tests to use MMS over manually downloading & installing #12262
Conversation
merged latest master, updated the used mongodb version to their latest patch version (4.0.2 -> 4.0.28, 5.0.2 -> 5.0.8) though i am still unsure what to do with the tests that require journaling PS: the test now should also run properly in the CI |
939b498
to
a5b446b
Compare
Updated to latest master and applied changes for #12356 Issues still to resolved:
|
…nce or not also stops the replset on teardown now
a5b446b
to
518ee0e
Compare
Updated to fix CI issues Issues still to resolved:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good so far, I like this idea 👍
replseturi = ''; | ||
} | ||
|
||
process.env.MONGOOSE_TEST_URI = instanceuri; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we set these as global
variables rather than overwriting process.env
? I get why setting these variables is necessary, I just really don't like overwriting process.env
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i overwrite a process.env
variable, because that is the exact variable that was already used in test/common.js
, and so was the easiest way of implementing it (i dont know if global
carries over, at least in jest it does not)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
global
does carry over in Mocha. That is one of many reasons why we advise people against using Jest: https://mongoosejs.com/docs/jest.html#globalsetup-and-globalteardown . Overwriting env var is more of an antipattern than overwriting global IMO, although I think it would be better to just export these.
test/mocha-fixtures.js
Outdated
} | ||
|
||
if (startMemoryReplset) { | ||
mongorreplset = await mms.MongoMemoryReplSet.create({ replSet: { count: 3, args: ['--setParameter', 'ttlMonitorSleepSecs=1'] } }); // using 3 because even numbers can lead to vote problems |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we do count: 1
? count: 3
takes longer to start up and we don't do things that would require count: 3
, like testing replica set failover.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i changed it to 3
because the previous value was 2
, and mongodb recommends to not use EVEN numbers, so instead of going down to 1 i had gone up to 2, see
Line 234 in 97c3bdb
count: 2, |
Update:
i changed the storage-engine to be |
actually convert it back to draft, because i am seeing some MMS startup errors, will try to fix those before un-drafting again |
Updated MMS to fix the problems i had found, i think the test now failing is not related with changing to MMS also as for performance: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had some nits about overwriting environment variables, but I don't think it is worth blocking this PR any more. This PR is pretty great, I love reducing the amount of misc download scripts we have. Can patch that up later as time allows.
Summary
This PR changes the Tests to use MMS instead of requiring a active instance and "manually" downloading in CI tests
This PR also does:
MONGOOSE_TEST_URI
for bothuri
anduri2
assert.ok(number === 0)
toassert.equal(number, 0)
to get better error messages (expire after seconds)start.uri
over alias and static codingThis PR is a DRAFT because it is still WIP, it is WIP because:
ephermeralForTest
, andwiredTiger
yet to speed up tests (current count of failing tests is 2)re #12257 (comment)
re #12052 (somewhat)