From 83399ccfb8822cc31a6a3a66e8352591d88feaa8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wojciech=20Tyczy=C5=84ski?= Date: Mon, 31 Oct 2022 18:02:40 +0100 Subject: [PATCH] Minor cleanup in etcd3 tests --- .../pkg/storage/etcd3/watcher_test.go | 45 +++++++++++-------- 1 file changed, 26 insertions(+), 19 deletions(-) diff --git a/staging/src/k8s.io/apiserver/pkg/storage/etcd3/watcher_test.go b/staging/src/k8s.io/apiserver/pkg/storage/etcd3/watcher_test.go index 116c2c117ed..d4239062dee 100644 --- a/staging/src/k8s.io/apiserver/pkg/storage/etcd3/watcher_test.go +++ b/staging/src/k8s.io/apiserver/pkg/storage/etcd3/watcher_test.go @@ -27,7 +27,6 @@ import ( "k8s.io/apiserver/pkg/storage" "k8s.io/apiserver/pkg/storage/etcd3/testserver" storagetesting "k8s.io/apiserver/pkg/storage/testing" - ) func TestWatch(t *testing.T) { @@ -62,6 +61,32 @@ func TestWatchContextCancel(t *testing.T) { storagetesting.RunTestWatchContextCancel(ctx, t, store) } +func TestWatchDeleteEventObjectHaveLatestRV(t *testing.T) { + ctx, store, _ := testSetup(t) + storagetesting.RunTestWatchDeleteEventObjectHaveLatestRV(ctx, t, store) +} + +func TestWatchInitializationSignal(t *testing.T) { + ctx, store, _ := testSetup(t) + storagetesting.RunTestWatchInitializationSignal(ctx, t, store) +} + +func TestProgressNotify(t *testing.T) { + clusterConfig := testserver.NewTestConfig(t) + clusterConfig.ExperimentalWatchProgressNotifyInterval = time.Second + ctx, store, _ := testSetup(t, withClientConfig(clusterConfig)) + + storagetesting.RunOptionalTestProgressNotify(ctx, t, store) +} + +// ======================================================================= +// Implementation-specific tests are following. +// The following tests are exercising the details of the implementation +// not the actual user-facing contract of storage interface. +// As such, they may focus e.g. on non-functional aspects like performance +// impact. +// ======================================================================= + func TestWatchErrResultNotBlockAfterCancel(t *testing.T) { origCtx, store, _ := testSetup(t) ctx, cancel := context.WithCancel(origCtx) @@ -83,21 +108,3 @@ func TestWatchErrResultNotBlockAfterCancel(t *testing.T) { cancel() wg.Wait() } - -func TestWatchDeleteEventObjectHaveLatestRV(t *testing.T) { - ctx, store, _ := testSetup(t) - storagetesting.RunTestWatchDeleteEventObjectHaveLatestRV(ctx, t, store) -} - -func TestWatchInitializationSignal(t *testing.T) { - ctx, store, _ := testSetup(t) - storagetesting.RunTestWatchInitializationSignal(ctx, t, store) -} - -func TestProgressNotify(t *testing.T) { - clusterConfig := testserver.NewTestConfig(t) - clusterConfig.ExperimentalWatchProgressNotifyInterval = time.Second - ctx, store, _ := testSetup(t, withClientConfig(clusterConfig)) - - storagetesting.RunOptionalTestProgressNotify(ctx, t, store) -}