Skip to content

streamcache: Fix race when testing for cache entry removal

Patrick Steinhardt requested to merge pks-streamcache-fix-flaky-test into master

In one of the tests for the streamcache, we verify that cache entries get removed correctly both from the cache and from disk. Given that we have no way to properly synchronize the trigger to remove the entry and actual removal right now, we simply time.Sleep(). Of course, this goes wrong every now and then and causes the test to be flaky.

Fix this issue by introducing a new, optional sync.Cond which gets notified on when cache entries have been removed from disk. Like this, we can properly synchronize on removals and don't have to use sleeps.

Closes #3836 (closed)

Merge request reports

Loading