Fixing tests broken by introduction of check for race condition#2998
Conversation
There was a problem hiding this comment.
Code Review
This pull request addresses several issues in the test suite that were introduced by recent changes. The fixes include correctly marking an intentionally failing test with @pytest.mark.xfail, replacing a manual monkeypatch with a properly scoped flexmock mock to prevent state leakage between tests, and updating a fixture to match a changed method signature. These changes are well-justified and improve the overall health and stability of the test suite. I've found one minor but important typo in the test code that needs to be fixed.
|
Build succeeded. ✔️ pre-commit SUCCESS in 1m 45s |
76dac92 to
6aa208e
Compare
|
Build succeeded. ✔️ pre-commit SUCCESS in 1m 49s |
6aa208e to
4283fee
Compare
|
Build succeeded. ✔️ pre-commit SUCCESS in 1m 52s |
majamassarini
left a comment
There was a problem hiding this comment.
Thanks, I didn't realize I broke other tests. I checked and, using flexmock, the test still triggers the race condition, so LGTM.
However, I will keep the comments since this is a complex unit test and I think they are useful.
4283fee to
155ae16
Compare
|
Build succeeded. ✔️ pre-commit SUCCESS in 1m 47s |
155ae16 to
b15f3e2
Compare
|
Build succeeded. ✔️ pre-commit SUCCESS in 1m 48s |
b15f3e2 to
644aa2d
Compare
|
Build succeeded. ✔️ pre-commit SUCCESS in 1m 49s |
644aa2d to
e58beb8
Compare
Signed-off-by: Jiri Podivin <jpodivin@redhat.com>
Signed-off-by: Jiri Podivin <jpodivin@redhat.com>
e58beb8 to
4cd1ca1
Compare
|
Build succeeded. ✔️ pre-commit SUCCESS in 1m 44s |
|
Build succeeded (gate pipeline). ✔️ pre-commit SUCCESS in 1m 45s |
Recent changes related to race condition issue have broken database tests.
The test case
test_copr_build_race_condition_concurrent_packagesintroduced f395aac was created as intentionally failing, without being marked as such. That is confusing, since it would mess up the report, but it also replacedSRPMBuildModel.create_with_new_runwith a non-standard mock.Since this mock method was not inserted by flexmock, or other mocking utility, it had effect on all tests that followed. Leading to their failure.
There was also a minor issue, in that the
too_many_copr_buildsfixture was not modified, when the return value ofCoprBuildGroupModel.createmethod was changed by 7e99633.