From 4bb9457e40103c5e212ca5c3b4dc900590b051dd Mon Sep 17 00:00:00 2001 From: Khurram Baig Date: Thu, 23 Feb 2023 22:19:18 +0530 Subject: [PATCH] Remove deprecated pkg ioutil from test --- test/configmap.go | 4 ++-- test/eventlistener_test.go | 4 ++-- test/logs.go | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/test/configmap.go b/test/configmap.go index 04b180b54..8fd5564bd 100644 --- a/test/configmap.go +++ b/test/configmap.go @@ -18,7 +18,7 @@ package test import ( "fmt" - "io/ioutil" + "os" "testing" corev1 "k8s.io/api/core/v1" @@ -30,7 +30,7 @@ import ( func ConfigMapFromTestFile(t *testing.T, name string) *corev1.ConfigMap { t.Helper() - b, err := ioutil.ReadFile(fmt.Sprintf("testdata/%s.yaml", name)) + b, err := os.ReadFile(fmt.Sprintf("testdata/%s.yaml", name)) if err != nil { t.Fatalf("ReadFile() = %v", err) } diff --git a/test/eventlistener_test.go b/test/eventlistener_test.go index f974fadce..9099c941f 100644 --- a/test/eventlistener_test.go +++ b/test/eventlistener_test.go @@ -24,9 +24,9 @@ import ( "context" "encoding/json" "fmt" - "io/ioutil" "net/http" "net/url" + "os" "path/filepath" "strconv" "strings" @@ -68,7 +68,7 @@ const ( func loadExamplePREventBytes(t *testing.T) []byte { t.Helper() path := filepath.Join("testdata", examplePRJsonFilename) - bytes, err := ioutil.ReadFile(path) + bytes, err := os.ReadFile(path) if err != nil { t.Fatalf("Couldn't load test data example PullREquest event data: %v", err) } diff --git a/test/logs.go b/test/logs.go index f908eb59b..a89f88787 100644 --- a/test/logs.go +++ b/test/logs.go @@ -19,7 +19,7 @@ package test import ( "context" "fmt" - "io/ioutil" + "io" "strings" corev1 "k8s.io/api/core/v1" @@ -40,7 +40,7 @@ func CollectPodLogsWithLabel(c kubernetes.Interface, namespace, labelSelector st if err != nil { return "", err } - bs, err := ioutil.ReadAll(rc) + bs, err := io.ReadAll(rc) if err != nil { return "", err }