mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-05 02:09:56 +00:00
apiserver/storage/cacher: decrease the running time of tests in the cacher package.
It turns out that kube has a custom timeout for tests of 3 minutes. The tests in the cacher package are utilizing nearly the entire time and are being terminated, resulting in failing jobs. Before the change, the TestWatchSemantics took ~43s to run. With this simple change, it now takes ~18s. When we created the tests, we didn't measure the running time and assumed that waiting 1 second on a watch channel to make sure no more events are received was sufficient. This PR decreases the waiting time to 300 milliseconds. Modern computers can perform many tasks within that time. In addition to that, the tests are serial in nature, meaning that there is no other actor that could add items to the database, which could result in receiving new items. After the change the total running time decreased by 17%. Before the tests needed ~176s after they need ~146s. The changes also improved TestWatchSemanticInitialEventsExtended.
This commit is contained in:
parent
3ec6a38795
commit
5a74c8e220
@ -1481,7 +1481,6 @@ func RunWatchSemantics(ctx context.Context, t *testing.T, store storage.Interfac
|
||||
// make sure we only get initial events
|
||||
testCheckResultsInStrictOrder(t, w, scenario.expectedInitialEvents(createdPods))
|
||||
testCheckResultsInStrictOrder(t, w, scenario.expectedInitialEventsBookmark(createdPods))
|
||||
testCheckNoMoreResults(t, w)
|
||||
|
||||
createdPods = []*example.Pod{}
|
||||
// add a pod that is greater than the storage's RV when the watch was started
|
||||
|
Loading…
Reference in New Issue
Block a user