summaryrefslogtreecommitdiff
path: root/test/e2e
diff options
context:
space:
mode:
authorEng Zer Jun <engzerjun@gmail.com>2022-09-11 15:58:31 +0800
committerEng Zer Jun <engzerjun@gmail.com>2022-09-11 15:58:31 +0800
commit118546c6a70704a7b19cb99f3c948b28264628de (patch)
tree5eb092820335de6860d5b5304a2a3e02f8125d03 /test/e2e
parentb9cbc0c09a68be7bb55048a494753c77c08bfbd3 (diff)
downloadpodman-118546c6a70704a7b19cb99f3c948b28264628de.tar.gz
podman-118546c6a70704a7b19cb99f3c948b28264628de.tar.bz2
podman-118546c6a70704a7b19cb99f3c948b28264628de.zip
refactor: use `os.ReadDir` for lightweight directory reading
`os.ReadDir` was added in Go 1.16 as part of the deprecation of `ioutil` package. It is a more efficient implementation than `ioutil.ReadDir`. Reference: https://pkg.go.dev/io/ioutil#ReadDir Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
Diffstat (limited to 'test/e2e')
-rw-r--r--test/e2e/benchmarks_test.go2
-rw-r--r--test/e2e/container_create_volume_test.go2
-rw-r--r--test/e2e/image_sign_test.go3
-rw-r--r--test/e2e/manifest_test.go2
-rw-r--r--test/e2e/push_test.go2
5 files changed, 5 insertions, 6 deletions
diff --git a/test/e2e/benchmarks_test.go b/test/e2e/benchmarks_test.go
index 4be048de2..d1332665a 100644
--- a/test/e2e/benchmarks_test.go
+++ b/test/e2e/benchmarks_test.go
@@ -99,7 +99,7 @@ var _ = Describe("Podman Benchmark Suite", func() {
}
totalMemoryInKb := func() (total uint64) {
- files, err := ioutil.ReadDir(timedir)
+ files, err := os.ReadDir(timedir)
if err != nil {
Fail(fmt.Sprintf("Error reading timing dir: %v", err))
}
diff --git a/test/e2e/container_create_volume_test.go b/test/e2e/container_create_volume_test.go
index 6d9f13694..3c54691aa 100644
--- a/test/e2e/container_create_volume_test.go
+++ b/test/e2e/container_create_volume_test.go
@@ -58,7 +58,7 @@ func checkDataVolumeContainer(pTest *PodmanTestIntegration, image, cont, dest, d
Expect(volList.OutputToStringArray()[0]).To(Equal(mntName))
// Check the mount source directory
- files, err := ioutil.ReadDir(mntSource)
+ files, err := os.ReadDir(mntSource)
Expect(err).To(BeNil())
if data == "" {
diff --git a/test/e2e/image_sign_test.go b/test/e2e/image_sign_test.go
index 3c819a7d2..5568acc01 100644
--- a/test/e2e/image_sign_test.go
+++ b/test/e2e/image_sign_test.go
@@ -1,7 +1,6 @@
package integration
import (
- "io/ioutil"
"os"
"os/exec"
"path/filepath"
@@ -69,7 +68,7 @@ var _ = Describe("Podman image sign", func() {
session := podmanTest.Podman([]string{"image", "sign", "--all", "--directory", sigDir, "--sign-by", "foo@bar.com", "docker://library/alpine"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- fInfos, err := ioutil.ReadDir(filepath.Join(sigDir, "library"))
+ fInfos, err := os.ReadDir(filepath.Join(sigDir, "library"))
Expect(err).To(BeNil())
Expect(len(fInfos)).To(BeNumerically(">", 1), "len(fInfos)")
})
diff --git a/test/e2e/manifest_test.go b/test/e2e/manifest_test.go
index 60b72dcaa..e38499257 100644
--- a/test/e2e/manifest_test.go
+++ b/test/e2e/manifest_test.go
@@ -332,7 +332,7 @@ var _ = Describe("Podman manifest", func() {
blobsDir := filepath.Join(dest, "blobs", "sha256")
- blobs, err := ioutil.ReadDir(blobsDir)
+ blobs, err := os.ReadDir(blobsDir)
Expect(err).To(BeNil())
for _, f := range blobs {
diff --git a/test/e2e/push_test.go b/test/e2e/push_test.go
index 898d21d00..a73b7c87b 100644
--- a/test/e2e/push_test.go
+++ b/test/e2e/push_test.go
@@ -78,7 +78,7 @@ var _ = Describe("Podman push", func() {
blobsDir := filepath.Join(bbdir, "blobs/sha256")
- blobs, err := ioutil.ReadDir(blobsDir)
+ blobs, err := os.ReadDir(blobsDir)
Expect(err).To(BeNil())
for _, f := range blobs {