diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/apiv2/10-images.at | 7 | ||||
-rw-r--r-- | test/e2e/common_test.go | 11 | ||||
-rw-r--r-- | test/e2e/pod_create_test.go | 14 | ||||
-rw-r--r-- | test/e2e/run_working_dir_test.go | 6 | ||||
-rw-r--r-- | test/python/docker/test_containers.py | 7 | ||||
-rw-r--r-- | test/system/070-build.bats | 25 |
6 files changed, 67 insertions, 3 deletions
diff --git a/test/apiv2/10-images.at b/test/apiv2/10-images.at index 693c34ced..a650cf958 100644 --- a/test/apiv2/10-images.at +++ b/test/apiv2/10-images.at @@ -45,6 +45,13 @@ t POST "images/create?fromImage=alpine" '' 200 .error=null .status~".*Download c t POST "images/create?fromImage=alpine&tag=latest" '' 200 +# Make sure that new images are pulled +old_iid=$(podman image inspect --format "{{.ID}}" docker.io/library/alpine:latest) +podman rmi -f docker.io/library/alpine:latest +podman tag $IMAGE docker.io/library/alpine:latest +t POST "images/create?fromImage=alpine" '' 200 .error=null .status~".*$old_iid.*" +podman untag $IMAGE docker.io/library/alpine:latest + t POST "images/create?fromImage=quay.io/libpod/alpine&tag=sha256:fa93b01658e3a5a1686dc3ae55f170d8de487006fb53a28efcd12ab0710a2e5f" '' 200 # Display the image history diff --git a/test/e2e/common_test.go b/test/e2e/common_test.go index d033cc646..12b30b2c5 100644 --- a/test/e2e/common_test.go +++ b/test/e2e/common_test.go @@ -436,13 +436,20 @@ func (p *PodmanTestIntegration) RunLsContainerInPod(name, pod string) (*PodmanSe // BuildImage uses podman build and buildah to build an image // called imageName based on a string dockerfile -func (p *PodmanTestIntegration) BuildImage(dockerfile, imageName string, layers string) { +func (p *PodmanTestIntegration) BuildImage(dockerfile, imageName string, layers string) string { dockerfilePath := filepath.Join(p.TempDir, "Dockerfile") err := ioutil.WriteFile(dockerfilePath, []byte(dockerfile), 0755) Expect(err).To(BeNil()) - session := p.Podman([]string{"build", "--layers=" + layers, "-t", imageName, "--file", dockerfilePath, p.TempDir}) + cmd := []string{"build", "--layers=" + layers, "--file", dockerfilePath} + if len(imageName) > 0 { + cmd = append(cmd, []string{"-t", imageName}...) + } + cmd = append(cmd, p.TempDir) + session := p.Podman(cmd) session.Wait(240) Expect(session).Should(Exit(0), fmt.Sprintf("BuildImage session output: %q", session.OutputToString())) + output := session.OutputToStringArray() + return output[len(output)-1] } // PodmanPID execs podman and returns its PID diff --git a/test/e2e/pod_create_test.go b/test/e2e/pod_create_test.go index e57712f62..0a7a5101e 100644 --- a/test/e2e/pod_create_test.go +++ b/test/e2e/pod_create_test.go @@ -501,4 +501,18 @@ entrypoint ["/fromimage"] Expect(session.OutputToString()).To(ContainSubstring("inet 127.0.0.1/8 scope host lo")) Expect(len(session.OutputToStringArray())).To(Equal(1)) }) + + It("podman pod create --infra-image w/untagged image", func() { + podmanTest.AddImageToRWStore(ALPINE) + dockerfile := `FROM quay.io/libpod/alpine:latest +ENTRYPOINT ["sleep","99999"] + ` + // This builds a none/none image + iid := podmanTest.BuildImage(dockerfile, "", "true") + + create := podmanTest.Podman([]string{"pod", "create", "--infra-image", iid}) + create.WaitWithDefaultTimeout() + Expect(create.ExitCode()).To(BeZero()) + }) + }) diff --git a/test/e2e/run_working_dir_test.go b/test/e2e/run_working_dir_test.go index 59538448e..948ed05e7 100644 --- a/test/e2e/run_working_dir_test.go +++ b/test/e2e/run_working_dir_test.go @@ -47,7 +47,7 @@ var _ = Describe("Podman run", func() { It("podman run a container on an image with a workdir", func() { dockerfile := `FROM alpine -RUN mkdir -p /home/foobar +RUN mkdir -p /home/foobar /etc/foobar; chown bin:bin /etc/foobar WORKDIR /etc/foobar` podmanTest.BuildImage(dockerfile, "test", "false") @@ -56,6 +56,10 @@ WORKDIR /etc/foobar` Expect(session.ExitCode()).To(Equal(0)) Expect(session.OutputToString()).To(Equal("/etc/foobar")) + session = podmanTest.Podman([]string{"run", "test", "ls", "-ld", "."}) + session.WaitWithDefaultTimeout() + Expect(session.LineInOutputContains("bin")).To(BeTrue()) + session = podmanTest.Podman([]string{"run", "--workdir", "/home/foobar", "test", "pwd"}) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) diff --git a/test/python/docker/test_containers.py b/test/python/docker/test_containers.py index 5c2a5fef2..337cacd5c 100644 --- a/test/python/docker/test_containers.py +++ b/test/python/docker/test_containers.py @@ -86,6 +86,13 @@ class TestContainers(unittest.TestCase): containers = self.client.containers.list(all=True) self.assertEqual(len(containers), 2) + def test_start_container_with_random_port_bind(self): + container = self.client.containers.create(image=constant.ALPINE, + name="containerWithRandomBind", + ports={'1234/tcp': None}) + containers = self.client.containers.list(all=True) + self.assertTrue(container in containers) + def test_stop_container(self): top = self.client.containers.get(TestContainers.topContainerId) self.assertEqual(top.status, "running") diff --git a/test/system/070-build.bats b/test/system/070-build.bats index 7a42a4c18..c18f3f7a7 100644 --- a/test/system/070-build.bats +++ b/test/system/070-build.bats @@ -46,6 +46,31 @@ EOF is "$output" ".*invalidflag" "failed when passing undefined flags to the runtime" } +@test "podman build - set runtime" { + skip_if_remote "--runtime flag not supported for remote" + # Test on the CLI and via containers.conf + + tmpdir=$PODMAN_TMPDIR/build-test + run mkdir -p $tmpdir + containerfile=$tmpdir/Containerfile + cat >$containerfile <<EOF +FROM $IMAGE +RUN echo $rand_content +EOF + + run_podman 125 --runtime=idonotexist build -t build_test $tmpdir + is "$output" ".*\"idonotexist\" not found.*" "failed when passing invalid OCI runtime via CLI" + + containersconf=$tmpdir/containers.conf + cat >$containersconf <<EOF +[engine] +runtime="idonotexist" +EOF + + CONTAINERS_CONF="$containersconf" run_podman 125 build -t build_test $tmpdir + is "$output" ".*\"idonotexist\" not found.*" "failed when passing invalid OCI runtime via containers.conf" +} + # Regression from v1.5.0. This test passes fine in v1.5.0, fails in 1.6 @test "podman build - cache (#3920)" { # Make an empty test directory, with a subdirectory used for tar |