From af9875e210cb818ea2728a9f89c32905bbc29e6f Mon Sep 17 00:00:00 2001 From: James Munnelly Date: Mon, 30 Mar 2020 17:24:02 +0100 Subject: [PATCH] test/integration/webhook: Use context Signed-off-by: James Munnelly --- test/integration/webhook/dynamic_authority_test.go | 5 +++-- test/integration/webhook/dynamic_source_test.go | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/test/integration/webhook/dynamic_authority_test.go b/test/integration/webhook/dynamic_authority_test.go index 268a232af..261440325 100644 --- a/test/integration/webhook/dynamic_authority_test.go +++ b/test/integration/webhook/dynamic_authority_test.go @@ -18,6 +18,7 @@ package webhook import ( "bytes" + "context" "crypto/tls" "crypto/x509" "fmt" @@ -97,7 +98,7 @@ func TestDynamicAuthority_Recreates(t *testing.T) { } t.Logf("Secret resource has been provisioned, deleting to ensure it is recreated") - if err := cl.CoreV1().Secrets(auth.SecretNamespace).Delete(auth.SecretName, &metav1.DeleteOptions{}); err != nil { + if err := cl.CoreV1().Secrets(auth.SecretNamespace).Delete(context.TODO(), auth.SecretName, metav1.DeleteOptions{}); err != nil { t.Fatal(err) } @@ -114,7 +115,7 @@ func TestDynamicAuthority_Recreates(t *testing.T) { // This can be used with the `k8s.io/apimachinery/pkg/util/wait` package. func authoritySecretReadyConditionFunc(t *testing.T, cl kubernetes.Interface, namespace, name string) wait.ConditionFunc { return func() (done bool, err error) { - s, err := cl.CoreV1().Secrets(namespace).Get(name, metav1.GetOptions{}) + s, err := cl.CoreV1().Secrets(namespace).Get(context.TODO(), name, metav1.GetOptions{}) if apierrors.IsNotFound(err) { t.Logf("Secret resource %s/%s does not yet exist, waiting...", namespace, name) return false, nil diff --git a/test/integration/webhook/dynamic_source_test.go b/test/integration/webhook/dynamic_source_test.go index 075a0b908..901059d8d 100644 --- a/test/integration/webhook/dynamic_source_test.go +++ b/test/integration/webhook/dynamic_source_test.go @@ -17,6 +17,7 @@ limitations under the License. package webhook import ( + "context" "crypto/x509" "math/big" "testing" @@ -134,7 +135,7 @@ func TestDynamicSource_CARotation(t *testing.T) { } cl := kubernetes.NewForConfigOrDie(config) - if err := cl.CoreV1().Secrets(source.Authority.SecretNamespace).Delete(source.Authority.SecretName, &metav1.DeleteOptions{}); err != nil { + if err := cl.CoreV1().Secrets(source.Authority.SecretNamespace).Delete(context.TODO(), source.Authority.SecretName, metav1.DeleteOptions{}); err != nil { t.Fatalf("Failed to delete CA secret: %v", err) }