aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-04-07 19:32:09 +0200
committerGitHub <noreply@github.com>2020-04-07 19:32:09 +0200
commit9d0d9df6a1973ce9982071601fbdca68c93c6d07 (patch)
treef42d0f151bc6107ef5003b8dec2231d3ea038209 /test
parentb3a3fc3ef6750b01d6182ea43f1fb0921966408b (diff)
parent7f801b437f2fe9c6c437550be57e638e9c296c4b (diff)
downloadpodman-9d0d9df6a1973ce9982071601fbdca68c93c6d07.tar.gz
podman-9d0d9df6a1973ce9982071601fbdca68c93c6d07.tar.bz2
podman-9d0d9df6a1973ce9982071601fbdca68c93c6d07.zip
Merge pull request #5157 from QiWang19/rootless-test-login
fix rootless login/logout tests
Diffstat (limited to 'test')
-rw-r--r--test/e2e/login_logout_test.go23
1 files changed, 10 insertions, 13 deletions
diff --git a/test/e2e/login_logout_test.go b/test/e2e/login_logout_test.go
index 42698d270..3f76daa67 100644
--- a/test/e2e/login_logout_test.go
+++ b/test/e2e/login_logout_test.go
@@ -24,6 +24,7 @@ var _ = Describe("Podman login and logout", func() {
podmanTest *PodmanTestIntegration
authPath string
certPath string
+ certDirPath string
port int
server string
testImg string
@@ -70,12 +71,12 @@ var _ = Describe("Podman login and logout", func() {
testImg = strings.Join([]string{server, "test-apline"}, "/")
- os.MkdirAll(filepath.Join("/etc/containers/certs.d", server), os.ModePerm)
-
+ certDirPath = filepath.Join(os.Getenv("HOME"), ".config/containers/certs.d", server)
+ os.MkdirAll(certDirPath, os.ModePerm)
cwd, _ := os.Getwd()
certPath = filepath.Join(cwd, "../", "certs")
- setup := SystemExec("cp", []string{filepath.Join(certPath, "domain.crt"), filepath.Join("/etc/containers/certs.d", server, "ca.crt")})
+ setup := SystemExec("cp", []string{filepath.Join(certPath, "domain.crt"), filepath.Join(certDirPath, "ca.crt")})
setup.WaitWithDefaultTimeout()
session = podmanTest.Podman([]string{"run", "-d", "-p", strings.Join([]string{strconv.Itoa(port), strconv.Itoa(port)}, ":"),
@@ -95,11 +96,10 @@ var _ = Describe("Podman login and logout", func() {
AfterEach(func() {
podmanTest.Cleanup()
os.RemoveAll(authPath)
- os.RemoveAll(filepath.Join("/etc/containers/certs.d", server))
+ os.RemoveAll(certDirPath)
})
It("podman login and logout", func() {
- SkipIfRootless()
session := podmanTest.Podman([]string{"login", "-u", "podmantest", "-p", "test", server})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
@@ -150,7 +150,6 @@ var _ = Describe("Podman login and logout", func() {
})
It("podman login and logout with flag --authfile", func() {
- SkipIfRootless()
authFile := filepath.Join(podmanTest.TempDir, "auth.json")
session := podmanTest.Podman([]string{"login", "--username", "podmantest", "--password", "test", "--authfile", authFile, server})
session.WaitWithDefaultTimeout()
@@ -183,7 +182,6 @@ var _ = Describe("Podman login and logout", func() {
})
It("podman login and logout with --tls-verify", func() {
- SkipIfRootless()
session := podmanTest.Podman([]string{"login", "--username", "podmantest", "--password", "test", "--tls-verify=false", server})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
@@ -197,7 +195,6 @@ var _ = Describe("Podman login and logout", func() {
Expect(session.ExitCode()).To(Equal(0))
})
It("podman login and logout with --cert-dir", func() {
- SkipIfRootless()
certDir := filepath.Join(podmanTest.TempDir, "certs")
os.MkdirAll(certDir, os.ModePerm)
@@ -208,7 +205,7 @@ var _ = Describe("Podman login and logout", func() {
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
- session = podmanTest.Podman([]string{"push", ALPINE, testImg})
+ session = podmanTest.Podman([]string{"push", "--cert-dir", certDir, ALPINE, testImg})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
@@ -217,15 +214,15 @@ var _ = Describe("Podman login and logout", func() {
Expect(session.ExitCode()).To(Equal(0))
})
It("podman login and logout with multi registry", func() {
- SkipIfRootless()
- os.MkdirAll("/etc/containers/certs.d/localhost:9001", os.ModePerm)
+ certDir := filepath.Join(os.Getenv("HOME"), ".config/containers/certs.d", "localhost:9001")
+ os.MkdirAll(certDir, os.ModePerm)
cwd, _ := os.Getwd()
certPath = filepath.Join(cwd, "../", "certs")
- setup := SystemExec("cp", []string{filepath.Join(certPath, "domain.crt"), "/etc/containers/certs.d/localhost:9001/ca.crt"})
+ setup := SystemExec("cp", []string{filepath.Join(certPath, "domain.crt"), filepath.Join(certDir, "ca.crt")})
setup.WaitWithDefaultTimeout()
- defer os.RemoveAll("/etc/containers/certs.d/localhost:9001")
+ defer os.RemoveAll(certDir)
session := podmanTest.Podman([]string{"run", "-d", "-p", "9001:9001", "-e", "REGISTRY_HTTP_ADDR=0.0.0.0:9001", "--name", "registry1", "-v",
strings.Join([]string{authPath, "/auth"}, ":"), "-e", "REGISTRY_AUTH=htpasswd", "-e",