flatcar-linux-update-operator
flatcar-linux-update-operator copied to clipboard
Remove calls to time.Sleep() from operator tests
Those calls are suboptimal and not interruptable. We should instead add some hooks to fake client to inform us when certain events occur and proceed then.
Interesting observation:
- Rewriting tests to use events-based approach makes tests more fragile, as they are more implementation specific. Sleep based tests are more implementation agnostic.
- Optimizing sleep based tests (so basically reducing both cycle and wait times) may make tests more sensitive to CPU stalls, where process waits for CPU time to be given, which might be particularly problematic on public cloud CI.
I'm on the fence which approach is more appropriate here then. Though given that the tests takes 5 seconds to run right now, it's not a huge problem, though agent tests takes 1.5 second for example.