-
Notifications
You must be signed in to change notification settings - Fork 4
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 timing issues in subscription tests #76
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for investigating this, good spot that the failure could happen to either protocols. This change is definitely an improvement to the current intermittent failures we see.
I do see one problem: the two modified tests will never terminate if something goes wrong with either the IOC or the subscriptions such that we never receive data. I'd be inclined to add back in the timer, with a large timeout value ( 20 seconds or so), and a pytest.fail()
if it ever exceeds the timeout.
Also add timeout on blocking subscriptions.
Codecov Report
@@ Coverage Diff @@
## main #76 +/- ##
=======================================
Coverage 93.30% 93.30%
=======================================
Files 10 10
Lines 807 807
=======================================
Hits 753 753
Misses 54 54 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
Adding a timeout for the subscription responses is a good idea. I discovered while doing this that we were previously actually not accounting for this as the |
I was running Strangely, if I just run this one test in isolation (i.e. I'm concerned that we have some leakage of test state somewhere - perhaps the IOCs aren't shutting down fast enough, and future tests are catching the IOC meant for the previous test? I note that our PV prefix is currently global across all tests in a given run. Sorry for finding more issues. If you feel this problem deserves its own PR I can shift this to an Issue. |
The problem is that we run the ioc as a ' |
Ah, I hadn't spotted that. In that case, I don't entirely understand why my tests fail as the IOC should still be running! Either way, this is better than it was so I think we can merge at this point. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
This PR fixes the issue described in #64.
There is a timing issue relating to when you start a subscription to Coniql with respect to where the PV is in its update cycle (updating at 2Hz). Occasionally this can mean that you don't collect as many results in the time period as you expect, which causes the tests to fail.
Instead, I have changed these type of tests so that they collect 3 samples and check that no updates were missed (i.e. the results increment by 1 each time). I have also removed the need to ensure that the updating PV is reset to
0
for each test, which can also lead to some timing problems.I've rerun the tests multiple times and no longer see failures but as this was always an intermittent problem we should still be aware of it.