flatcar-linux-update-operator icon indicating copy to clipboard operation
flatcar-linux-update-operator copied to clipboard

Remove calls to time.Sleep() from operator tests

Open invidian opened this issue 3 years ago • 1 comments

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.

invidian avatar Feb 22 '22 12:02 invidian

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.

invidian avatar Feb 23 '22 09:02 invidian