Skip to content
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

Add intermittent test solver #38159

Merged
merged 1 commit into from
Jan 30, 2024
Merged

Conversation

johnswanson
Copy link
Contributor

@johnswanson johnswanson commented Jan 25, 2024

Sometimes a test passes when run by itself, but fails due to ordering issues. This is typically caused by another test failing to properly clean up after itself, leaving the database in a dirty state. For example, we might change permissions and forget to change them back, so that another test hits an unexpected permissions failure.

Finding the cause of these has been a source of pain for me, so I wrote a small snippet to do it for me.

If you have a test that passes when run by itself, but fails when run along with all the other tests, you can run
(dev/find-root-test-failure! #'my-ns/my-intermittent-failure-test).

It will run all tests. After each one, it'll run the test you passed in. Once that test starts failing, it'll alert you about which test caused it to fail.

Sometimes a test passes when run by itself, but fails due to ordering
issues. This is typically caused by another test failing to properly
clean up after itself, leaving the database in a dirty state. For
example, we might change permissions and forget to change them back, so
that another test hits an unexpected permissions failure.

Finding the cause of these has been a source of pain for me, so I wrote
a small snippet to do it for me.

If you have a test that passes when run by itself, but fails when run
along with all the other tests, you can run
`(dev/find-root-test-failure! #'my-ns/my-intermittent-failure-test')`.

It will run *all* tests. After each one, it'll run the test you passed
in. Once that test starts failing, it'll alert you about which test
caused it to fail.
@johnswanson johnswanson added the no-backport Do not backport this PR to any branch label Jan 25, 2024
@metabase-bot metabase-bot bot added the .Team/AdminWebapp Admin and Webapp team label Jan 25, 2024
@johnswanson johnswanson merged commit ebbc667 into master Jan 30, 2024
109 of 111 checks passed
@johnswanson johnswanson deleted the add-intermittent-test-solver branch January 30, 2024 21:19
Copy link
Contributor

@johnswanson Did you forget to add a milestone to the issue for this PR? When and where should I add a milestone?

@johnswanson johnswanson added this to the 0.49 milestone Jan 30, 2024
npfitz pushed a commit that referenced this pull request Feb 5, 2024
Sometimes a test passes when run by itself, but fails due to ordering
issues. This is typically caused by another test failing to properly
clean up after itself, leaving the database in a dirty state. For
example, we might change permissions and forget to change them back, so
that another test hits an unexpected permissions failure.

Finding the cause of these has been a source of pain for me, so I wrote
a small snippet to do it for me.

If you have a test that passes when run by itself, but fails when run
along with all the other tests, you can run
`(dev/find-root-test-failure! #'my-ns/my-intermittent-failure-test')`.

It will run *all* tests. After each one, it'll run the test you passed
in. Once that test starts failing, it'll alert you about which test
caused it to fail.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no-backport Do not backport this PR to any branch .Team/AdminWebapp Admin and Webapp team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants