diff options
author | Paul Holzinger <pholzing@redhat.com> | 2022-04-27 14:28:38 +0200 |
---|---|---|
committer | Paul Holzinger <pholzing@redhat.com> | 2022-04-29 14:06:38 +0200 |
commit | 69c479b16e19f4f919fa820aeafe90cb113b8e0a (patch) | |
tree | 97047161fa35ce1a1fc1a1d5d555422411932ae8 /test/e2e/push_test.go | |
parent | ab3e072a0c3d321fd12cbd1f6ef8e322c6d9214a (diff) | |
download | podman-69c479b16e19f4f919fa820aeafe90cb113b8e0a.tar.gz podman-69c479b16e19f4f919fa820aeafe90cb113b8e0a.tar.bz2 podman-69c479b16e19f4f919fa820aeafe90cb113b8e0a.zip |
enable errcheck linter
The errcheck linter makes sure that errors are always check and not
ignored by accident. It spotted a lot of unchecked errors, mostly in the
tests but also some real problem in the code.
Signed-off-by: Paul Holzinger <pholzing@redhat.com>
Diffstat (limited to 'test/e2e/push_test.go')
-rw-r--r-- | test/e2e/push_test.go | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/test/e2e/push_test.go b/test/e2e/push_test.go index 3b571ab20..0288bf915 100644 --- a/test/e2e/push_test.go +++ b/test/e2e/push_test.go @@ -101,7 +101,8 @@ var _ = Describe("Podman push", func() { Skip("No registry image for ppc64le") } if rootless.IsRootless() { - podmanTest.RestoreArtifact(registry) + err := podmanTest.RestoreArtifact(registry) + Expect(err).ToNot(HaveOccurred()) } lock := GetPortLock("5000") defer lock.Unlock() @@ -132,8 +133,10 @@ var _ = Describe("Podman push", func() { Skip("No registry image for ppc64le") } authPath := filepath.Join(podmanTest.TempDir, "auth") - os.Mkdir(authPath, os.ModePerm) - os.MkdirAll("/etc/containers/certs.d/localhost:5000", os.ModePerm) + err = os.Mkdir(authPath, os.ModePerm) + Expect(err).ToNot(HaveOccurred()) + err = os.MkdirAll("/etc/containers/certs.d/localhost:5000", os.ModePerm) + Expect(err).ToNot(HaveOccurred()) defer os.RemoveAll("/etc/containers/certs.d/localhost:5000") cwd, _ := os.Getwd() @@ -157,11 +160,14 @@ var _ = Describe("Podman push", func() { session.WaitWithDefaultTimeout() Expect(session).Should(Exit(0)) - f, _ := os.Create(filepath.Join(authPath, "htpasswd")) + f, err := os.Create(filepath.Join(authPath, "htpasswd")) + Expect(err).ToNot(HaveOccurred()) defer f.Close() - f.WriteString(session.OutputToString()) - f.Sync() + _, err = f.WriteString(session.OutputToString()) + Expect(err).ToNot(HaveOccurred()) + err = f.Sync() + Expect(err).ToNot(HaveOccurred()) session = podmanTest.Podman([]string{"run", "-d", "-p", "5000:5000", "--name", "registry", "-v", strings.Join([]string{authPath, "/auth"}, ":"), "-e", "REGISTRY_AUTH=htpasswd", "-e", |