diff --git a/staging/src/k8s.io/apiserver/pkg/storage/testing/store_tests.go b/staging/src/k8s.io/apiserver/pkg/storage/testing/store_tests.go index 9b892f02f37..8594b2031b6 100644 --- a/staging/src/k8s.io/apiserver/pkg/storage/testing/store_tests.go +++ b/staging/src/k8s.io/apiserver/pkg/storage/testing/store_tests.go @@ -184,7 +184,10 @@ func RunTestGet(ctx context.Context, t *testing.T, store storage.Interface) { }} for _, tt := range tests { + tt := tt t.Run(tt.name, func(t *testing.T) { + t.Parallel() + out := &example.Pod{} err := store.Get(ctx, tt.key, storage.GetOptions{IgnoreNotFound: tt.ignoreNotFound, ResourceVersion: tt.rv}, out) if tt.expectNotFoundErr { @@ -1091,12 +1094,11 @@ func RunTestGetListNonRecursive(ctx context.Context, t *testing.T, store storage rv: "0", rvMatch: metav1.ResourceVersionMatchNotOlderThan, }, { - name: "existing key, resourceVersion=previous, resourceVersionMatch=notOlderThan", - key: key, - pred: storage.Everything, - expectedAlternatives: [][]example.Pod{{*prevStoredObj}, {*storedObj}}, - rv: fmt.Sprintf("%d", prevRV), - rvMatch: metav1.ResourceVersionMatchNotOlderThan, + name: "existing key, resourceVersion=current", + key: key, + pred: storage.Everything, + expectedOut: []example.Pod{*storedObj}, + rv: fmt.Sprintf("%d", currentRV), }, { name: "existing key, resourceVersion=current, resourceVersionMatch=notOlderThan", key: key, @@ -1105,11 +1107,12 @@ func RunTestGetListNonRecursive(ctx context.Context, t *testing.T, store storage rv: fmt.Sprintf("%d", currentRV), rvMatch: metav1.ResourceVersionMatchNotOlderThan, }, { - name: "existing key, resourceVersion=current", - key: key, - pred: storage.Everything, - expectedOut: []example.Pod{*storedObj}, - rv: fmt.Sprintf("%d", currentRV), + name: "existing key, resourceVersion=previous, resourceVersionMatch=notOlderThan", + key: key, + pred: storage.Everything, + expectedAlternatives: [][]example.Pod{{*prevStoredObj}, {*storedObj}}, + rv: fmt.Sprintf("%d", prevRV), + rvMatch: metav1.ResourceVersionMatchNotOlderThan, }, { name: "existing key, resourceVersion=current, resourceVersionMatch=exact", key: key, @@ -1151,7 +1154,10 @@ func RunTestGetListNonRecursive(ctx context.Context, t *testing.T, store storage }} for _, tt := range tests { + tt := tt t.Run(tt.name, func(t *testing.T) { + t.Parallel() + out := &example.PodList{} storageOpts := storage.ListOptions{ ResourceVersion: tt.rv, diff --git a/staging/src/k8s.io/apiserver/pkg/storage/tests/cacher_test.go b/staging/src/k8s.io/apiserver/pkg/storage/tests/cacher_test.go index 7eeb1f80f70..9223132a9fa 100644 --- a/staging/src/k8s.io/apiserver/pkg/storage/tests/cacher_test.go +++ b/staging/src/k8s.io/apiserver/pkg/storage/tests/cacher_test.go @@ -165,13 +165,13 @@ func updatePod(t *testing.T, s storage.Interface, obj, old *example.Pod) *exampl func TestGet(t *testing.T) { ctx, cacher, terminate := testSetup(t) - defer terminate() + t.Cleanup(terminate) storagetesting.RunTestGet(ctx, t, cacher) } func TestGetListNonRecursive(t *testing.T) { ctx, cacher, terminate := testSetup(t) - defer terminate() + t.Cleanup(terminate) storagetesting.RunTestGetListNonRecursive(ctx, t, cacher) }