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

Fix intermittent test problem in rivertest + more transactional use #226

Merged
merged 1 commit into from
Feb 25, 2024

Conversation

brandur
Copy link
Contributor

@brandur brandur commented Feb 25, 2024

This one's aimed at fixing #225, in which I think what was happening is
that because we were inserting a test job on a non-transactional pool
with a state of scheduled, in some cases the queue maintainer's
scheduler service was actually changing it back to available before
the test case would check it with a RequireInserted.

As I was moving through the test suite, I realized that we could be
making a lot more use of InsertTx variants pretty much everywhere
since we were mostly testing the transactional variables of
RequireInserted, so that I changed those over.

Then I realize that even when we were testing the non-transactional
variants, we didn't actually need a started client to do so, so I took
that code out. Then I realized that since we're not starting the client,
we didn't actually need to specify Queues or Workers (I believe the
idea of an insert-only came about only after I wrote these tests
originally). And if we didn't need to specify Workers, then we didn't
even need the worker structs, so I got rid of those too.

Overall, I think we simplify things quite a bit, and because the client
doesn't need to be started, probably reduces the possibility of future
intermittency problems like we observed in #225.

Fixes #225.

@brandur brandur force-pushed the brandur-rivertest-intermittent-test-fix branch from 14babd3 to 6c66096 Compare February 25, 2024 00:52
This one's aimed at fixing #225, in which I think what was happening is
that because we were inserting a test job on a non-transactional pool
with a state of `scheduled`, in some cases the queue maintainer's
scheduler service was actually changing it back to `available` before
the test case would check it with a `RequireInserted`.

As I was moving through the test suite, I realized that we could be
making a lot more use of `InsertTx` variants pretty much everywhere
since we were mostly testing the transactional variables of
`RequireInserted`, so that I changed those over.

Then I realize that even when we were testing the non-transactional
variants, we didn't actually need a started client to do so, so I took
that code out. Then I realized that since we're not starting the client,
we didn't actually need to specify `Queues` or `Workers` (I believe the
idea of an insert-only came about only after I wrote these tests
originally). And if we didn't need to specify `Workers`, then we didn't
even need the worker structs, so I got rid of those too.

Overall, I think we simplify things quite a bit, and because the client
doesn't need to be started, probably reduces the possibility of future
intermittency problems like we observed in #225.
@brandur brandur force-pushed the brandur-rivertest-intermittent-test-fix branch from 6c66096 to b4cd117 Compare February 25, 2024 00:57
@brandur brandur requested a review from bgentry February 25, 2024 01:05
@bgentry
Copy link
Contributor

bgentry commented Feb 25, 2024

Then I realize that even when we were testing the non-transactional
variants, we didn't actually need a started client to do so, so I took
that code out. Then I realized that since we're not starting the client,
we didn't actually need to specify Queues or Workers (I believe the
idea of an insert-only came about only after I wrote these tests
originally). And if we didn't need to specify Workers, then we didn't
even need the worker structs, so I got rid of those too.

Yep, all of this correct. Primarily the fix here is to not run maintenance processes for tests that don't need or want them. In the course of investigating #213, I've also realized we have the scheduler running frequently in most tests, which is another thing we don't need most of the time and probably adds up to a fair bit of overhead. I'm sure there are other similar issues & inefficiencies throughout the tests to clear out.

Copy link
Contributor

@bgentry bgentry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great fixes, thank you!

@brandur
Copy link
Contributor Author

brandur commented Feb 25, 2024

Great, thanks!

@brandur brandur merged commit 5a6bf92 into master Feb 25, 2024
10 checks passed
@brandur brandur deleted the brandur-rivertest-intermittent-test-fix branch February 25, 2024 23:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Intermittent test failure: TestRequireInsertedTx/FailsOnInsertOpts
2 participants