From b312c7eb5ba8fc340e4d14c22577ae40075d2ae8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wojciech=20Tyczy=C5=84ski?= Date: Thu, 3 Nov 2022 08:47:38 +0100 Subject: [PATCH] Stop exporting storage testing utility functions Kubernetes-commit: 37db332298fc6d14a798f610ce6049792299f0b1 --- pkg/storage/testing/store_tests.go | 56 +++++++++++++++------------- pkg/storage/testing/utils.go | 33 ++++++---------- pkg/storage/testing/watcher_tests.go | 30 +++++++-------- 3 files changed, 57 insertions(+), 62 deletions(-) diff --git a/pkg/storage/testing/store_tests.go b/pkg/storage/testing/store_tests.go index d6ef8ccc3..ef70b36b3 100644 --- a/pkg/storage/testing/store_tests.go +++ b/pkg/storage/testing/store_tests.go @@ -85,12 +85,12 @@ func RunTestCreateWithTTL(ctx context.Context, t *testing.T, store storage.Inter if err != nil { t.Fatalf("Watch failed: %v", err) } - TestCheckEventType(t, watch.Deleted, w) + testCheckEventType(t, watch.Deleted, w) } func RunTestCreateWithKeyExist(ctx context.Context, t *testing.T, store storage.Interface) { obj := &example.Pod{ObjectMeta: metav1.ObjectMeta{Name: "foo"}} - key, _ := TestPropagateStore(ctx, t, store, obj) + key, _ := testPropagateStore(ctx, t, store, obj) out := &example.Pod{} err := store.Create(ctx, key, obj, out, 0) if err == nil || !storage.IsExist(err) { @@ -100,7 +100,7 @@ func RunTestCreateWithKeyExist(ctx context.Context, t *testing.T, store storage. func RunTestGet(ctx context.Context, t *testing.T, store storage.Interface) { // create an object to test - key, createdObj := TestPropagateStore(ctx, t, store, &example.Pod{ObjectMeta: metav1.ObjectMeta{Name: "foo"}}) + key, createdObj := testPropagateStore(ctx, t, store, &example.Pod{ObjectMeta: metav1.ObjectMeta{Name: "foo"}}) // update the object once to allow get by exact resource version to be tested updateObj := createdObj.DeepCopy() updateObj.Annotations = map[string]string{"test-annotation": "1"} @@ -219,7 +219,7 @@ func RunTestGet(ctx context.Context, t *testing.T, store storage.Interface) { } func RunTestUnconditionalDelete(ctx context.Context, t *testing.T, store storage.Interface) { - key, storedObj := TestPropagateStore(ctx, t, store, &example.Pod{ObjectMeta: metav1.ObjectMeta{Name: "foo"}}) + key, storedObj := testPropagateStore(ctx, t, store, &example.Pod{ObjectMeta: metav1.ObjectMeta{Name: "foo"}}) tests := []struct { name string @@ -263,7 +263,7 @@ func RunTestUnconditionalDelete(ctx context.Context, t *testing.T, store storage } func RunTestConditionalDelete(ctx context.Context, t *testing.T, store storage.Interface) { - key, storedObj := TestPropagateStore(ctx, t, store, &example.Pod{ObjectMeta: metav1.ObjectMeta{Name: "foo", UID: "A"}}) + key, storedObj := testPropagateStore(ctx, t, store, &example.Pod{ObjectMeta: metav1.ObjectMeta{Name: "foo", UID: "A"}}) tests := []struct { name string @@ -299,7 +299,7 @@ func RunTestConditionalDelete(ctx context.Context, t *testing.T, store storage.I } out.ResourceVersion = storedObj.ResourceVersion ExpectNoDiff(t, "incorrect pod:", storedObj, out) - key, storedObj = TestPropagateStore(ctx, t, store, &example.Pod{ObjectMeta: metav1.ObjectMeta{Name: "foo", UID: "A"}}) + key, storedObj = testPropagateStore(ctx, t, store, &example.Pod{ObjectMeta: metav1.ObjectMeta{Name: "foo", UID: "A"}}) }) } } @@ -330,7 +330,7 @@ func RunTestConditionalDelete(ctx context.Context, t *testing.T, store storage.I // [DONE] Added TestPreconditionalDeleteWithSuggestion func RunTestDeleteWithSuggestion(ctx context.Context, t *testing.T, store storage.Interface) { - key, originalPod := TestPropagateStore(ctx, t, store, &example.Pod{ObjectMeta: metav1.ObjectMeta{Name: "name"}}) + key, originalPod := testPropagateStore(ctx, t, store, &example.Pod{ObjectMeta: metav1.ObjectMeta{Name: "name"}}) out := &example.Pod{} if err := store.Delete(ctx, key, out, nil, storage.ValidateAllObjectFunc, originalPod); err != nil { @@ -343,7 +343,7 @@ func RunTestDeleteWithSuggestion(ctx context.Context, t *testing.T, store storag } func RunTestDeleteWithSuggestionAndConflict(ctx context.Context, t *testing.T, store storage.Interface) { - key, originalPod := TestPropagateStore(ctx, t, store, &example.Pod{ObjectMeta: metav1.ObjectMeta{Name: "name"}}) + key, originalPod := testPropagateStore(ctx, t, store, &example.Pod{ObjectMeta: metav1.ObjectMeta{Name: "name"}}) // First update, so originalPod is outdated. updatedPod := &example.Pod{} @@ -367,7 +367,7 @@ func RunTestDeleteWithSuggestionAndConflict(ctx context.Context, t *testing.T, s } func RunTestDeleteWithSuggestionOfDeletedObject(ctx context.Context, t *testing.T, store storage.Interface) { - key, originalPod := TestPropagateStore(ctx, t, store, &example.Pod{ObjectMeta: metav1.ObjectMeta{Name: "name"}}) + key, originalPod := testPropagateStore(ctx, t, store, &example.Pod{ObjectMeta: metav1.ObjectMeta{Name: "name"}}) // First delete, so originalPod is outdated. deletedPod := &example.Pod{} @@ -383,7 +383,7 @@ func RunTestDeleteWithSuggestionOfDeletedObject(ctx context.Context, t *testing. } func RunTestValidateDeletionWithSuggestion(ctx context.Context, t *testing.T, store storage.Interface) { - key, originalPod := TestPropagateStore(ctx, t, store, &example.Pod{ObjectMeta: metav1.ObjectMeta{Name: "name"}}) + key, originalPod := testPropagateStore(ctx, t, store, &example.Pod{ObjectMeta: metav1.ObjectMeta{Name: "name"}}) // Check that validaing fresh object fails is called once and fails. validationCalls := 0 @@ -435,7 +435,7 @@ func RunTestValidateDeletionWithSuggestion(ctx context.Context, t *testing.T, st } func RunTestPreconditionalDeleteWithSuggestion(ctx context.Context, t *testing.T, store storage.Interface) { - key, originalPod := TestPropagateStore(ctx, t, store, &example.Pod{ObjectMeta: metav1.ObjectMeta{Name: "name"}}) + key, originalPod := testPropagateStore(ctx, t, store, &example.Pod{ObjectMeta: metav1.ObjectMeta{Name: "name"}}) // First update, so originalPod is outdated. updatedPod := &example.Pod{} @@ -673,7 +673,7 @@ func RunTestList(ctx context.Context, t *testing.T, store storage.Interface) { expectContinue: true, expectedRemainingItemCount: utilpointer.Int64Ptr(1), rv: "0", - expectRVFunc: ResourceVersionNotOlderThan(list.ResourceVersion), + expectRVFunc: resourceVersionNotOlderThan(list.ResourceVersion), }, { name: "test List with limit at resource version 0 match=NotOlderThan", @@ -688,7 +688,7 @@ func RunTestList(ctx context.Context, t *testing.T, store storage.Interface) { expectedRemainingItemCount: utilpointer.Int64Ptr(1), rv: "0", rvMatch: metav1.ResourceVersionMatchNotOlderThan, - expectRVFunc: ResourceVersionNotOlderThan(list.ResourceVersion), + expectRVFunc: resourceVersionNotOlderThan(list.ResourceVersion), }, { name: "test List with limit at resource version before first write and match=Exact", @@ -795,7 +795,7 @@ func RunTestList(ctx context.Context, t *testing.T, store storage.Interface) { Field: fields.OneTermEqualSelector("metadata.name", "bar"), Label: labels.Everything(), Limit: 2, - Continue: EncodeContinueOrDie("z-level/3", int64(continueRV)), + Continue: encodeContinueOrDie("z-level/3", int64(continueRV)), }, expectedOut: []*example.Pod{preset[4]}, }, @@ -806,7 +806,7 @@ func RunTestList(ctx context.Context, t *testing.T, store storage.Interface) { Field: fields.OneTermEqualSelector("metadata.name", "bar"), Label: labels.Everything(), Limit: 1, - Continue: EncodeContinueOrDie("z-level/3/test-2", int64(continueRV)), + Continue: encodeContinueOrDie("z-level/3/test-2", int64(continueRV)), }, expectedOut: []*example.Pod{preset[4]}, }, @@ -817,7 +817,7 @@ func RunTestList(ctx context.Context, t *testing.T, store storage.Interface) { Field: fields.OneTermEqualSelector("metadata.name", "bar"), Label: labels.Everything(), Limit: 2, - Continue: EncodeContinueOrDie("z-level/3/test-2", int64(continueRV)), + Continue: encodeContinueOrDie("z-level/3/test-2", int64(continueRV)), }, expectedOut: []*example.Pod{preset[4]}, }, @@ -1048,10 +1048,10 @@ func seedMultiLevelData(ctx context.Context, store storage.Interface) (string, [ } func RunTestGetListNonRecursive(ctx context.Context, t *testing.T, store storage.Interface) { - prevKey, prevStoredObj := TestPropagateStore(ctx, t, store, &example.Pod{ObjectMeta: metav1.ObjectMeta{Name: "prev"}}) + prevKey, prevStoredObj := testPropagateStore(ctx, t, store, &example.Pod{ObjectMeta: metav1.ObjectMeta{Name: "prev"}}) prevRV, _ := strconv.Atoi(prevStoredObj.ResourceVersion) - key, storedObj := TestPropagateStore(ctx, t, store, &example.Pod{ObjectMeta: metav1.ObjectMeta{Name: "foo"}}) + key, storedObj := testPropagateStore(ctx, t, store, &example.Pod{ObjectMeta: metav1.ObjectMeta{Name: "foo"}}) currentRV, _ := strconv.Atoi(storedObj.ResourceVersion) tests := []struct { @@ -1572,7 +1572,7 @@ func RunTestListInconsistentContinuation(ctx context.Context, t *testing.T, stor if len(out.Continue) == 0 { t.Fatalf("No continuation token set") } - validateResourceVersion := ResourceVersionNotOlderThan(lastRVString) + validateResourceVersion := resourceVersionNotOlderThan(lastRVString) ExpectNoDiff(t, "incorrect second page", []example.Pod{*preset[1].storedObj}, out.Items) if err := validateResourceVersion(out.ResourceVersion); err != nil { t.Fatal(err) @@ -1776,7 +1776,7 @@ func RunTestGuaranteedUpdate(ctx context.Context, t *testing.T, store InterfaceW for i, tt := range tests { t.Run(tt.name, func(t *testing.T) { - key, storeObj := TestPropagateStore(ctx, t, store, &example.Pod{ObjectMeta: metav1.ObjectMeta{Name: "foo", UID: "A"}}) + key, storeObj := testPropagateStore(ctx, t, store, &example.Pod{ObjectMeta: metav1.ObjectMeta{Name: "foo", UID: "A"}}) out := &example.Pod{} name := fmt.Sprintf("foo-%d", i) @@ -1866,7 +1866,7 @@ func RunTestGuaranteedUpdateWithTTL(ctx context.Context, t *testing.T, store sto if err != nil { t.Fatalf("Watch failed: %v", err) } - TestCheckEventType(t, watch.Deleted, w) + testCheckEventType(t, watch.Deleted, w) } func RunTestGuaranteedUpdateChecksStoredData(ctx context.Context, t *testing.T, store InterfaceWithPrefixTransformer) { @@ -1880,7 +1880,7 @@ func RunTestGuaranteedUpdateChecksStoredData(ctx context.Context, t *testing.T, transformer.prefix = []byte(string(transformer.prefix) + " ") return transformer }) - _, initial := TestPropagateStore(ctx, t, store, input) + _, initial := testPropagateStore(ctx, t, store, input) revertTransformer() // this update should write the canonical value to etcd because the new serialization differs @@ -1935,7 +1935,7 @@ func RunTestGuaranteedUpdateChecksStoredData(ctx context.Context, t *testing.T, } func RunTestGuaranteedUpdateWithConflict(ctx context.Context, t *testing.T, store storage.Interface) { - key, _ := TestPropagateStore(ctx, t, store, &example.Pod{ObjectMeta: metav1.ObjectMeta{Name: "foo"}}) + key, _ := testPropagateStore(ctx, t, store, &example.Pod{ObjectMeta: metav1.ObjectMeta{Name: "foo"}}) errChan := make(chan error, 1) var firstToFinish sync.WaitGroup @@ -1980,7 +1980,7 @@ func RunTestGuaranteedUpdateWithConflict(ctx context.Context, t *testing.T, stor } func RunTestGuaranteedUpdateWithSuggestionAndConflict(ctx context.Context, t *testing.T, store storage.Interface) { - key, originalPod := TestPropagateStore(ctx, t, store, &example.Pod{ObjectMeta: metav1.ObjectMeta{Name: "foo"}}) + key, originalPod := testPropagateStore(ctx, t, store, &example.Pod{ObjectMeta: metav1.ObjectMeta{Name: "foo"}}) // First, update without a suggestion so originalPod is outdated updatedPod := &example.Pod{} @@ -2142,7 +2142,9 @@ func RunTestCount(ctx context.Context, t *testing.T, store storage.Interface) { obj := &example.Pod{ObjectMeta: metav1.ObjectMeta{Name: fmt.Sprintf("foo-%d", i)}} key := fmt.Sprintf("%s/%d", resourceA, i) - TestPropagateStoreWithKey(ctx, t, store, key, obj) + if err := store.Create(ctx, key, obj, nil, 0); err != nil { + t.Fatalf("Create failed: %v", err) + } } resourceBCount := 4 @@ -2150,7 +2152,9 @@ func RunTestCount(ctx context.Context, t *testing.T, store storage.Interface) { obj := &example.Pod{ObjectMeta: metav1.ObjectMeta{Name: fmt.Sprintf("foo-%d", i)}} key := fmt.Sprintf("%s/%d", resourceB, i) - TestPropagateStoreWithKey(ctx, t, store, key, obj) + if err := store.Create(ctx, key, obj, nil, 0); err != nil { + t.Fatalf("Create failed: %v", err) + } } resourceACountGot, err := store.Count(resourceA) diff --git a/pkg/storage/testing/utils.go b/pkg/storage/testing/utils.go index d66ba8c30..79f2654d4 100644 --- a/pkg/storage/testing/utils.go +++ b/pkg/storage/testing/utils.go @@ -37,11 +37,6 @@ import ( "k8s.io/apiserver/pkg/storage/value" ) -// CreateObj will create a single object using the storage interface. -func CreateObj(helper storage.Interface, name string, obj, out runtime.Object, ttl uint64) error { - return helper.Create(context.TODO(), name, obj, out, ttl) -} - // CreateObjList will create a list from the array of objects. func CreateObjList(prefix string, helper storage.Interface, items []runtime.Object) error { for i := range items { @@ -50,7 +45,7 @@ func CreateObjList(prefix string, helper storage.Interface, items []runtime.Obje if err != nil { return err } - err = CreateObj(helper, path.Join(prefix, meta.GetName()), obj, obj, 0) + err = helper.Create(context.Background(), path.Join(prefix, meta.GetName()), obj, obj, 0) if err != nil { return err } @@ -82,16 +77,12 @@ func DeepEqualSafePodSpec() example.PodSpec { } } -// TestPropagateStore helps propagates store with objects, automates key generation, and returns +// testPropagateStore helps propagates store with objects, automates key generation, and returns // keys and stored objects. -func TestPropagateStore(ctx context.Context, t *testing.T, store storage.Interface, obj *example.Pod) (string, *example.Pod) { +func testPropagateStore(ctx context.Context, t *testing.T, store storage.Interface, obj *example.Pod) (string, *example.Pod) { // Setup store with a key and grab the output for returning. key := fmt.Sprintf("/%s/%s", obj.Namespace, obj.Name) - return key, TestPropagateStoreWithKey(ctx, t, store, key, obj) -} -// TestPropagateStoreWithKey helps propagate store with objects, the given object will be stored at the specified key. -func TestPropagateStoreWithKey(ctx context.Context, t *testing.T, store storage.Interface, key string, obj *example.Pod) *example.Pod { // Setup store with the specified key and grab the output for returning. err := store.Delete(ctx, key, &example.Pod{}, nil, storage.ValidateAllObjectFunc, nil) if err != nil && !storage.IsNotFound(err) { @@ -101,7 +92,7 @@ func TestPropagateStoreWithKey(ctx context.Context, t *testing.T, store storage. if err := store.Create(ctx, key, obj, setOutput, 0); err != nil { t.Fatalf("Set failed: %v", err) } - return setOutput + return key, setOutput } func ExpectNoDiff(t *testing.T, msg string, expected, got interface{}) { @@ -135,7 +126,7 @@ func ExpectContains(t *testing.T, msg string, expectedList []interface{}, got in const dummyPrefix = "adapter" -func EncodeContinueOrDie(key string, resourceVersion int64) string { +func encodeContinueOrDie(key string, resourceVersion int64) string { token, err := storage.EncodeContinue(dummyPrefix+key, dummyPrefix, resourceVersion) if err != nil { panic(err) @@ -143,7 +134,7 @@ func EncodeContinueOrDie(key string, resourceVersion int64) string { return token } -func TestCheckEventType(t *testing.T, expectEventType watch.EventType, w watch.Interface) { +func testCheckEventType(t *testing.T, expectEventType watch.EventType, w watch.Interface) { select { case res := <-w.ResultChan(): if res.Type != expectEventType { @@ -154,14 +145,14 @@ func TestCheckEventType(t *testing.T, expectEventType watch.EventType, w watch.I } } -func TestCheckResult(t *testing.T, expectEventType watch.EventType, w watch.Interface, expectObj *example.Pod) { - TestCheckResultFunc(t, expectEventType, w, func(object runtime.Object) error { +func testCheckResult(t *testing.T, expectEventType watch.EventType, w watch.Interface, expectObj *example.Pod) { + testCheckResultFunc(t, expectEventType, w, func(object runtime.Object) error { ExpectNoDiff(t, "incorrect object", expectObj, object) return nil }) } -func TestCheckResultFunc(t *testing.T, expectEventType watch.EventType, w watch.Interface, check func(object runtime.Object) error) { +func testCheckResultFunc(t *testing.T, expectEventType watch.EventType, w watch.Interface, check func(object runtime.Object) error) { select { case res := <-w.ResultChan(): if res.Type != expectEventType { @@ -176,7 +167,7 @@ func TestCheckResultFunc(t *testing.T, expectEventType watch.EventType, w watch. } } -func TestCheckStop(t *testing.T, w watch.Interface) { +func testCheckStop(t *testing.T, w watch.Interface) { select { case e, ok := <-w.ResultChan(): if ok { @@ -194,10 +185,10 @@ func TestCheckStop(t *testing.T, w watch.Interface) { } } -// ResourceVersionNotOlderThan returns a function to validate resource versions. Resource versions +// resourceVersionNotOlderThan returns a function to validate resource versions. Resource versions // referring to points in logical time before the sentinel generate an error. All logical times as // new as the sentinel or newer generate no error. -func ResourceVersionNotOlderThan(sentinel string) func(string) error { +func resourceVersionNotOlderThan(sentinel string) func(string) error { return func(resourceVersion string) error { objectVersioner := storage.APIObjectVersioner{} actualRV, err := objectVersioner.ParseResourceVersion(resourceVersion) diff --git a/pkg/storage/testing/watcher_tests.go b/pkg/storage/testing/watcher_tests.go index 4876cf36b..4c846cd8e 100644 --- a/pkg/storage/testing/watcher_tests.go +++ b/pkg/storage/testing/watcher_tests.go @@ -113,12 +113,12 @@ func testWatch(ctx context.Context, t *testing.T, store storage.Interface, recur expectObj = prevObj expectObj.ResourceVersion = out.ResourceVersion } - TestCheckResult(t, watchTest.watchType, w, expectObj) + testCheckResult(t, watchTest.watchType, w, expectObj) } prevObj = out } w.Stop() - TestCheckStop(t, w) + testCheckStop(t, w) }) } } @@ -127,13 +127,13 @@ func testWatch(ctx context.Context, t *testing.T, store storage.Interface, recur // - watch from 0 should sync up and grab the object added before // - watch from 0 is able to return events for objects whose previous version has been compacted func RunTestWatchFromZero(ctx context.Context, t *testing.T, store storage.Interface, compaction Compaction) { - key, storedObj := TestPropagateStore(ctx, t, store, &example.Pod{ObjectMeta: metav1.ObjectMeta{Name: "foo", Namespace: "ns"}}) + key, storedObj := testPropagateStore(ctx, t, store, &example.Pod{ObjectMeta: metav1.ObjectMeta{Name: "foo", Namespace: "ns"}}) w, err := store.Watch(ctx, key, storage.ListOptions{ResourceVersion: "0", Predicate: storage.Everything}) if err != nil { t.Fatalf("Watch failed: %v", err) } - TestCheckResult(t, watch.Added, w, storedObj) + testCheckResult(t, watch.Added, w, storedObj) w.Stop() // Update @@ -151,7 +151,7 @@ func RunTestWatchFromZero(ctx context.Context, t *testing.T, store storage.Inter if err != nil { t.Fatalf("Watch failed: %v", err) } - TestCheckResult(t, watch.Added, w, out) + testCheckResult(t, watch.Added, w, out) w.Stop() if compaction == nil { @@ -176,11 +176,11 @@ func RunTestWatchFromZero(ctx context.Context, t *testing.T, store storage.Inter if err != nil { t.Fatalf("Watch failed: %v", err) } - TestCheckResult(t, watch.Added, w, out) + testCheckResult(t, watch.Added, w, out) } func RunTestDeleteTriggerWatch(ctx context.Context, t *testing.T, store storage.Interface) { - key, storedObj := TestPropagateStore(ctx, t, store, &example.Pod{ObjectMeta: metav1.ObjectMeta{Name: "foo"}}) + key, storedObj := testPropagateStore(ctx, t, store, &example.Pod{ObjectMeta: metav1.ObjectMeta{Name: "foo"}}) w, err := store.Watch(ctx, key, storage.ListOptions{ResourceVersion: storedObj.ResourceVersion, Predicate: storage.Everything}) if err != nil { t.Fatalf("Watch failed: %v", err) @@ -188,11 +188,11 @@ func RunTestDeleteTriggerWatch(ctx context.Context, t *testing.T, store storage. if err := store.Delete(ctx, key, &example.Pod{}, nil, storage.ValidateAllObjectFunc, nil); err != nil { t.Fatalf("Delete failed: %v", err) } - TestCheckEventType(t, watch.Deleted, w) + testCheckEventType(t, watch.Deleted, w) } func RunTestWatchFromNoneZero(ctx context.Context, t *testing.T, store storage.Interface) { - key, storedObj := TestPropagateStore(ctx, t, store, &example.Pod{ObjectMeta: metav1.ObjectMeta{Name: "foo"}}) + key, storedObj := testPropagateStore(ctx, t, store, &example.Pod{ObjectMeta: metav1.ObjectMeta{Name: "foo"}}) w, err := store.Watch(ctx, key, storage.ListOptions{ResourceVersion: storedObj.ResourceVersion, Predicate: storage.Everything}) if err != nil { @@ -203,7 +203,7 @@ func RunTestWatchFromNoneZero(ctx context.Context, t *testing.T, store storage.I func(runtime.Object) (runtime.Object, error) { return &example.Pod{ObjectMeta: metav1.ObjectMeta{Name: "bar"}}, err }), nil) - TestCheckResult(t, watch.Modified, w, out) + testCheckResult(t, watch.Modified, w, out) } func RunTestWatchError(ctx context.Context, t *testing.T, store InterfaceWithPrefixTransformer) { @@ -236,7 +236,7 @@ func RunTestWatchError(ctx context.Context, t *testing.T, store InterfaceWithPre if err != nil { t.Fatalf("Watch failed: %v", err) } - TestCheckEventType(t, watch.Error, w) + testCheckEventType(t, watch.Error, w) } func RunTestWatchContextCancel(ctx context.Context, t *testing.T, store storage.Interface) { @@ -263,7 +263,7 @@ func RunTestWatchContextCancel(ctx context.Context, t *testing.T, store storage. } func RunTestWatchDeleteEventObjectHaveLatestRV(ctx context.Context, t *testing.T, store storage.Interface) { - key, storedObj := TestPropagateStore(ctx, t, store, &example.Pod{ObjectMeta: metav1.ObjectMeta{Name: "foo"}}) + key, storedObj := testPropagateStore(ctx, t, store, &example.Pod{ObjectMeta: metav1.ObjectMeta{Name: "foo"}}) watchCtx, _ := context.WithTimeout(ctx, wait.ForeverTestTimeout) w, err := store.Watch(watchCtx, key, storage.ListOptions{ResourceVersion: storedObj.ResourceVersion, Predicate: storage.Everything}) @@ -295,7 +295,7 @@ func RunTestWatchInitializationSignal(ctx context.Context, t *testing.T, store s initSignal := utilflowcontrol.NewInitializationSignal() ctx = utilflowcontrol.WithInitializationSignal(ctx, initSignal) - key, storedObj := TestPropagateStore(ctx, t, store, &example.Pod{ObjectMeta: metav1.ObjectMeta{Name: "foo"}}) + key, storedObj := testPropagateStore(ctx, t, store, &example.Pod{ObjectMeta: metav1.ObjectMeta{Name: "foo"}}) _, err := store.Watch(ctx, key, storage.ListOptions{ResourceVersion: storedObj.ResourceVersion, Predicate: storage.Everything}) if err != nil { t.Fatalf("Watch failed: %v", err) @@ -315,7 +315,7 @@ func RunOptionalTestProgressNotify(ctx context.Context, t *testing.T, store stor if err := store.Create(ctx, key, input, out, 0); err != nil { t.Fatalf("Create failed: %v", err) } - validateResourceVersion := ResourceVersionNotOlderThan(out.ResourceVersion) + validateResourceVersion := resourceVersionNotOlderThan(out.ResourceVersion) opts := storage.ListOptions{ ResourceVersion: out.ResourceVersion, @@ -329,7 +329,7 @@ func RunOptionalTestProgressNotify(ctx context.Context, t *testing.T, store stor // when we send a bookmark event, the client expects the event to contain an // object of the correct type, but with no fields set other than the resourceVersion - TestCheckResultFunc(t, watch.Bookmark, w, func(object runtime.Object) error { + testCheckResultFunc(t, watch.Bookmark, w, func(object runtime.Object) error { // first, check that we have the correct resource version obj, ok := object.(metav1.Object) if !ok {