![]() TestStart was previously flaky. In approx 100_000 local runs, it failed about 70% of the time, and has been mentioned as a flaky unit test in the past. This flake was due to a race condition with the logic as written and the go scheduler. UpdateThreshold calls `notifier.Start(events)` in a new Go Routine, which is not guarunteed to be called immediately. This meant that if `m.Start()` was called before `notifier.Start()`, the test would fail, as the notifier would not have been started before the 4 events were processed and lock released. Here, we update the test to more closely match the intended application behaviour, and have events passed to the channel when `Start` is called on the notifier. This ensures that -Start gets called and additionally validates that the correct channel is provided to the notifier. Stop was never called previously, as it only gets called on a subsequent call to UpdateThreshold. `AnyTimes()` hid that this did not occur. |
||
---|---|---|
.. | ||
api | ||
doc.go | ||
eviction_manager_test.go | ||
eviction_manager.go | ||
helpers_test.go | ||
helpers.go | ||
memory_threshold_notifier_test.go | ||
memory_threshold_notifier.go | ||
mock_threshold_notifier_test.go | ||
threshold_notifier_linux.go | ||
threshold_notifier_unsupported.go | ||
types.go |