-
Notifications
You must be signed in to change notification settings - Fork 1k
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
[Bug?]: Scenarios not cleaned up after a test fails -> can cause cascading test failures #11426
Comments
Hey @jason-curtis thanks for taking the time to file an issue. I'll get someone on the team to take a look! |
Hey @jason-curtis! Thanks for the details here. I just tried to reproduce this with our test project fixture. I used your example scenario code and got a random postgres database from railway (so it would be slower than my localhost connection). I wasn't able to see the results where the second one fails because of the first deliberate failure. Could you share the scenario code you had too maybe that'll help me? I also didn't see the behaviour with sqlite. |
Ah my bad! I realised I wasn't testing with the same version you specified in your report. If I switch to v7.0.6 then I see the failure you describe here. I tested on v8.0.0 and it passed. Let me see if I can hunt down the version that fixed it. |
Upgrading fixed the issue! Thank you for looking into this @Josh-Walker-GM ! |
What's not working?
According to https://docs.redwoodjs.com/docs/testing/#which-scenarios-are-seeded :
Sometimes that's not the case - I'm finding that when a test case fails, the related scenario is left over in the DB. This causes subsequent tests to fail, either due to uniqueness constraints being violated, or when they assert how many rows there should be and find too many rows.
How do we reproduce the bug?
user
), using a postgres DBusers.test.ts
so that there is a test that will throw an error and other tests after it. For example:yarn rw test
- should result in only one test failure, but both tests will now fail due to leftover DB entities from thebusted test
interfering with the second test. Depending on youruser
model, I've seen two possible errors:if your
user
model has uniqueness constraint (on the email column, say), then that constraint will cause scenario setup to fail:if there are no uniqueness constraints other than the primary key, you will just get an error because there are too many
user
entities lying around in the database:What's your environment? (If it applies)
Are you interested in working on this?
The text was updated successfully, but these errors were encountered: