-
Notifications
You must be signed in to change notification settings - Fork 7
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
shard realm server tests #2015
shard realm server tests #2015
Conversation
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.
this script is used to make sure that the ci.yaml doesnt forget to be updated when a new test module is added
|
||
function createJWT(expiresIn: string | number) { | ||
return jwt.sign({}, 'secret', { expiresIn }); | ||
} | ||
|
||
module('realm-auth-client', function (assert) { | ||
let client: RealmAuthClient; | ||
module(basename(__filename), function () { |
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.
this is a tiny little boilerplate that we need to add to each test file made sure we can correlate filenames to test modules so we can filter them properly. this diff is a little hard to read without hiding white space, but this is an additive change--just wrapping the entire test module with this call.
So a general observation here. sharding the server tests doens't actually make things run faster. it looks like for all the server tests they finish pretty quickly, but after the tests runto completion and the test results are printed out, there is still some timer(s) that seems to be keeping the node process from exiting promptly. I'm guessing it's in some lib code that we are using. |
perhaps we can write our own custom test reporter that wraps the existing reporter and just calls a |
packages/realm-server/tests/index.ts
Outdated
// There is some timer that is preventing the node process from ending promptly. | ||
// This forces the test to end with the correct response code. Note than a | ||
// message "Error: Process exited before tests finished running" will be | ||
// displayed because of this approach. | ||
import QUnit from 'qunit'; | ||
(QUnit as any).on( | ||
'runEnd', | ||
({ | ||
testCounts, | ||
}: { | ||
testCounts: { | ||
passed: number; | ||
failed: number; | ||
total: number; | ||
skipped: number; | ||
todo: number; | ||
}; | ||
}) => { | ||
if (testCounts.failed > 0) { | ||
process.exit(1); | ||
} else { | ||
process.exit(0); | ||
} | ||
}, | ||
); |
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.
this forces our tests to exit promptly despite some timer that seems to be preventing the node process from exiting
note the improved speeds of the realm server tests in the test results below (lol, it was the matrix tests that were slow this time) |
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.
a lot of prettier updates caught up in this PR as someone doesn't have that enabled
irksome, I sometimes save files without autoformatting because I don’t want spurious diffs 😖
@@ -12,3 +12,29 @@ import './queue-test'; | |||
import './realm-server-test'; | |||
import './virtual-network-test'; | |||
import './billing-test'; | |||
|
|||
// There is some timer that is preventing the node process from ending promptly. |
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.
Is it feasible we could fix the underlying problem vs having to forcefully exit?
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.
Yeah I tried to find the source of the issue but it was very mysterious. Just pausing a debugger after the test finishes but before the process ends never breaks. It doesn’t look like something obvious we are doing in the test, and I see it happening for really simple test modules too. It makes me feel like some lib that we are loading is doing this as a side effect. But yeah, I’m unable to figure out where it’s coming from.
Co-authored-by: Buck Doyle <[email protected]>
I think it’s better to have consistent code formatting than spurious diffs. It makes things like find and replace much more predictable (like favoring ‘ vs “). |
Co-authored-by: Buck Doyle <[email protected]>
make sure to hide whitespace when reviewing this PR. the lines changed is super deceptive as it's 99.9% whitespace. (there is also a lot of prettier updates caught up in this PR as someone doesn't have that enabled 😑...)