From 4b0cef979a1a6b6e8169d5c327beabd6511901da Mon Sep 17 00:00:00 2001 From: guoguangwu Date: Sat, 17 Jun 2023 14:05:01 +0800 Subject: [PATCH] chore: remove refs to deprecated io/ioutil Signed-off-by: guoguangwu --- e2e/cloudproviderinfo_test.go | 4 ++-- e2e/cniinfo_test.go | 4 ++-- e2e/controlplaneinfo_test.go | 4 ++-- e2e/kubeletinfo_test.go | 4 ++-- e2e/kubeproxyinfo_test.go | 4 ++-- e2e/linuxsecurityhardening_test.go | 4 ++-- e2e/openedports_test.go | 4 ++-- e2e/osrelease_test.go | 4 ++-- e2e/version_test.go | 4 ++-- 9 files changed, 18 insertions(+), 18 deletions(-) diff --git a/e2e/cloudproviderinfo_test.go b/e2e/cloudproviderinfo_test.go index 07828e0..b3641b1 100644 --- a/e2e/cloudproviderinfo_test.go +++ b/e2e/cloudproviderinfo_test.go @@ -2,7 +2,7 @@ package e2e_test import ( "encoding/json" - "io/ioutil" + "io" "net/http" "github.com/kubescape/host-scanner/sensor" @@ -30,7 +30,7 @@ var _ = Describe("Cloudproviderinfo", func() { It("should return the expected value of CloudProviderInfo", func() { resultBody := &sensor.CloudProviderInfo{} - resBody, err = ioutil.ReadAll(res.Body) + resBody, err = io.ReadAll(res.Body) Expect(err).ToNot(HaveOccurred()) err = json.Unmarshal(resBody, resultBody) diff --git a/e2e/cniinfo_test.go b/e2e/cniinfo_test.go index 82aa0c9..868504e 100644 --- a/e2e/cniinfo_test.go +++ b/e2e/cniinfo_test.go @@ -2,7 +2,7 @@ package e2e_test import ( "encoding/json" - "io/ioutil" + "io" "net/http" "github.com/kubescape/host-scanner/sensor" @@ -29,7 +29,7 @@ var _ = Describe("CniInfo", func() { It("should return the expected value of CNIInfo", func() { resultBody := &sensor.CNIInfo{} - resBody, err = ioutil.ReadAll(res.Body) + resBody, err = io.ReadAll(res.Body) Expect(err).ToNot(HaveOccurred()) err = json.Unmarshal(resBody, resultBody) diff --git a/e2e/controlplaneinfo_test.go b/e2e/controlplaneinfo_test.go index 1560a7c..9f1078f 100644 --- a/e2e/controlplaneinfo_test.go +++ b/e2e/controlplaneinfo_test.go @@ -4,7 +4,7 @@ package e2e_test import ( "encoding/json" - "io/ioutil" + "io" "net/http" . "github.com/onsi/ginkgo" @@ -32,7 +32,7 @@ var _ = Describe("ControlPlaneInfo", func() { It("should return the expected value of PKIDir and PKIFiles", func() { resultBody := &sensor.ControlPlaneInfo{} - resBody, err = ioutil.ReadAll(res.Body) + resBody, err = io.ReadAll(res.Body) Expect(err).ToNot(HaveOccurred()) err = json.Unmarshal(resBody, resultBody) diff --git a/e2e/kubeletinfo_test.go b/e2e/kubeletinfo_test.go index 58e9f0f..0c67430 100644 --- a/e2e/kubeletinfo_test.go +++ b/e2e/kubeletinfo_test.go @@ -2,7 +2,7 @@ package e2e_test import ( "encoding/json" - "io/ioutil" + "io" "net/http" "github.com/kubescape/host-scanner/sensor" @@ -29,7 +29,7 @@ var _ = Describe("Kubeletinfo", func() { It("should return the expected value of KubeletInfo", func() { resultBody := &sensor.KubeletInfo{} - resBody, err = ioutil.ReadAll(res.Body) + resBody, err = io.ReadAll(res.Body) Expect(err).ToNot(HaveOccurred()) err = json.Unmarshal(resBody, resultBody) diff --git a/e2e/kubeproxyinfo_test.go b/e2e/kubeproxyinfo_test.go index 8bc43d7..afefb76 100644 --- a/e2e/kubeproxyinfo_test.go +++ b/e2e/kubeproxyinfo_test.go @@ -2,7 +2,7 @@ package e2e_test import ( "encoding/json" - "io/ioutil" + "io" "net/http" sensor "github.com/kubescape/host-scanner/sensor" @@ -29,7 +29,7 @@ var _ = Describe("KubeProxyInfo", func() { It("should return the expected value of KubeProxyInfo", func() { resultBody := &sensor.KubeProxyInfo{} - resBody, err = ioutil.ReadAll(res.Body) + resBody, err = io.ReadAll(res.Body) Expect(err).ToNot(HaveOccurred()) err = json.Unmarshal(resBody, resultBody) diff --git a/e2e/linuxsecurityhardening_test.go b/e2e/linuxsecurityhardening_test.go index 517f0e0..5590a0f 100644 --- a/e2e/linuxsecurityhardening_test.go +++ b/e2e/linuxsecurityhardening_test.go @@ -4,7 +4,7 @@ package e2e_test import ( "encoding/json" - "io/ioutil" + "io" "net/http" ds "github.com/kubescape/host-scanner/sensor/datastructures" @@ -31,7 +31,7 @@ var _ = Describe("LinuxSecurityHardening", func() { It("should return the expected value of LinuxSecurityHardeningStatus", func() { resultBody := &ds.LinuxSecurityHardeningStatus{} - resBody, err = ioutil.ReadAll(res.Body) + resBody, err = io.ReadAll(res.Body) Expect(err).ToNot(HaveOccurred()) err = json.Unmarshal(resBody, resultBody) diff --git a/e2e/openedports_test.go b/e2e/openedports_test.go index 1b83751..8556725 100644 --- a/e2e/openedports_test.go +++ b/e2e/openedports_test.go @@ -4,7 +4,7 @@ package e2e_test import ( "encoding/json" - "io/ioutil" + "io" "net/http" "github.com/kubescape/host-scanner/sensor" @@ -41,7 +41,7 @@ var _ = Describe("Openedports", func() { } jsonOpenedPortsInfo := &sensor.OpenPortsStatus{} - resBody, err = ioutil.ReadAll(res.Body) + resBody, err = io.ReadAll(res.Body) Expect(err).ToNot(HaveOccurred()) err = json.Unmarshal(resBody, jsonOpenedPortsInfo) diff --git a/e2e/osrelease_test.go b/e2e/osrelease_test.go index 1a5ea5e..6dc04ad 100644 --- a/e2e/osrelease_test.go +++ b/e2e/osrelease_test.go @@ -3,7 +3,7 @@ package e2e_test import ( - "io/ioutil" + "io" "net/http" . "github.com/onsi/ginkgo" @@ -29,7 +29,7 @@ var _ = Describe("OsRelease", func() { Expect(res.StatusCode).To(BeEquivalentTo(200)) }) It("should return the expected value", func() { - resBody, err = ioutil.ReadAll(res.Body) + resBody, err = io.ReadAll(res.Body) Ω(string(resBody)).Should(ContainSubstring(expectedResult)) }) }) diff --git a/e2e/version_test.go b/e2e/version_test.go index f5276f5..de4a02d 100644 --- a/e2e/version_test.go +++ b/e2e/version_test.go @@ -1,7 +1,7 @@ package e2e_test import ( - "io/ioutil" + "io" "net/http" . "github.com/onsi/ginkgo" @@ -27,7 +27,7 @@ var _ = Describe("Version", func() { Expect(res.StatusCode).To(BeEquivalentTo(200)) }) It("should return the expected value", func() { - resBody, err = ioutil.ReadAll(res.Body) + resBody, err = io.ReadAll(res.Body) Expect(string(resBody)).To(BeEquivalentTo(expectedResult)) }) })