summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/apiv2/python/rest_api/test_v2_0_0_image.py3
-rw-r--r--test/e2e/build_test.go34
-rw-r--r--test/e2e/info_test.go4
-rw-r--r--test/e2e/run_test.go23
-rw-r--r--test/system/010-images.bats15
-rw-r--r--test/system/045-start.bats11
-rw-r--r--test/system/070-build.bats23
-rw-r--r--test/system/255-auto-update.bats2
-rw-r--r--test/system/450-interactive.bats13
-rw-r--r--test/system/500-networking.bats14
10 files changed, 113 insertions, 29 deletions
diff --git a/test/apiv2/python/rest_api/test_v2_0_0_image.py b/test/apiv2/python/rest_api/test_v2_0_0_image.py
index cea34e2e7..3e8ecb1ef 100644
--- a/test/apiv2/python/rest_api/test_v2_0_0_image.py
+++ b/test/apiv2/python/rest_api/test_v2_0_0_image.py
@@ -94,7 +94,8 @@ class ImageTestCase(APITestCase):
)
self.assertEqual(r.status_code, 200, r.text)
r = requests.post(
- self.podman_url + "/v1.40/images/create?fromSrc=-&repo=fedora&message=testing123",
+ self.podman_url
+ + "/v1.40/images/create?fromSrc=-&repo=fedora&message=testing123&platform=linux/amd64",
timeout=15,
)
self.assertEqual(r.status_code, 200, r.text)
diff --git a/test/e2e/build_test.go b/test/e2e/build_test.go
index 6255690b1..abaacdd5e 100644
--- a/test/e2e/build_test.go
+++ b/test/e2e/build_test.go
@@ -604,4 +604,38 @@ RUN echo hello`, ALPINE)
Expect(inspect.OutputToString()).To(Equal("windows"))
})
+
+ It("podman build device test", func() {
+ if _, err := os.Lstat("/dev/fuse"); err != nil {
+ Skip(fmt.Sprintf("test requires stat /dev/fuse to work: %v", err))
+ }
+ containerfile := fmt.Sprintf(`FROM %s
+RUN ls /dev/fuse`, ALPINE)
+ containerfilePath := filepath.Join(podmanTest.TempDir, "Containerfile")
+ err := ioutil.WriteFile(containerfilePath, []byte(containerfile), 0755)
+ Expect(err).To(BeNil())
+ session := podmanTest.Podman([]string{"build", "--pull-never", "-t", "test", "--file", containerfilePath, podmanTest.TempDir})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(125))
+
+ session = podmanTest.Podman([]string{"build", "--pull-never", "--device", "/dev/fuse", "-t", "test", "--file", containerfilePath, podmanTest.TempDir})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ })
+
+ It("podman build device rename test", func() {
+ SkipIfRootless("rootless builds do not currently support renaming devices")
+ containerfile := fmt.Sprintf(`FROM %s
+RUN ls /dev/test1`, ALPINE)
+ containerfilePath := filepath.Join(podmanTest.TempDir, "Containerfile")
+ err := ioutil.WriteFile(containerfilePath, []byte(containerfile), 0755)
+ Expect(err).To(BeNil())
+ session := podmanTest.Podman([]string{"build", "--pull-never", "-t", "test", "--file", containerfilePath, podmanTest.TempDir})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(125))
+
+ session = podmanTest.Podman([]string{"build", "--pull-never", "--device", "/dev/zero:/dev/test1", "-t", "test", "--file", containerfilePath, podmanTest.TempDir})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ })
})
diff --git a/test/e2e/info_test.go b/test/e2e/info_test.go
index f5b70d6bf..83d185be1 100644
--- a/test/e2e/info_test.go
+++ b/test/e2e/info_test.go
@@ -101,11 +101,11 @@ var _ = Describe("Podman Info", func() {
u, err := user.Current()
Expect(err).To(BeNil())
+ // Cannot use podmanTest.Podman() and test for storage path
expect := filepath.Join("/tmp", os.Getenv("HOME"), u.Username, u.Uid, "storage")
podmanPath := podmanTest.PodmanTest.PodmanBinary
- cmd := exec.Command(podmanPath, "info", "--format", "{{.Store.GraphRoot}}")
+ cmd := exec.Command(podmanPath, "info", "--format", "{{.Store.GraphRoot -}}")
out, err := cmd.CombinedOutput()
- fmt.Println(string(out))
Expect(err).To(BeNil())
Expect(string(out)).To(Equal(expect))
})
diff --git a/test/e2e/run_test.go b/test/e2e/run_test.go
index 58538b689..e71e7a248 100644
--- a/test/e2e/run_test.go
+++ b/test/e2e/run_test.go
@@ -904,6 +904,18 @@ USER bin`, BB)
Expect(session.ExitCode()).To(Equal(100))
})
+ It("podman run with named volume", func() {
+ session := podmanTest.Podman([]string{"run", "--rm", ALPINE, "stat", "-c", "%a %Y", "/var/tmp"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ perms := session.OutputToString()
+
+ session = podmanTest.Podman([]string{"run", "--rm", "-v", "test:/var/tmp", ALPINE, "stat", "-c", "%a %Y", "/var/tmp"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ Expect(session.OutputToString()).To(Equal(perms))
+ })
+
It("podman run with built-in volume image", func() {
session := podmanTest.Podman([]string{"run", "--rm", redis, "ls"})
session.WaitWithDefaultTimeout()
@@ -921,17 +933,6 @@ USER mail`, BB)
Expect(session.OutputToString()).To(ContainSubstring("mail root"))
})
- It("podman run with incorect VOLUME", func() {
- dockerfile := fmt.Sprintf(`FROM %s
-VOLUME ['/etc/foo']
-WORKDIR /etc/foo`, BB)
- podmanTest.BuildImage(dockerfile, "test", "false")
- session := podmanTest.Podman([]string{"run", "--rm", "test", "echo", "test"})
- session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
- Expect(session.OutputToString()).To(ContainSubstring("test"))
- })
-
It("podman run --volumes-from flag", func() {
vol := filepath.Join(podmanTest.TempDir, "vol-test")
err := os.MkdirAll(vol, 0755)
diff --git a/test/system/010-images.bats b/test/system/010-images.bats
index 2d7ac1e0c..649987dfd 100644
--- a/test/system/010-images.bats
+++ b/test/system/010-images.bats
@@ -19,21 +19,22 @@ load helpers
@test "podman images - custom formats" {
tests="
---format {{.ID}} | [0-9a-f]\\\{12\\\}
---format {{.ID}} --no-trunc | sha256:[0-9a-f]\\\{64\\\}
---format {{.Repository}}:{{.Tag}} | $PODMAN_TEST_IMAGE_FQN
---format {{.Labels.created_by}} | test/system/build-testimage
---format {{.Labels.created_at}} | 20[0-9-]\\\+T[0-9:]\\\+Z
+{{.ID}} | [0-9a-f]\\\{12\\\}
+{{.ID| upper}} | [0-9A-F]\\\{12\\\}
+{{.Repository}}:{{.Tag}} | $PODMAN_TEST_IMAGE_FQN
+{{.Labels.created_by}} | test/system/build-testimage
+{{.Labels.created_at}} | 20[0-9-]\\\+T[0-9:]\\\+Z
"
parse_table "$tests" | while read fmt expect; do
- run_podman images $fmt
+ run_podman images --format "$fmt"
is "$output" "$expect\$" "podman images $fmt"
done
+ run_podman images --format "{{.ID}}" --no-trunc
+ is "$output" "sha256:[0-9a-f]\\{64\\}\$" "podman images --no-trunc"
}
-
@test "podman images - json" {
# 'created': podman includes fractional seconds, podman-remote does not
tests="
diff --git a/test/system/045-start.bats b/test/system/045-start.bats
index 3e0118dba..7e4bbde8d 100644
--- a/test/system/045-start.bats
+++ b/test/system/045-start.bats
@@ -59,4 +59,15 @@ load helpers
is "$output" "Error: fakepolicy invalid restart policy"
}
+@test "podman start --all --filter" {
+ run_podman run -d $IMAGE /bin/true
+ cid_exited_0="$output"
+ run_podman run -d $IMAGE /bin/false
+ cid_exited_1="$output"
+
+ run_podman wait $cid_exited_0 $cid_exited_1
+ run_podman start --all --filter exited=0
+ is "$output" "$cid_exited_0"
+}
+
# vim: filetype=sh
diff --git a/test/system/070-build.bats b/test/system/070-build.bats
index 40622d6cc..6843e28a5 100644
--- a/test/system/070-build.bats
+++ b/test/system/070-build.bats
@@ -29,6 +29,29 @@ EOF
run_podman rmi -f build_test
}
+@test "podman build test -f -" {
+ rand_filename=$(random_string 20)
+ rand_content=$(random_string 50)
+
+ tmpdir=$PODMAN_TMPDIR/build-test
+ mkdir -p $tmpdir
+ containerfile=$PODMAN_TMPDIR/Containerfile
+ cat >$containerfile <<EOF
+FROM $IMAGE
+RUN apk add nginx
+RUN echo $rand_content > /$rand_filename
+EOF
+
+ # The 'apk' command can take a long time to fetch files; bump timeout
+ PODMAN_TIMEOUT=240 run_podman build -t build_test -f - --format=docker $tmpdir < $containerfile
+ is "$output" ".*STEP 4: COMMIT" "COMMIT seen in log"
+
+ run_podman run --rm build_test cat /$rand_filename
+ is "$output" "$rand_content" "reading generated file in image"
+
+ run_podman rmi -f build_test
+}
+
@test "podman build - global runtime flags test" {
skip_if_remote "--runtime-flag flag not supported for remote"
diff --git a/test/system/255-auto-update.bats b/test/system/255-auto-update.bats
index 9bfb44791..3713243d5 100644
--- a/test/system/255-auto-update.bats
+++ b/test/system/255-auto-update.bats
@@ -194,7 +194,7 @@ function _confirm_update() {
run_podman 125 auto-update
update_log=$output
is "$update_log" ".*invalid auto-update policy.*" "invalid policy setup"
- is "$update_log" ".*1 error occurred.*" "invalid policy setup"
+ is "$update_log" ".*Error: invalid auto-update policy.*" "invalid policy setup"
local n_updated=$(grep -c 'Trying to pull' <<<"$update_log")
is "$n_updated" "2" "Number of images updated from registry."
diff --git a/test/system/450-interactive.bats b/test/system/450-interactive.bats
index a2db39492..47bdff9ab 100644
--- a/test/system/450-interactive.bats
+++ b/test/system/450-interactive.bats
@@ -57,7 +57,18 @@ function teardown() {
# ...and make sure stty under podman reads that.
run_podman run -it --name mystty $IMAGE stty size <$PODMAN_TEST_PTY
- is "$output" "$rows $cols" "stty under podman reads the correct dimensions"
+ is "$output" "$rows $cols" "stty under podman run reads the correct dimensions"
+
+ run_podman rm -f mystty
+
+ # FIXME: the checks below are flaking a lot (see #10710).
+
+ # check that the same works for podman exec
+# run_podman run -d --name mystty $IMAGE top
+# run_podman exec -it mystty stty size <$PODMAN_TEST_PTY
+# is "$output" "$rows $cols" "stty under podman exec reads the correct dimensions"
+#
+# run_podman rm -f mystty
}
diff --git a/test/system/500-networking.bats b/test/system/500-networking.bats
index 55ec80bb2..d55a786f7 100644
--- a/test/system/500-networking.bats
+++ b/test/system/500-networking.bats
@@ -162,23 +162,25 @@ load helpers
done
}
-@test "podman run with slirp4ns assigns correct gateway address to host.containers.internal" {
+@test "podman run with slirp4ns assigns correct addresses to /etc/hosts" {
CIDR="$(random_rfc1918_subnet)"
- run_podman run --network slirp4netns:cidr="${CIDR}.0/24" \
- $IMAGE grep 'host.containers.internal' /etc/hosts
- is "$output" "${CIDR}.2 host.containers.internal" "host.containers.internal should be the cidr+2 address"
+ local conname=con-$(random_string 10)
+ run_podman run --rm --network slirp4netns:cidr="${CIDR}.0/24" \
+ --name $conname --hostname $conname $IMAGE cat /etc/hosts
+ is "$output" ".*${CIDR}.2 host.containers.internal" "host.containers.internal should be the cidr+2 address"
+ is "$output" ".*${CIDR}.100 $conname $conname" "$conname should be the cidr+100 address"
}
@test "podman run with slirp4ns adds correct dns address to resolv.conf" {
CIDR="$(random_rfc1918_subnet)"
- run_podman run --network slirp4netns:cidr="${CIDR}.0/24" \
+ run_podman run --rm --network slirp4netns:cidr="${CIDR}.0/24" \
$IMAGE grep "${CIDR}" /etc/resolv.conf
is "$output" "nameserver ${CIDR}.3" "resolv.conf should have slirp4netns cidr+3 as a nameserver"
}
@test "podman run with slirp4ns assigns correct ip address container" {
CIDR="$(random_rfc1918_subnet)"
- run_podman run --network slirp4netns:cidr="${CIDR}.0/24" \
+ run_podman run --rm --network slirp4netns:cidr="${CIDR}.0/24" \
$IMAGE sh -c "ip address | grep ${CIDR}"
is "$output" ".*inet ${CIDR}.100/24 \+" "container should have slirp4netns cidr+100 assigned to interface"
}