summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/e2e/generate_kube_test.go32
-rw-r--r--test/e2e/run_test.go12
-rw-r--r--test/system/030-run.bats15
-rw-r--r--test/system/070-build.bats2
4 files changed, 58 insertions, 3 deletions
diff --git a/test/e2e/generate_kube_test.go b/test/e2e/generate_kube_test.go
index 1ec8d51c1..3c3fb5a4d 100644
--- a/test/e2e/generate_kube_test.go
+++ b/test/e2e/generate_kube_test.go
@@ -151,6 +151,38 @@ var _ = Describe("Podman generate kube", func() {
Expect(numContainers).To(Equal(1))
})
+ It("podman generate kube on pod with hostAliases", func() {
+ podName := "testHost"
+ testIP := "127.0.0.1"
+ podSession := podmanTest.Podman([]string{"pod", "create", "--name", podName,
+ "--add-host", "test1.podman.io" + ":" + testIP,
+ "--add-host", "test2.podman.io" + ":" + testIP,
+ })
+ podSession.WaitWithDefaultTimeout()
+ Expect(podSession.ExitCode()).To(Equal(0))
+
+ ctr1Name := "ctr1"
+ ctr1Session := podmanTest.Podman([]string{"create", "--name", ctr1Name, "--pod", podName, ALPINE, "top"})
+ ctr1Session.WaitWithDefaultTimeout()
+ Expect(ctr1Session.ExitCode()).To(Equal(0))
+
+ ctr2Name := "ctr2"
+ ctr2Session := podmanTest.Podman([]string{"create", "--name", ctr2Name, "--pod", podName, ALPINE, "top"})
+ ctr2Session.WaitWithDefaultTimeout()
+ Expect(ctr2Session.ExitCode()).To(Equal(0))
+
+ kube := podmanTest.Podman([]string{"generate", "kube", podName})
+ kube.WaitWithDefaultTimeout()
+ Expect(kube.ExitCode()).To(Equal(0))
+
+ pod := new(v1.Pod)
+ err := yaml.Unmarshal(kube.Out.Contents(), pod)
+ Expect(err).To(BeNil())
+ Expect(len(pod.Spec.HostAliases)).To(Equal(2))
+ Expect(pod.Spec.HostAliases[0].IP).To(Equal(testIP))
+ Expect(pod.Spec.HostAliases[1].IP).To(Equal(testIP))
+ })
+
It("podman generate service kube on pod", func() {
_, rc, _ := podmanTest.CreatePod("toppod")
Expect(rc).To(Equal(0))
diff --git a/test/e2e/run_test.go b/test/e2e/run_test.go
index 157b7d3d7..91b0d3e48 100644
--- a/test/e2e/run_test.go
+++ b/test/e2e/run_test.go
@@ -1204,4 +1204,16 @@ WORKDIR /madethis`
// nonprintables seem to work their way in.
Expect(session.OutputToString()).To(Not(ContainSubstring("/bin/sh")))
})
+
+ It("podman run a container with log-level (lower case)", func() {
+ session := podmanTest.Podman([]string{"--log-level=info", "run", ALPINE, "ls"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ })
+
+ It("podman run a container with log-level (upper case)", func() {
+ session := podmanTest.Podman([]string{"--log-level=INFO", "run", ALPINE, "ls"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ })
})
diff --git a/test/system/030-run.bats b/test/system/030-run.bats
index 34afd5bae..198c8881d 100644
--- a/test/system/030-run.bats
+++ b/test/system/030-run.bats
@@ -294,11 +294,22 @@ echo $rand | 0 | $rand
run_podman run -d --userns=keep-id $IMAGE sh -c 'while ! test -e /stop; do sleep 0.1; done'
cid="$output"
+ # Assign a UID that is (a) not in our image /etc/passwd and (b) not
+ # the same as that of the user running the test script; this guarantees
+ # that the added passwd entry will be what we expect.
+ #
+ # For GID, we have to use one that already exists in the container. And
+ # unfortunately, 'adduser' requires a string name. We use 999:ping
+ local uid=4242
+ if [[ $uid == $(id -u) ]]; then
+ uid=4343
+ fi
+
gecos="$(random_string 6) $(random_string 8)"
- run_podman exec --user root $cid adduser -D -g "$gecos" -s /bin/sh newuser3
+ run_podman exec --user root $cid adduser -u $uid -G ping -D -g "$gecos" -s /bin/sh newuser3
is "$output" "" "output from adduser"
run_podman exec $cid tail -1 /etc/passwd
- is "$output" "newuser3:x:1000:1000:$gecos:/home/newuser3:/bin/sh" \
+ is "$output" "newuser3:x:$uid:999:$gecos:/home/newuser3:/bin/sh" \
"newuser3 added to /etc/passwd in container"
run_podman exec $cid touch /stop
diff --git a/test/system/070-build.bats b/test/system/070-build.bats
index 0e6e97d40..997699ecb 100644
--- a/test/system/070-build.bats
+++ b/test/system/070-build.bats
@@ -12,7 +12,7 @@ load helpers
rand_content=$(random_string 50)
tmpdir=$PODMAN_TMPDIR/build-test
- run mkdir -p $tmpdir || die "Could not mkdir $tmpdir"
+ mkdir -p $tmpdir
dockerfile=$tmpdir/Dockerfile
cat >$dockerfile <<EOF
FROM $IMAGE