diff options
-rw-r--r-- | Dockerfile.Fedora | 19 | ||||
-rw-r--r-- | cmd/podman/build.go | 23 | ||||
-rw-r--r-- | cmd/podman/login.go | 3 | ||||
-rw-r--r-- | cmd/podman/spec.go | 3 | ||||
-rw-r--r-- | completions/bash/podman | 13 | ||||
-rw-r--r-- | docs/podman-build.1.md | 21 | ||||
-rw-r--r-- | test/e2e/kill_test.go | 95 | ||||
-rw-r--r-- | test/e2e/libpod_suite_test.go | 23 | ||||
-rw-r--r-- | test/e2e/ps_test.go | 68 | ||||
-rw-r--r-- | test/e2e/rm_test.go | 6 | ||||
-rw-r--r-- | test/e2e/run_networking_test.go | 79 | ||||
-rw-r--r-- | test/podman_kill.bats | 71 | ||||
-rw-r--r-- | test/podman_networking.bats | 59 |
13 files changed, 293 insertions, 190 deletions
diff --git a/Dockerfile.Fedora b/Dockerfile.Fedora index 055d2b9e3..163f93ea0 100644 --- a/Dockerfile.Fedora +++ b/Dockerfile.Fedora @@ -1,7 +1,9 @@ FROM registry.fedoraproject.org/fedora:27 RUN dnf -y install btrfs-progs-devel \ + atomic-registries \ bzip2 \ + conmon \ device-mapper-devel \ findutils \ git \ @@ -19,9 +21,7 @@ RUN dnf -y install btrfs-progs-devel \ python \ which\ golang-github-cpuguy83-go-md2man \ - conmon \ procps-ng \ - atomic-registries \ iptables && dnf clean all # install bats @@ -33,7 +33,7 @@ RUN cd /tmp \ && rm -fr /tmp/bats # Install CNI plugins -ENV CNI_COMMIT 7480240de9749f9a0a5c8614b17f1f03e0c06ab9 +ENV CNI_COMMIT 412b6d31280682bb4fab4446f113c22ff1886554 RUN set -x \ && export GOPATH="$(mktemp -d)" \ && git clone https://github.com/containernetworking/plugins.git "$GOPATH/src/github.com/containernetworking/plugins" \ @@ -55,6 +55,19 @@ RUN set -x \ && export GOPATH=/go \ && go get github.com/onsi/gomega/... +# Install conmon +ENV CRIO_COMMIT 814c6ab0913d827543696b366048056a31d9529c +RUN set -x \ + && export GOPATH="$(mktemp -d)" \ + && git clone https://github.com/kubernetes-incubator/cri-o.git "$GOPATH/src/github.com/kubernetes-incubator/cri-o.git" \ + && cd "$GOPATH/src/github.com/kubernetes-incubator/cri-o.git" \ + && git fetch origin --tags \ + && git checkout -q "$CRIO_COMMIT" \ + && mkdir bin \ + && make conmon \ + && install -D -m 755 bin/conmon /usr/libexec/crio/conmon \ + && rm -rf "$GOPATH" + # Install cni config #RUN make install.cni RUN mkdir -p /etc/cni/net.d/ diff --git a/cmd/podman/build.go b/cmd/podman/build.go index 0defb5e79..6e32a80e9 100644 --- a/cmd/podman/build.go +++ b/cmd/podman/build.go @@ -11,10 +11,24 @@ import ( var ( buildFlags = []cli.Flag{ + cli.StringFlag{ + Name: "authfile", + Usage: "path of the authentication file. Default is ${XDG_RUNTIME_DIR}/containers/auth.json", + }, cli.StringSliceFlag{ Name: "build-arg", Usage: "`argument=value` to supply to the builder", }, + cli.StringFlag{ + Name: "cert-dir", + Value: "", + Usage: "use certificates at the specified path to access the registry", + }, + cli.StringFlag{ + Name: "creds", + Value: "", + Usage: "use `[username[:password]]` for accessing the registry", + }, cli.StringSliceFlag{ Name: "file, f", Usage: "`pathname or URL` of a Dockerfile", @@ -68,9 +82,18 @@ func buildCmd(c *cli.Context) error { budCmdArgs := []string{"bud"} + if c.IsSet("authfile") { + budCmdArgs = append(budCmdArgs, "--authfile", c.String("authfile")) + } for _, buildArg := range c.StringSlice("build-arg") { budCmdArgs = append(budCmdArgs, "--build-arg", buildArg) } + if c.IsSet("cert-dir") { + budCmdArgs = append(budCmdArgs, "--cert-dir", c.String("cert-dir")) + } + if c.IsSet("creds") { + budCmdArgs = append(budCmdArgs, "--creds", c.String("creds")) + } for _, fileName := range c.StringSlice("file") { budCmdArgs = append(budCmdArgs, "--file", fileName) } diff --git a/cmd/podman/login.go b/cmd/podman/login.go index 325bf8621..f57f34532 100644 --- a/cmd/podman/login.go +++ b/cmd/podman/login.go @@ -5,7 +5,6 @@ import ( "context" "fmt" "os" - "path/filepath" "strings" "github.com/containers/image/docker" @@ -75,7 +74,7 @@ func loginCmd(c *cli.Context) error { } sc.DockerInsecureSkipTLSVerify = !c.BoolT("tls-verify") if c.String("cert-dir") != "" { - sc.DockerCertPath = filepath.Join(c.String("cert-dir"), server) + sc.DockerCertPath = c.String("cert-dir") } if err = docker.CheckAuth(context.TODO(), sc, username, password, server); err == nil { diff --git a/cmd/podman/spec.go b/cmd/podman/spec.go index 341a50796..a14bd7dfb 100644 --- a/cmd/podman/spec.go +++ b/cmd/podman/spec.go @@ -572,7 +572,8 @@ func (c *createConfig) GetContainerCreateOptions() ([]libpod.CtrCreateOption, er return nil, errors.Wrapf(err, "container %q not found", c.NetMode.ConnectedContainer()) } options = append(options, libpod.WithNetNSFrom(connectedCtr)) - } else if !c.NetMode.IsHost() { + } else if !c.NetMode.IsHost() && !c.NetMode.IsNone() { + options = append(options, libpod.WithNetNS([]ocicni.PortMapping{})) options = append(options, libpod.WithNetNS(portBindings)) } diff --git a/completions/bash/podman b/completions/bash/podman index f8086220e..0087c56b9 100644 --- a/completions/bash/podman +++ b/completions/bash/podman @@ -700,15 +700,18 @@ _podman_build() { " local options_with_args=" - --signature-policy + --authfile + --build-arg + --cert-dir + --creds + --file + -f + --format --runtime --runtime-flag + --signature-policy --tag -t - --file - -f - --build-arg - --format " local all_options="$options_with_args $boolean_options" diff --git a/docs/podman-build.1.md b/docs/podman-build.1.md index 4df25603a..61c8d8aaa 100644 --- a/docs/podman-build.1.md +++ b/docs/podman-build.1.md @@ -24,6 +24,11 @@ to do the actual building. ## OPTIONS +**--authfile** *path* + +Path of the authentication file. Default is ${XDG_RUNTIME\_DIR}/containers/auth.json, which is set using `podman login`. +If the authorization state is not found there, $HOME/.docker/config.json is checked, which is set using `docker login`. + **--build-arg** *arg=value* Specifies a build argument and its value, which will be interpolated in @@ -31,6 +36,16 @@ instructions read from the Dockerfiles in the same way that environment variables are, but which will not be added to environment variable list in the resulting image's configuration. +**--cert-dir** *path* + +Use certificates at *path* (*.crt, *.cert, *.key) to connect to the registry + +**--creds** *creds* + +The [username[:password]] to use to authenticate with the registry if required. +If one or both values are not supplied, a command line prompt will appear and the +value can be entered. The password is entered without echo. + **-f, --file** *Dockerfile* Specifies a Dockerfile which contains instructions for building the image, @@ -96,6 +111,12 @@ podman build --tls-verify=true -t imageName -f Dockerfile.simple podman build --tls-verify=false -t imageName . +podman bud --runtime-flag log-format=json . + +podman bud --runtime-flag debug . + +podman bud --authfile /tmp/auths/myauths.json --cert-dir ~/auth --tls-verify=true --creds=username:password -t imageName -f Dockerfile.simple + ## SEE ALSO podman(1), buildah(1) diff --git a/test/e2e/kill_test.go b/test/e2e/kill_test.go new file mode 100644 index 000000000..c0ee3dab9 --- /dev/null +++ b/test/e2e/kill_test.go @@ -0,0 +1,95 @@ +package integration + +import ( + "os" + + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" +) + +var _ = Describe("Podman kill", func() { + var ( + tempdir string + err error + podmanTest PodmanTest + ) + + BeforeEach(func() { + tempdir, err = CreateTempDirInTempDir() + if err != nil { + os.Exit(1) + } + podmanTest = PodmanCreate(tempdir) + podmanTest.RestoreAllArtifacts() + }) + + AfterEach(func() { + podmanTest.Cleanup() + + }) + + It("podman kill bogus container", func() { + session := podmanTest.Podman([]string{"kill", "foobar"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Not(Equal(0))) + }) + + It("podman kill a running container by id", func() { + session := podmanTest.RunSleepContainer("") + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + cid := session.OutputToString() + + result := podmanTest.Podman([]string{"kill", cid}) + result.WaitWithDefaultTimeout() + + Expect(result.ExitCode()).To(Equal(0)) + Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0)) + }) + + It("podman kill a running container by id with TERM", func() { + session := podmanTest.RunSleepContainer("") + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + cid := session.OutputToString() + + result := podmanTest.Podman([]string{"kill", "-s", "9", cid}) + result.WaitWithDefaultTimeout() + Expect(result.ExitCode()).To(Equal(0)) + Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0)) + }) + + It("podman kill a running container by name", func() { + session := podmanTest.RunSleepContainer("test1") + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + + result := podmanTest.Podman([]string{"kill", "-s", "9", "test1"}) + result.WaitWithDefaultTimeout() + Expect(result.ExitCode()).To(Equal(0)) + Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0)) + }) + + It("podman kill a running container by id with a bogus signal", func() { + session := podmanTest.RunSleepContainer("") + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + cid := session.OutputToString() + + result := podmanTest.Podman([]string{"kill", "-s", "foobar", cid}) + result.WaitWithDefaultTimeout() + Expect(result.ExitCode()).To(Equal(125)) + Expect(podmanTest.NumberOfContainersRunning()).To(Equal(1)) + }) + + It("podman kill latest container", func() { + session := podmanTest.RunSleepContainer("") + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + + result := podmanTest.Podman([]string{"kill", "-l"}) + result.WaitWithDefaultTimeout() + Expect(result.ExitCode()).To(Equal(0)) + Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0)) + }) +}) diff --git a/test/e2e/libpod_suite_test.go b/test/e2e/libpod_suite_test.go index 95b9def77..be9be93d8 100644 --- a/test/e2e/libpod_suite_test.go +++ b/test/e2e/libpod_suite_test.go @@ -158,7 +158,7 @@ func (p *PodmanTest) Podman(args []string) *PodmanSession { func (p *PodmanTest) Cleanup() { // Remove all containers session := p.Podman([]string{"rm", "-fa"}) - session.Wait(60) + session.Wait(90) // Nuke tempdir if err := os.RemoveAll(p.TempDir); err != nil { fmt.Printf("%q\n", err) @@ -345,11 +345,28 @@ func (p *PodmanTest) RunSleepContainer(name string) *PodmanSession { //RunLsContainer runs a simple container in the background that // simply runs ls. If the name passed != "", it will have a name -func (p *PodmanTest) RunLsContainer(name string) *PodmanSession { +func (p *PodmanTest) RunLsContainer(name string) (*PodmanSession, int, string) { var podmanArgs = []string{"run"} if name != "" { podmanArgs = append(podmanArgs, "--name", name) } podmanArgs = append(podmanArgs, "-d", ALPINE, "ls") - return p.Podman(podmanArgs) + session := p.Podman(podmanArgs) + session.WaitWithDefaultTimeout() + return session, session.ExitCode(), session.OutputToString() +} + +//NumberOfContainersRunning returns an int of how many +// containers are currently running. +func (p *PodmanTest) NumberOfContainersRunning() int { + var containers []string + ps := p.Podman([]string{"ps", "-q"}) + ps.WaitWithDefaultTimeout() + Expect(ps.ExitCode()).To(Equal(0)) + for _, i := range ps.OutputToStringArray() { + if i != "" { + containers = append(containers, i) + } + } + return len(containers) } diff --git a/test/e2e/ps_test.go b/test/e2e/ps_test.go index 690015552..d0aa0bd7c 100644 --- a/test/e2e/ps_test.go +++ b/test/e2e/ps_test.go @@ -47,9 +47,8 @@ var _ = Describe("Podman ps", func() { }) It("podman ps all", func() { - session := podmanTest.RunLsContainer("") - session.WaitWithDefaultTimeout() - Expect(session.ExitCode()).To(Equal(0)) + _, ec, _ := podmanTest.RunLsContainer("") + Expect(ec).To(Equal(0)) result := podmanTest.Podman([]string{"ps", "-a"}) result.WaitWithDefaultTimeout() @@ -58,9 +57,8 @@ var _ = Describe("Podman ps", func() { }) It("podman ps size flag", func() { - session := podmanTest.RunLsContainer("") - session.WaitWithDefaultTimeout() - Expect(session.ExitCode()).To(Equal(0)) + _, ec, _ := podmanTest.RunLsContainer("") + Expect(ec).To(Equal(0)) result := podmanTest.Podman([]string{"ps", "-a", "--size"}) result.WaitWithDefaultTimeout() @@ -69,10 +67,8 @@ var _ = Describe("Podman ps", func() { }) It("podman ps quiet flag", func() { - session := podmanTest.RunLsContainer("") - session.WaitWithDefaultTimeout() - Expect(session.ExitCode()).To(Equal(0)) - fullCid := session.OutputToString() + _, ec, fullCid := podmanTest.RunLsContainer("") + Expect(ec).To(Equal(0)) result := podmanTest.Podman([]string{"ps", "-a", "-q"}) result.WaitWithDefaultTimeout() @@ -82,9 +78,8 @@ var _ = Describe("Podman ps", func() { }) It("podman ps latest flag", func() { - session := podmanTest.RunLsContainer("") - session.WaitWithDefaultTimeout() - Expect(session.ExitCode()).To(Equal(0)) + _, ec, _ := podmanTest.RunLsContainer("") + Expect(ec).To(Equal(0)) result := podmanTest.Podman([]string{"ps", "--latest"}) result.WaitWithDefaultTimeout() @@ -93,18 +88,15 @@ var _ = Describe("Podman ps", func() { }) It("podman ps last flag", func() { - session := podmanTest.RunLsContainer("test1") - session.WaitWithDefaultTimeout() - Expect(session.ExitCode()).To(Equal(0)) + _, ec, _ := podmanTest.RunLsContainer("test1") + Expect(ec).To(Equal(0)) - session = podmanTest.RunLsContainer("test2") - session.WaitWithDefaultTimeout() - Expect(session.ExitCode()).To(Equal(0)) + _, ec, _ = podmanTest.RunLsContainer("test2") + Expect(ec).To(Equal(0)) - session = podmanTest.RunLsContainer("test3") - session.WaitWithDefaultTimeout() + _, ec, _ = podmanTest.RunLsContainer("test3") + Expect(ec).To(Equal(0)) - Expect(session.ExitCode()).To(Equal(0)) result := podmanTest.Podman([]string{"ps", "--last", "2"}) result.WaitWithDefaultTimeout() Expect(result.ExitCode()).To(Equal(0)) @@ -112,10 +104,8 @@ var _ = Describe("Podman ps", func() { }) It("podman ps no-trunc", func() { - session := podmanTest.RunLsContainer("test1") - session.WaitWithDefaultTimeout() - Expect(session.ExitCode()).To(Equal(0)) - fullCid := session.OutputToString() + _, ec, fullCid := podmanTest.RunLsContainer("") + Expect(ec).To(Equal(0)) result := podmanTest.Podman([]string{"ps", "-aq", "--no-trunc"}) result.WaitWithDefaultTimeout() @@ -125,9 +115,8 @@ var _ = Describe("Podman ps", func() { }) It("podman ps namespace flag", func() { - session := podmanTest.RunLsContainer("test1") - session.WaitWithDefaultTimeout() - Expect(session.ExitCode()).To(Equal(0)) + _, ec, _ := podmanTest.RunLsContainer("") + Expect(ec).To(Equal(0)) result := podmanTest.Podman([]string{"ps", "-a", "--namespace"}) result.WaitWithDefaultTimeout() @@ -136,9 +125,8 @@ var _ = Describe("Podman ps", func() { }) It("podman ps namespace flag with json format", func() { - session := podmanTest.RunLsContainer("test1") - session.WaitWithDefaultTimeout() - Expect(session.ExitCode()).To(Equal(0)) + _, ec, _ := podmanTest.RunLsContainer("test1") + Expect(ec).To(Equal(0)) result := podmanTest.Podman([]string{"ps", "-a", "--ns", "--format", "json"}) result.WaitWithDefaultTimeout() @@ -147,9 +135,8 @@ var _ = Describe("Podman ps", func() { }) It("podman ps namespace flag with go template format", func() { - session := podmanTest.RunLsContainer("test1") - session.WaitWithDefaultTimeout() - Expect(session.ExitCode()).To(Equal(0)) + _, ec, _ := podmanTest.RunLsContainer("test1") + Expect(ec).To(Equal(0)) result := podmanTest.Podman([]string{"ps", "-a", "--format", "\"table {{.ID}} {{.Image}} {{.Labels}}\""}) result.WaitWithDefaultTimeout() @@ -158,9 +145,8 @@ var _ = Describe("Podman ps", func() { }) It("podman ps ancestor filter flag", func() { - session := podmanTest.RunLsContainer("test1") - session.WaitWithDefaultTimeout() - Expect(session.ExitCode()).To(Equal(0)) + _, ec, _ := podmanTest.RunLsContainer("test1") + Expect(ec).To(Equal(0)) result := podmanTest.Podman([]string{"ps", "-a", "--filter", "ancestor=docker.io/library/alpine:latest"}) result.WaitWithDefaultTimeout() @@ -168,10 +154,8 @@ var _ = Describe("Podman ps", func() { }) It("podman ps id filter flag", func() { - session := podmanTest.RunLsContainer("test1") - session.WaitWithDefaultTimeout() - Expect(session.ExitCode()).To(Equal(0)) - fullCid := session.OutputToString() + _, ec, fullCid := podmanTest.RunLsContainer("") + Expect(ec).To(Equal(0)) result := podmanTest.Podman([]string{"ps", "-a", "--filter", fmt.Sprintf("id=%s", fullCid)}) result.WaitWithDefaultTimeout() diff --git a/test/e2e/rm_test.go b/test/e2e/rm_test.go index 1ef8ee5e6..a59b2ee01 100644 --- a/test/e2e/rm_test.go +++ b/test/e2e/rm_test.go @@ -29,10 +29,8 @@ var _ = Describe("Podman rm", func() { }) It("podman rm stopped container", func() { - session := podmanTest.RunLsContainer("") - session.WaitWithDefaultTimeout() - Expect(session.ExitCode()).To(Equal(0)) - cid := session.OutputToString() + _, ec, cid := podmanTest.RunLsContainer("") + Expect(ec).To(Equal(0)) result := podmanTest.Podman([]string{"rm", cid}) result.WaitWithDefaultTimeout() diff --git a/test/e2e/run_networking_test.go b/test/e2e/run_networking_test.go new file mode 100644 index 000000000..e60da148d --- /dev/null +++ b/test/e2e/run_networking_test.go @@ -0,0 +1,79 @@ +package integration + +import ( + "os" + + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" +) + +var _ = Describe("Podman rmi", func() { + var ( + tempdir string + err error + podmanTest PodmanTest + ) + + BeforeEach(func() { + tempdir, err = CreateTempDirInTempDir() + if err != nil { + os.Exit(1) + } + podmanTest = PodmanCreate(tempdir) + podmanTest.RestoreAllArtifacts() + }) + + AfterEach(func() { + podmanTest.Cleanup() + + }) + + It("podman run network connection with default bridge", func() { + session := podmanTest.Podman([]string{"run", "-dt", ALPINE, "wget", "www.projectatomic.io"}) + session.Wait(90) + Expect(session.ExitCode()).To(Equal(0)) + }) + + It("podman run network connection with host", func() { + session := podmanTest.Podman([]string{"run", "-dt", "--network", "host", ALPINE, "wget", "www.projectatomic.io"}) + session.Wait(90) + Expect(session.ExitCode()).To(Equal(0)) + }) + + It("podman run network connection with loopback", func() { + session := podmanTest.Podman([]string{"run", "-dt", "--network", "host", ALPINE, "wget", "www.projectatomic.io"}) + session.Wait(90) + Expect(session.ExitCode()).To(Equal(0)) + }) + + It("podman run network expose port 222", func() { + session := podmanTest.Podman([]string{"run", "-dt", "--expose", "222-223", ALPINE, "/bin/sh"}) + session.Wait(30) + Expect(session.ExitCode()).To(Equal(0)) + results := podmanTest.SystemExec("iptables", []string{"-t", "nat", "-L"}) + results.Wait(30) + Expect(results.ExitCode()).To(Equal(0)) + Expect(results.OutputToString()).To(ContainSubstring("222")) + Expect(results.OutputToString()).To(ContainSubstring("223")) + }) + + It("podman run network expose host port 80 to container port 8000", func() { + session := podmanTest.Podman([]string{"run", "-dt", "-p", "80:8000", ALPINE, "/bin/sh"}) + session.Wait(30) + Expect(session.ExitCode()).To(Equal(0)) + results := podmanTest.SystemExec("iptables", []string{"-t", "nat", "-L"}) + results.Wait(30) + Expect(results.ExitCode()).To(Equal(0)) + Expect(results.OutputToString()).To(ContainSubstring("8000")) + }) + + It("podman run network expose ports in image metadata", func() { + session := podmanTest.Podman([]string{"run", "-dt", "-P", "docker.io/library/nginx:latest"}) + session.Wait(90) + Expect(session.ExitCode()).To(Equal(0)) + results := podmanTest.Podman([]string{"inspect", "-l"}) + results.Wait(30) + Expect(results.ExitCode()).To(Equal(0)) + Expect(results.OutputToString()).To(ContainSubstring(": 80,")) + }) +}) diff --git a/test/podman_kill.bats b/test/podman_kill.bats deleted file mode 100644 index f24bd0971..000000000 --- a/test/podman_kill.bats +++ /dev/null @@ -1,71 +0,0 @@ -#!/usr/bin/env bats - -load helpers - -function teardown() { - cleanup_test -} - -function setup() { - copy_images -} - -@test "kill a bogus container" { - run ${PODMAN_BINARY} ${PODMAN_OPTIONS} kill foobar - echo "$output" - [ "$status" -ne 0 ] -} - -@test "kill a running container by id" { - run ${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d ${ALPINE} sleep 9999 - [ "$status" -eq 0 ] - ctr_id="$output" - run ${PODMAN_BINARY} ${PODMAN_OPTIONS} ps - [ "$status" -eq 0 ] - run ${PODMAN_BINARY} ${PODMAN_OPTIONS} kill $ctr_id - [ "$status" -eq 0 ] - run ${PODMAN_BINARY} ${PODMAN_OPTIONS} ps - [ "$status" -eq 0 ] -} - -@test "kill a running container by id with TERM" { - run ${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d ${ALPINE} sleep 9999 - [ "$status" -eq 0 ] - ctr_id="$output" - run ${PODMAN_BINARY} ${PODMAN_OPTIONS} ps - [ "$status" -eq 0 ] - run ${PODMAN_BINARY} ${PODMAN_OPTIONS} kill -s TERM $ctr_id - [ "$status" -eq 0 ] - run ${PODMAN_BINARY} ${PODMAN_OPTIONS} ps --no-trunc - [ "$status" -eq 0 ] -} - -@test "kill a running container by name" { - run ${PODMAN_BINARY} ${PODMAN_OPTIONS} run --name test1 -d ${ALPINE} sleep 9999 - [ "$status" -eq 0 ] - run ${PODMAN_BINARY} ${PODMAN_OPTIONS} ps - [ "$status" -eq 0 ] - run ${PODMAN_BINARY} ${PODMAN_OPTIONS} kill -s TERM test1 - [ "$status" -eq 0 ] - run ${PODMAN_BINARY} ${PODMAN_OPTIONS} ps --no-trunc - [ "$status" -eq 0 ] -} - -@test "kill a running container by id with a bogus signal" { - run ${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d ${ALPINE} sleep 9999 - [ "$status" -eq 0 ] - ctr_id="$output" - run ${PODMAN_BINARY} ${PODMAN_OPTIONS} ps - [ "$status" -eq 0 ] - run ${PODMAN_BINARY} ${PODMAN_OPTIONS} kill -s foobar $ctr_id - [ "$status" -eq 125 ] - run ${PODMAN_BINARY} ${PODMAN_OPTIONS} ps --no-trunc - [ "$status" -eq 0 ] -} - -@test "kill the latest container run" { - ${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d ${ALPINE} sleep 9999 - run ${PODMAN_BINARY} ${PODMAN_OPTIONS} kill -l - echo "$output" - [ "$status" -eq 0 ] -} diff --git a/test/podman_networking.bats b/test/podman_networking.bats deleted file mode 100644 index b27c16634..000000000 --- a/test/podman_networking.bats +++ /dev/null @@ -1,59 +0,0 @@ -#!/usr/bin/env bats - -load helpers - -function teardown() { - cleanup_test -} - -function setup() { - copy_images -} - -@test "test network connection with default bridge" { - run ${PODMAN_BINARY} ${PODMAN_OPTIONS} run -dt ${ALPINE} wget www.yahoo.com - echo "$output" - [ "$status" -eq 0 ] - run ${PODMAN_BINARY} ${PODMAN_OPTIONS} wait --latest - echo "$output" - [ "$status" -eq 0 ] -} - -@test "test network connection with host" { - run ${PODMAN_BINARY} ${PODMAN_OPTIONS} run -dt --network host ${ALPINE} wget www.yahoo.com - echo "$output" - [ "$status" -eq 0 ] - run ${PODMAN_BINARY} ${PODMAN_OPTIONS} wait --latest - echo "$output" - [ "$status" -eq 0 ] -} - -@test "expose port 222" { - run ${PODMAN_BINARY} ${PODMAN_OPTIONS} run -dt --expose 222-223 ${ALPINE} /bin/sh - echo "$output" - [ "$status" -eq 0 ] - run bash -c "iptables -t nat -L" - echo "$output" - [ "$status" -eq 0 ] - run bash -c "iptables -t nat -L | grep 223" - echo "$output" - [ "$status" -eq 0 ] -} - -@test "expose host port 80 to container port 8000" { - run ${PODMAN_BINARY} ${PODMAN_OPTIONS} run -dt -p 80:8000 ${ALPINE} /bin/sh - echo "$output" - [ "$status" -eq 0 ] - run bash -c "iptables -t nat -L | grep 8000" - echo "$output" - [ "$status" -eq 0 ] -} - -@test "expose ports in image" { - run ${PODMAN_BINARY} ${PODMAN_OPTIONS} run -dt -P docker.io/library/nginx:latest - echo "$output" - [ "$status" -eq 0 ] - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} inspect -l | grep ': 80,'" - echo "$output" - [ "$status" -eq 0 ] -} |