From 5a74c8e2202044b664efce4be5d86d700e74506f Mon Sep 17 00:00:00 2001 From: Lukasz Szaszkiewicz Date: Tue, 12 Mar 2024 09:15:55 +0100 Subject: [PATCH] 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. --- .../src/k8s.io/apiserver/pkg/storage/testing/watcher_tests.go | 1 - 1 file changed, 1 deletion(-) diff --git a/staging/src/k8s.io/apiserver/pkg/storage/testing/watcher_tests.go b/staging/src/k8s.io/apiserver/pkg/storage/testing/watcher_tests.go index 28ad020137a..79564da9848 100644 --- a/staging/src/k8s.io/apiserver/pkg/storage/testing/watcher_tests.go +++ b/staging/src/k8s.io/apiserver/pkg/storage/testing/watcher_tests.go @@ -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