summaryrefslogtreecommitdiff
path: root/test/e2e/login_logout_test.go
diff options
context:
space:
mode:
authorPaul Holzinger <pholzing@redhat.com>2022-04-27 14:28:38 +0200
committerPaul Holzinger <pholzing@redhat.com>2022-04-29 14:06:38 +0200
commit69c479b16e19f4f919fa820aeafe90cb113b8e0a (patch)
tree97047161fa35ce1a1fc1a1d5d555422411932ae8 /test/e2e/login_logout_test.go
parentab3e072a0c3d321fd12cbd1f6ef8e322c6d9214a (diff)
downloadpodman-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/login_logout_test.go')
-rw-r--r--test/e2e/login_logout_test.go21
1 files changed, 14 insertions, 7 deletions
diff --git a/test/e2e/login_logout_test.go b/test/e2e/login_logout_test.go
index 001779cdf..bce8b78c6 100644
--- a/test/e2e/login_logout_test.go
+++ b/test/e2e/login_logout_test.go
@@ -36,7 +36,8 @@ var _ = Describe("Podman login and logout", func() {
podmanTest = PodmanTestCreate(tempdir)
authPath = filepath.Join(podmanTest.TempDir, "auth")
- os.Mkdir(authPath, os.ModePerm)
+ err := os.Mkdir(authPath, os.ModePerm)
+ Expect(err).ToNot(HaveOccurred())
if IsCommandAvailable("getenforce") {
ge := SystemExec("getenforce", []string{})
@@ -55,11 +56,14 @@ var _ = Describe("Podman login and logout", 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())
port := GetPort()
server = strings.Join([]string{"localhost", strconv.Itoa(port)}, ":")
@@ -68,7 +72,8 @@ var _ = Describe("Podman login and logout", func() {
testImg = strings.Join([]string{server, "test-alpine"}, "/")
certDirPath = filepath.Join(os.Getenv("HOME"), ".config/containers/certs.d", server)
- os.MkdirAll(certDirPath, os.ModePerm)
+ err = os.MkdirAll(certDirPath, os.ModePerm)
+ Expect(err).ToNot(HaveOccurred())
cwd, _ := os.Getwd()
certPath = filepath.Join(cwd, "../", "certs")
@@ -207,7 +212,8 @@ var _ = Describe("Podman login and logout", func() {
})
It("podman login and logout with --cert-dir", func() {
certDir := filepath.Join(podmanTest.TempDir, "certs")
- os.MkdirAll(certDir, os.ModePerm)
+ err := os.MkdirAll(certDir, os.ModePerm)
+ Expect(err).ToNot(HaveOccurred())
setup := SystemExec("cp", []string{filepath.Join(certPath, "domain.crt"), filepath.Join(certDir, "ca.crt")})
setup.WaitWithDefaultTimeout()
@@ -226,7 +232,8 @@ var _ = Describe("Podman login and logout", func() {
})
It("podman login and logout with multi registry", func() {
certDir := filepath.Join(os.Getenv("HOME"), ".config/containers/certs.d", "localhost:9001")
- os.MkdirAll(certDir, os.ModePerm)
+ err = os.MkdirAll(certDir, os.ModePerm)
+ Expect(err).ToNot(HaveOccurred())
cwd, _ := os.Getwd()
certPath = filepath.Join(cwd, "../", "certs")