Closed EmilGeorgiev closed 1 week ago
@EmilGeorgiev Thanks for your contribution. Could you please elaborate more on the PR details to describe the changes?
Hi @ EclesioMeloJunior thank you for your time and your comments. I will review and fix all of them.
All comments are fixed, and PR is updated. Also, I explained why I changed this test here: https://github.com/ChainSafe/gossamer/pull/4033#discussion_r1637928710
cc @dimartiro @EclesioMeloJunior
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 52.29%. Comparing base (
d1ca7aa
) to head (d8f7e3f
). Report is 110 commits behind head on development.:exclamation: Current head d8f7e3f differs from pull request most recent head 21712e9
Please upload reports for the commit 21712e9 to get more accurate results.
Describe changes
The old test doesn't guarantee that only one worker is working at a given time. For example, if someone changes the production code to:
The test will pass because len(sharedGuard) is 1.
Also, in the old test case, we ran only one worker which is not enough to guarantee that more than one worker can be running at the moment. I think it is better for at least 2 workers to be run at the same time and assert in the tests that only one of them can work at a given time.
The new implementation of the test runs two workers and checks that only one of them is active/working. At the end of the test, a new assertion that the length of the sharedGueard is 0 and the workers release the lock. In this way, we can be more confident that only one worker is running at a given time.
The new test checks and the responses that are passed to the result channel
Issues
closes: #4032