summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/apiv2/10-images.at35
-rwxr-xr-xtest/compose/test-compose2
-rw-r--r--test/e2e/build_test.go34
-rw-r--r--test/e2e/run_volume_test.go32
4 files changed, 103 insertions, 0 deletions
diff --git a/test/apiv2/10-images.at b/test/apiv2/10-images.at
index 037a4c01f..9e464dbc7 100644
--- a/test/apiv2/10-images.at
+++ b/test/apiv2/10-images.at
@@ -147,4 +147,39 @@ t GET "images/get?names=alpine&names=busybox" 200 '[POSIX tar archive]'
img_cnt=$(tar xf "$WORKDIR/curl.result.out" manifest.json -O | jq "length")
is "$img_cnt" 2 "number of images in tar archive"
+# check build works when uploading container file as a tar, see issue #10660
+TMPD=$(mktemp -d podman-apiv2-test.build.XXXXXXXX)
+function cleanBuildTest() {
+ podman rmi -a -f
+ rm -rf "${TMPD}" &> /dev/null
+}
+CONTAINERFILE_TAR="${TMPD}/containerfile.tar"
+cat > $TMPD/containerfile << EOF
+FROM quay.io/libpod/alpine_labels:latest
+EOF
+tar --format=posix -C $TMPD -cvf ${CONTAINERFILE_TAR} containerfile &> /dev/null
+
+curl -XPOST --data-binary @<(cat $CONTAINERFILE_TAR) \
+ -H "content-type: application/x-tar" \
+ --dump-header "${TMPD}/headers.txt" \
+ -o "${TMPD}/response.txt" \
+ "http://$HOST:$PORT/v1.40/libpod/build?dockerfile=containerfile" &> /dev/null
+
+BUILD_TEST_ERROR=""
+
+if ! grep -q '200 OK' "${TMPD}/headers.txt"; then
+ echo -e "${red}NOK: Image build from tar failed response was not 200 OK"
+ BUILD_TEST_ERROR="1"
+fi
+
+if ! grep -q 'quay.io/libpod/alpine_labels' "${TMPD}/response.txt"; then
+ echo -e "${red}NOK: Image build from tar failed image name not in response"
+ BUILD_TEST_ERROR="1"
+fi
+
+cleanBuildTest
+if [[ "${BUILD_TEST_ERROR}" ]]; then
+ exit 1
+fi
+
# vim: filetype=sh
diff --git a/test/compose/test-compose b/test/compose/test-compose
index 981f78a79..70db6dd55 100755
--- a/test/compose/test-compose
+++ b/test/compose/test-compose
@@ -183,6 +183,8 @@ function test_port() {
fi
echo "# cat $WORKDIR/server.log:"
cat $WORKDIR/server.log
+ echo "# cat $logfile:"
+ cat $logfile
return
fi
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/run_volume_test.go b/test/e2e/run_volume_test.go
index 9b77aaef8..4be1b2009 100644
--- a/test/e2e/run_volume_test.go
+++ b/test/e2e/run_volume_test.go
@@ -668,4 +668,36 @@ USER testuser`, fedoraMinimal)
Expect(strings.Contains(test2.OutputToString(), testString)).To(BeTrue())
})
+
+ It("podman volume with uid and gid works", func() {
+ volName := "testVol"
+ volCreate := podmanTest.Podman([]string{"volume", "create", "--opt", "o=uid=1000", volName})
+ volCreate.WaitWithDefaultTimeout()
+ Expect(volCreate.ExitCode()).To(Equal(0))
+
+ volMount := podmanTest.Podman([]string{"run", "--rm", "-v", fmt.Sprintf("%s:/test", volName), ALPINE, "stat", "-c", "%u", "/test"})
+ volMount.WaitWithDefaultTimeout()
+ Expect(volMount.ExitCode()).To(Equal(0))
+ Expect(volMount.OutputToString()).To(Equal("1000"))
+
+ volName = "testVol2"
+ volCreate = podmanTest.Podman([]string{"volume", "create", "--opt", "o=gid=1000", volName})
+ volCreate.WaitWithDefaultTimeout()
+ Expect(volCreate.ExitCode()).To(Equal(0))
+
+ volMount = podmanTest.Podman([]string{"run", "--rm", "-v", fmt.Sprintf("%s:/test", volName), ALPINE, "stat", "-c", "%g", "/test"})
+ volMount.WaitWithDefaultTimeout()
+ Expect(volMount.ExitCode()).To(Equal(0))
+ Expect(volMount.OutputToString()).To(Equal("1000"))
+
+ volName = "testVol3"
+ volCreate = podmanTest.Podman([]string{"volume", "create", "--opt", "o=uid=1000,gid=1000", volName})
+ volCreate.WaitWithDefaultTimeout()
+ Expect(volCreate.ExitCode()).To(Equal(0))
+
+ volMount = podmanTest.Podman([]string{"run", "--rm", "-v", fmt.Sprintf("%s:/test", volName), ALPINE, "stat", "-c", "%u:%g", "/test"})
+ volMount.WaitWithDefaultTimeout()
+ Expect(volMount.ExitCode()).To(Equal(0))
+ Expect(volMount.OutputToString()).To(Equal("1000:1000"))
+ })
})