From 67dd3e671d709cbcf99cec29a3897b258b1ce791 Mon Sep 17 00:00:00 2001 From: Steve Kuznetsov Date: Wed, 16 Feb 2022 13:18:27 -0800 Subject: [PATCH] storage: etcd: pass contexts correctly in TestConsistentList Signed-off-by: Steve Kuznetsov Kubernetes-commit: 7272aca69d2602b0bcc97bb5cdc8139ba4687ceb --- pkg/storage/etcd3/store_test.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/pkg/storage/etcd3/store_test.go b/pkg/storage/etcd3/store_test.go index 473c813e9..6919ec452 100644 --- a/pkg/storage/etcd3/store_test.go +++ b/pkg/storage/etcd3/store_test.go @@ -2263,6 +2263,7 @@ func (t *fancyTransformer) createObject(ctx context.Context) error { func TestConsistentList(t *testing.T) { client := testserver.RunEtcd(t, nil) codec := apitesting.TestCodec(codecs, examplev1.SchemeGroupVersion) + ctx := context.Background() transformer := &fancyTransformer{ transformer: &prefixTransformer{prefix: []byte(defaultTestPrefix)}, @@ -2271,7 +2272,7 @@ func TestConsistentList(t *testing.T) { transformer.store = store for i := 0; i < 5; i++ { - if err := transformer.createObject(context.TODO()); err != nil { + if err := transformer.createObject(ctx); err != nil { t.Fatalf("failed to create object: %v", err) } } @@ -2293,7 +2294,7 @@ func TestConsistentList(t *testing.T) { options := storage.ListOptions{ Predicate: predicate, } - if err := store.List(context.TODO(), "/", options, &result1); err != nil { + if err := store.List(ctx, "/", options, &result1); err != nil { t.Fatalf("failed to list objects: %v", err) } @@ -2305,7 +2306,7 @@ func TestConsistentList(t *testing.T) { } result2 := example.PodList{} - if err := store.List(context.TODO(), "/", options, &result2); err != nil { + if err := store.List(ctx, "/", options, &result2); err != nil { t.Fatalf("failed to list objects: %v", err) } @@ -2317,7 +2318,7 @@ func TestConsistentList(t *testing.T) { options.ResourceVersionMatch = metav1.ResourceVersionMatchNotOlderThan result3 := example.PodList{} - if err := store.List(context.TODO(), "/", options, &result3); err != nil { + if err := store.List(ctx, "/", options, &result3); err != nil { t.Fatalf("failed to list objects: %v", err) } @@ -2325,7 +2326,7 @@ func TestConsistentList(t *testing.T) { options.ResourceVersionMatch = metav1.ResourceVersionMatchExact result4 := example.PodList{} - if err := store.List(context.TODO(), "/", options, &result4); err != nil { + if err := store.List(ctx, "/", options, &result4); err != nil { t.Fatalf("failed to list objects: %v", err) }