-
Notifications
You must be signed in to change notification settings - Fork 1
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
[TS-1197] feat: use nextest #16
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.
[question] Could we just use testcontainers for this?
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.
Ah I forgot to post my comment about this 😓
I wanted to use testcontainers
, but the problems is that Rust by default doesn't have a concept of global "beforeAll" and "afterAll"
nextest
does have the feature for beforeAll
(as an experimental feature), but from what I understand, it's a "one time thing". So, using testcontainers
there or a shell script would mean that the containers would start and be killed before running the tests (because the script/app/context is killed before).
(technically, it would work fine for starting the containers. The issue would be on how to garbage collect them)
Note that with NodeJS, I believe it works by keeping a connection opened to the Ryuk container. This is possible because the NodeJS context ("main context") stays alive as long as the tests are running (and the tests are ran inside this context via the use of the vm
module). Once the tests are finished, the app "exits", Ryuk detects that the connection is closed and therefore it can kill the containers.
Here, for Rust, from what I understand, each file of test is like a binary executed independently, so we don't have that "main context" (or it's not accessible from what I searched).
So wrapping everything in a shell script seemed the easiest and less complex 😅
Also worth noting that the garbage collection in testcontainers is not finished testcontainers/testcontainers-rs#577
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.
Works for me!
Changed
nextest
for running the tests