diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/apiv2/01-basic.at | 8 | ||||
-rw-r--r-- | test/e2e/build_test.go | 2 | ||||
-rw-r--r-- | test/e2e/common_test.go | 2 | ||||
-rw-r--r-- | test/e2e/create_test.go | 11 | ||||
-rw-r--r-- | test/e2e/generate_kube_test.go | 34 | ||||
-rw-r--r-- | test/e2e/images_test.go | 39 | ||||
-rw-r--r-- | test/e2e/import_test.go | 17 | ||||
-rw-r--r-- | test/e2e/play_kube_test.go | 138 | ||||
-rw-r--r-- | test/e2e/pod_create_test.go | 100 | ||||
-rw-r--r-- | test/e2e/run_test.go | 11 | ||||
-rw-r--r-- | test/e2e/wait_test.go | 20 | ||||
-rw-r--r-- | test/system/015-help.bats | 14 | ||||
-rw-r--r-- | test/system/070-build.bats | 32 | ||||
-rw-r--r-- | test/system/250-systemd.bats | 3 |
14 files changed, 388 insertions, 43 deletions
diff --git a/test/apiv2/01-basic.at b/test/apiv2/01-basic.at index 96b6aef7c..541d8cbf1 100644 --- a/test/apiv2/01-basic.at +++ b/test/apiv2/01-basic.at @@ -18,11 +18,11 @@ t HEAD libpod/_ping 200 for i in /version version; do t GET $i 200 \ .Components[0].Name="Podman Engine" \ - .Components[0].Details.APIVersion=1.0.0 \ - .Components[0].Details.MinAPIVersion=1.0.0 \ + .Components[0].Details.APIVersion=2.0.0 \ + .Components[0].Details.MinAPIVersion=2.0.0 \ .Components[0].Details.Os=linux \ - .ApiVersion=1.0.0 \ - .MinAPIVersion=1.0.0 \ + .ApiVersion=1.40 \ + .MinAPIVersion=1.24 \ .Os=linux done diff --git a/test/e2e/build_test.go b/test/e2e/build_test.go index 0b6e919d0..06054bcb4 100644 --- a/test/e2e/build_test.go +++ b/test/e2e/build_test.go @@ -179,8 +179,6 @@ var _ = Describe("Podman build", func() { }) It("podman build basic alpine and print id to external file", func() { - SkipIfRemote() - // Switch to temp dir and restore it afterwards cwd, err := os.Getwd() Expect(err).To(BeNil()) diff --git a/test/e2e/common_test.go b/test/e2e/common_test.go index b6bbae15b..2ce3f9760 100644 --- a/test/e2e/common_test.go +++ b/test/e2e/common_test.go @@ -432,7 +432,7 @@ func (p *PodmanTestIntegration) BuildImage(dockerfile, imageName string, layers Expect(err).To(BeNil()) session := p.PodmanNoCache([]string{"build", "--layers=" + layers, "-t", imageName, "--file", dockerfilePath, p.TempDir}) session.Wait(120) - Expect(session.ExitCode()).To(Equal(0)) + Expect(session).Should(Exit(0), fmt.Sprintf("BuildImage session output: %q", session.OutputToString())) } // PodmanPID execs podman and returns its PID diff --git a/test/e2e/create_test.go b/test/e2e/create_test.go index 9cfed263a..6022be5f6 100644 --- a/test/e2e/create_test.go +++ b/test/e2e/create_test.go @@ -345,6 +345,17 @@ var _ = Describe("Podman create", func() { Expect(session).To(Not(Equal(0))) }) + It("podman create --signature-policy", func() { + SkipIfRemote() // SigPolicy not handled by remote + session := podmanTest.Podman([]string{"create", "--pull=always", "--signature-policy", "/no/such/file", ALPINE}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Not(Equal(0))) + + session = podmanTest.Podman([]string{"create", "--pull=always", "--signature-policy", "/etc/containers/policy.json", ALPINE}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + }) + It("podman create with unset label", func() { // Alpine is assumed to have no labels here, which seems safe ctrName := "testctr" diff --git a/test/e2e/generate_kube_test.go b/test/e2e/generate_kube_test.go index e886c6000..a3a841dc6 100644 --- a/test/e2e/generate_kube_test.go +++ b/test/e2e/generate_kube_test.go @@ -3,6 +3,7 @@ package integration import ( "os" "path/filepath" + "strconv" . "github.com/containers/podman/v2/test/utils" "github.com/ghodss/yaml" @@ -201,6 +202,39 @@ var _ = Describe("Podman generate kube", func() { // Expect(err).To(BeNil()) }) + It("podman generate kube on pod with restartPolicy", func() { + // podName, set, expect + testSli := [][]string{ + {"testPod1", "", "Never"}, // some pod create from cmdline, so set it to Never + {"testPod2", "always", "Always"}, + {"testPod3", "on-failure", "OnFailure"}, + {"testPod4", "no", "Never"}, + } + + for k, v := range testSli { + podName := v[0] + podSession := podmanTest.Podman([]string{"pod", "create", "--name", podName}) + podSession.WaitWithDefaultTimeout() + Expect(podSession.ExitCode()).To(Equal(0)) + + ctrName := "ctr" + strconv.Itoa(k) + ctr1Session := podmanTest.Podman([]string{"create", "--name", ctrName, "--pod", podName, + "--restart", v[1], ALPINE, "top"}) + ctr1Session.WaitWithDefaultTimeout() + Expect(ctr1Session.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(string(pod.Spec.RestartPolicy)).To(Equal(v[2])) + } + }) + It("podman generate kube on pod with ports", func() { podName := "test" podSession := podmanTest.Podman([]string{"pod", "create", "--name", podName, "-p", "4000:4000", "-p", "5000:5000"}) diff --git a/test/e2e/images_test.go b/test/e2e/images_test.go index b22964dc1..ddf2e20b8 100644 --- a/test/e2e/images_test.go +++ b/test/e2e/images_test.go @@ -185,6 +185,7 @@ RUN apk update && apk add strace result.WaitWithDefaultTimeout() Expect(result).Should(Exit(0)) Expect(len(result.OutputToStringArray()) >= 1).To(BeTrue()) + }) It("podman images workingdir from image", func() { @@ -226,7 +227,7 @@ WORKDIR /test result := podmanTest.PodmanNoCache([]string{"image", "list", "-q", "-f", "after=docker.io/library/alpine:latest"}) result.WaitWithDefaultTimeout() Expect(result).Should(Exit(0)) - Expect(len(result.OutputToStringArray())).To(Equal(0)) + Expect(result.OutputToStringArray()).Should(HaveLen(0), "list filter output: %q", result.OutputToString()) }) It("podman images filter dangling", func() { @@ -236,8 +237,40 @@ WORKDIR /test podmanTest.BuildImage(dockerfile, "foobar.com/before:latest", "false") result := podmanTest.Podman([]string{"images", "-q", "-f", "dangling=true"}) result.WaitWithDefaultTimeout() - Expect(result).Should(Exit(0)) - Expect(len(result.OutputToStringArray())).To(Equal(0)) + Expect(result).Should(Exit(0), "dangling image output: %q", result.OutputToString()) + Expect(result.OutputToStringArray()).Should(HaveLen(0), "dangling image output: %q", result.OutputToString()) + }) + + It("podman pull by digest and list --all", func() { + // Prevent regressing on issue #7651. + digestPullAndList := func(noneTag bool) { + session := podmanTest.Podman([]string{"pull", ALPINEAMD64DIGEST}) + session.WaitWithDefaultTimeout() + Expect(session).Should(Exit(0)) + + result := podmanTest.Podman([]string{"images", "--all", ALPINEAMD64DIGEST}) + result.WaitWithDefaultTimeout() + Expect(result).Should(Exit(0)) + + found, _ := result.GrepString("<none>") + if noneTag { + Expect(found).To(BeTrue()) + } else { + Expect(found).To(BeFalse()) + } + } + // No "<none>" tag as tagged alpine instances should be present. + session := podmanTest.Podman([]string{"pull", ALPINELISTTAG}) + session.WaitWithDefaultTimeout() + Expect(session).Should(Exit(0)) + digestPullAndList(false) + + // Now remove all images, re-pull by digest and check for the "<none>" tag. + session = podmanTest.Podman([]string{"rmi", "-af"}) + session.WaitWithDefaultTimeout() + Expect(session).Should(Exit(0)) + + digestPullAndList(true) }) It("podman check for image with sha256: prefix", func() { diff --git a/test/e2e/import_test.go b/test/e2e/import_test.go index feedb2a31..9c6f4381d 100644 --- a/test/e2e/import_test.go +++ b/test/e2e/import_test.go @@ -152,4 +152,21 @@ var _ = Describe("Podman import", func() { Expect(imageData[0].Config.Cmd[0]).To(Equal("/bin/bash")) }) + It("podman import with signature", func() { + outfile := filepath.Join(podmanTest.TempDir, "container.tar") + _, ec, cid := podmanTest.RunLsContainer("") + Expect(ec).To(Equal(0)) + + export := podmanTest.Podman([]string{"export", "-o", outfile, cid}) + export.WaitWithDefaultTimeout() + Expect(export.ExitCode()).To(Equal(0)) + + importImage := podmanTest.Podman([]string{"import", "--signature-policy", "/no/such/file", outfile}) + importImage.WaitWithDefaultTimeout() + Expect(importImage.ExitCode()).To(Not(Equal(0))) + + result := podmanTest.Podman([]string{"import", "--signature-policy", "/etc/containers/policy.json", outfile}) + result.WaitWithDefaultTimeout() + Expect(result.ExitCode()).To(Equal(0)) + }) }) diff --git a/test/e2e/play_kube_test.go b/test/e2e/play_kube_test.go index 5e01971cb..7a5aebcc2 100644 --- a/test/e2e/play_kube_test.go +++ b/test/e2e/play_kube_test.go @@ -30,9 +30,14 @@ apiVersion: v1 kind: Pod metadata: creationTimestamp: "2019-07-17T14:44:08Z" + name: {{ .Name }} labels: app: {{ .Name }} - name: {{ .Name }} +{{ with .Labels }} + {{ range $key, $value := . }} + {{ $key }}: {{ $value }} + {{ end }} +{{ end }} {{ with .Annotations }} annotations: {{ range $key, $value := . }} @@ -41,6 +46,7 @@ metadata: {{ end }} spec: + restartPolicy: {{ .RestartPolicy }} hostname: {{ .Hostname }} hostAliases: {{ range .HostAliases }} @@ -125,9 +131,14 @@ apiVersion: v1 kind: Deployment metadata: creationTimestamp: "2019-07-17T14:44:08Z" + name: {{ .Name }} labels: app: {{ .Name }} - name: {{ .Name }} +{{ with .Labels }} + {{ range $key, $value := . }} + {{ $key }}: {{ $value }} + {{ end }} +{{ end }} {{ with .Annotations }} annotations: {{ range $key, $value := . }} @@ -145,13 +156,17 @@ spec: metadata: labels: app: {{ .Name }} - {{ with .Annotations }} - annotations: - {{ range $key, $value := . }} - {{ $key }}: {{ $value }} - {{ end }} - {{ end }} + {{- with .Labels }}{{ range $key, $value := . }} + {{ $key }}: {{ $value }} + {{- end }}{{ end }} + {{- with .Annotations }} + annotations: + {{- range $key, $value := . }} + {{ $key }}: {{ $value }} + {{- end }} + {{- end }} spec: + restartPolicy: {{ .RestartPolicy }} hostname: {{ .Hostname }} containers: {{ with .Ctrs }} @@ -261,12 +276,14 @@ func generateDeploymentKubeYaml(deployment *Deployment, fileName string) error { // Pod describes the options a kube yaml can be configured at pod level type Pod struct { - Name string - Hostname string - HostAliases []HostAlias - Ctrs []*Ctr - Volumes []*Volume - Annotations map[string]string + Name string + RestartPolicy string + Hostname string + HostAliases []HostAlias + Ctrs []*Ctr + Volumes []*Volume + Labels map[string]string + Annotations map[string]string } type HostAlias struct { @@ -278,7 +295,16 @@ type HostAlias struct { // and the configured options // if no containers are added, it will add the default container func getPod(options ...podOption) *Pod { - p := Pod{defaultPodName, "", nil, make([]*Ctr, 0), make([]*Volume, 0), make(map[string]string)} + p := Pod{ + Name: defaultPodName, + RestartPolicy: "Never", + Hostname: "", + HostAliases: nil, + Ctrs: make([]*Ctr, 0), + Volumes: make([]*Volume, 0), + Labels: make(map[string]string), + Annotations: make(map[string]string), + } for _, option := range options { option(&p) } @@ -290,6 +316,12 @@ func getPod(options ...podOption) *Pod { type podOption func(*Pod) +func withPodName(name string) podOption { + return func(pod *Pod) { + pod.Name = name + } +} + func withHostname(h string) podOption { return func(pod *Pod) { pod.Hostname = h @@ -311,6 +343,18 @@ func withCtr(c *Ctr) podOption { } } +func withRestartPolicy(policy string) podOption { + return func(pod *Pod) { + pod.RestartPolicy = policy + } +} + +func withLabel(k, v string) podOption { + return func(pod *Pod) { + pod.Labels[k] = v + } +} + func withAnnotation(k, v string) podOption { return func(pod *Pod) { pod.Annotations[k] = v @@ -327,12 +371,19 @@ func withVolume(v *Volume) podOption { type Deployment struct { Name string Replicas int32 + Labels map[string]string Annotations map[string]string PodTemplate *Pod } func getDeployment(options ...deploymentOption) *Deployment { - d := Deployment{defaultDeploymentName, 1, make(map[string]string), getPod()} + d := Deployment{ + Name: defaultDeploymentName, + Replicas: 1, + Labels: make(map[string]string), + Annotations: make(map[string]string), + PodTemplate: getPod(), + } for _, option := range options { option(&d) } @@ -342,6 +393,12 @@ func getDeployment(options ...deploymentOption) *Deployment { type deploymentOption func(*Deployment) +func withDeploymentLabel(k, v string) deploymentOption { + return func(deployment *Deployment) { + deployment.Labels[k] = v + } +} + func withDeploymentAnnotation(k, v string) deploymentOption { return func(deployment *Deployment) { deployment.Annotations[k] = v @@ -608,6 +665,30 @@ var _ = Describe("Podman generate kube", func() { Expect(inspect.OutputToString()).To(ContainSubstring(`[echo hello world]`)) }) + It("podman play kube test restartPolicy", func() { + // podName, set, expect + testSli := [][]string{ + {"testPod1", "", "always"}, // Default eqaul to always + {"testPod2", "Always", "always"}, + {"testPod3", "OnFailure", "on-failure"}, + {"testPod4", "Never", "no"}, + } + for _, v := range testSli { + pod := getPod(withPodName(v[0]), withRestartPolicy(v[1])) + err := generatePodKubeYaml(pod, kubeYaml) + Expect(err).To(BeNil()) + + kube := podmanTest.Podman([]string{"play", "kube", kubeYaml}) + kube.WaitWithDefaultTimeout() + Expect(kube.ExitCode()).To(Equal(0)) + + inspect := podmanTest.Podman([]string{"inspect", getCtrNameInPod(pod), "--format", "{{.HostConfig.RestartPolicy.Name}}"}) + inspect.WaitWithDefaultTimeout() + Expect(inspect.ExitCode()).To(Equal(0)) + Expect(inspect.OutputToString()).To(Equal(v[2])) + } + }) + It("podman play kube test hostname", func() { pod := getPod() err := generatePodKubeYaml(pod, kubeYaml) @@ -1077,4 +1158,29 @@ spec: correct := fmt.Sprintf("%s:%s:%s", hostPathLocation, hostPathLocation, "ro") Expect(inspect.OutputToString()).To(ContainSubstring(correct)) }) + + It("podman play kube applies labels to pods", func() { + SkipIfRemote() + var numReplicas int32 = 5 + expectedLabelKey := "key1" + expectedLabelValue := "value1" + deployment := getDeployment( + withReplicas(numReplicas), + withPod(getPod(withLabel(expectedLabelKey, expectedLabelValue))), + ) + err := generateDeploymentKubeYaml(deployment, kubeYaml) + Expect(err).To(BeNil()) + + kube := podmanTest.Podman([]string{"play", "kube", kubeYaml}) + kube.WaitWithDefaultTimeout() + Expect(kube.ExitCode()).To(Equal(0)) + + correctLabels := expectedLabelKey + ":" + expectedLabelValue + for _, pod := range getPodNamesInDeployment(deployment) { + inspect := podmanTest.Podman([]string{"pod", "inspect", pod.Name, "--format", "'{{ .Labels }}'"}) + inspect.WaitWithDefaultTimeout() + Expect(inspect.ExitCode()).To(Equal(0)) + Expect(inspect.OutputToString()).To(ContainSubstring(correctLabels)) + } + }) }) diff --git a/test/e2e/pod_create_test.go b/test/e2e/pod_create_test.go index f260a123a..168150bff 100644 --- a/test/e2e/pod_create_test.go +++ b/test/e2e/pod_create_test.go @@ -329,4 +329,104 @@ var _ = Describe("Podman pod create", func() { Expect(session.ExitCode()).To(Equal(0)) } }) + + It("podman create pod with defaults", func() { + name := "test" + session := podmanTest.Podman([]string{"pod", "create", "--name", name}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + + check := podmanTest.Podman([]string{"pod", "inspect", name}) + check.WaitWithDefaultTimeout() + Expect(check.ExitCode()).To(Equal(0)) + data := check.InspectPodToJSON() + + check1 := podmanTest.Podman([]string{"container", "inspect", "--format", "{{.Config.Entrypoint}}", data.Containers[0].ID}) + check1.WaitWithDefaultTimeout() + Expect(check1.ExitCode()).To(Equal(0)) + Expect(check1.OutputToString()).To(Equal("/pause")) + + // check the Path and Args + check2 := podmanTest.Podman([]string{"container", "inspect", "--format", "{{.Path}}:{{.Args}}", data.Containers[0].ID}) + check2.WaitWithDefaultTimeout() + Expect(check2.ExitCode()).To(Equal(0)) + Expect(check2.OutputToString()).To(Equal("/pause:[/pause]")) + }) + + It("podman create pod with --infra-command", func() { + name := "test" + session := podmanTest.Podman([]string{"pod", "create", "--infra-command", "/pause1", "--name", name}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + + check := podmanTest.Podman([]string{"pod", "inspect", name}) + check.WaitWithDefaultTimeout() + Expect(check.ExitCode()).To(Equal(0)) + data := check.InspectPodToJSON() + + check1 := podmanTest.Podman([]string{"container", "inspect", "--format", "{{.Config.Entrypoint}}", data.Containers[0].ID}) + check1.WaitWithDefaultTimeout() + Expect(check1.ExitCode()).To(Equal(0)) + Expect(check1.OutputToString()).To(Equal("/pause1")) + + // check the Path and Args + check2 := podmanTest.Podman([]string{"container", "inspect", "--format", "{{.Path}}:{{.Args}}", data.Containers[0].ID}) + check2.WaitWithDefaultTimeout() + Expect(check2.ExitCode()).To(Equal(0)) + Expect(check2.OutputToString()).To(Equal("/pause1:[/pause1]")) + }) + + It("podman create pod with --infra-image", func() { + dockerfile := `FROM docker.io/library/alpine:latest +entrypoint ["/fromimage"] +` + podmanTest.BuildImage(dockerfile, "localhost/infra", "false") + name := "test" + session := podmanTest.Podman([]string{"pod", "create", "--infra-image", "localhost/infra", "--name", name}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + + check := podmanTest.Podman([]string{"pod", "inspect", name}) + check.WaitWithDefaultTimeout() + Expect(check.ExitCode()).To(Equal(0)) + data := check.InspectPodToJSON() + + check1 := podmanTest.Podman([]string{"container", "inspect", "--format", "{{.Config.Entrypoint}}", data.Containers[0].ID}) + check1.WaitWithDefaultTimeout() + Expect(check1.ExitCode()).To(Equal(0)) + Expect(check1.OutputToString()).To(Equal("/fromimage")) + + // check the Path and Args + check2 := podmanTest.Podman([]string{"container", "inspect", "--format", "{{.Path}}:{{.Args}}", data.Containers[0].ID}) + check2.WaitWithDefaultTimeout() + Expect(check2.ExitCode()).To(Equal(0)) + Expect(check2.OutputToString()).To(Equal("/fromimage:[/fromimage]")) + }) + + It("podman create pod with --infra-command --infra-image", func() { + dockerfile := `FROM docker.io/library/alpine:latest +entrypoint ["/fromimage"] +` + podmanTest.BuildImage(dockerfile, "localhost/infra", "false") + name := "test" + session := podmanTest.Podman([]string{"pod", "create", "--infra-image", "localhost/infra", "--infra-command", "/fromcommand", "--name", name}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + + check := podmanTest.Podman([]string{"pod", "inspect", name}) + check.WaitWithDefaultTimeout() + Expect(check.ExitCode()).To(Equal(0)) + data := check.InspectPodToJSON() + + check1 := podmanTest.Podman([]string{"container", "inspect", "--format", "{{.Config.Entrypoint}}", data.Containers[0].ID}) + check1.WaitWithDefaultTimeout() + Expect(check1.ExitCode()).To(Equal(0)) + Expect(check1.OutputToString()).To(Equal("/fromcommand")) + + // check the Path and Args + check2 := podmanTest.Podman([]string{"container", "inspect", "--format", "{{.Path}}:{{.Args}}", data.Containers[0].ID}) + check2.WaitWithDefaultTimeout() + Expect(check2.ExitCode()).To(Equal(0)) + Expect(check2.OutputToString()).To(Equal("/fromcommand:[/fromcommand]")) + }) }) diff --git a/test/e2e/run_test.go b/test/e2e/run_test.go index a67f7df92..cbfb6bf59 100644 --- a/test/e2e/run_test.go +++ b/test/e2e/run_test.go @@ -58,6 +58,17 @@ var _ = Describe("Podman run", func() { Expect(session.ExitCode()).To(Equal(0)) }) + It("podman run --signature-policy", func() { + SkipIfRemote() // SigPolicy not handled by remote + session := podmanTest.Podman([]string{"run", "--pull=always", "--signature-policy", "/no/such/file", ALPINE}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Not(Equal(0))) + + session = podmanTest.Podman([]string{"run", "--pull=always", "--signature-policy", "/etc/containers/policy.json", ALPINE}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + }) + It("podman run a container based on on a short name with localhost", func() { tag := podmanTest.Podman([]string{"tag", nginx, "localhost/libpod/alpine_nginx:latest"}) tag.WaitWithDefaultTimeout() diff --git a/test/e2e/wait_test.go b/test/e2e/wait_test.go index 3758acab8..4f0129a47 100644 --- a/test/e2e/wait_test.go +++ b/test/e2e/wait_test.go @@ -64,6 +64,7 @@ var _ = Describe("Podman wait", func() { session = podmanTest.Podman([]string{"wait", "-l"}) session.Wait(20) }) + It("podman container wait on latest container", func() { session := podmanTest.Podman([]string{"container", "run", "-d", ALPINE, "sleep", "1"}) session.Wait(20) @@ -71,4 +72,23 @@ var _ = Describe("Podman wait", func() { session = podmanTest.Podman([]string{"container", "wait", "-l"}) session.Wait(20) }) + + It("podman wait on three containers", func() { + session := podmanTest.Podman([]string{"run", "-d", ALPINE, "sleep", "1"}) + session.Wait(20) + Expect(session.ExitCode()).To(Equal(0)) + cid1 := session.OutputToString() + session = podmanTest.Podman([]string{"run", "-d", ALPINE, "sleep", "1"}) + session.Wait(20) + Expect(session.ExitCode()).To(Equal(0)) + cid2 := session.OutputToString() + session = podmanTest.Podman([]string{"run", "-d", ALPINE, "sleep", "1"}) + session.Wait(20) + Expect(session.ExitCode()).To(Equal(0)) + cid3 := session.OutputToString() + session = podmanTest.Podman([]string{"wait", cid1, cid2, cid3}) + session.Wait(20) + Expect(session.ExitCode()).To(Equal(0)) + Expect(session.OutputToStringArray()).To(Equal([]string{"0", "0", "0"})) + }) }) diff --git a/test/system/015-help.bats b/test/system/015-help.bats index 4a3781012..651fdcd09 100644 --- a/test/system/015-help.bats +++ b/test/system/015-help.bats @@ -86,6 +86,20 @@ function check_help() { found[takes_no_args]=1 fi + # If command lists "-l, --latest" in help output, combine -l with arg. + # This should be disallowed with a clear message. + if expr "$full_help" : ".*-l, --latest" >/dev/null; then + local nope="exec list port ps top" # these can't be tested + if is_rootless; then + nope="$nope mount restore" # these don't work rootless + fi + if ! grep -wq "$cmd" <<<$nope; then + run_podman 125 "$@" $cmd -l nonexistent-container + is "$output" "Error: .*--latest and \(containers\|pods\|arguments\) cannot be used together" \ + "'$command_string' with both -l and container" + fi + fi + # If usage has required arguments, try running without them. # The expression here is 'first capital letter is not in [BRACKETS]'. # It is intended to handle 'podman foo [flags] ARG' but not ' [ARG]'. diff --git a/test/system/070-build.bats b/test/system/070-build.bats index 66f6610ea..e3a139b4f 100644 --- a/test/system/070-build.bats +++ b/test/system/070-build.bats @@ -1,4 +1,5 @@ #!/usr/bin/env bats -*- bats -*- +# shellcheck disable=SC2096 # # Tests for podman build # @@ -6,8 +7,6 @@ load helpers @test "podman build - basic test" { - skip_if_remote "FIXME: pending #7136" - rand_filename=$(random_string 20) rand_content=$(random_string 50) @@ -31,7 +30,7 @@ EOF } @test "podman build - global runtime flags test" { - skip_if_remote "FIXME: pending #7136" + skip_if_remote "--runtime-flag flag not supported for remote" rand_content=$(random_string 50) @@ -49,11 +48,6 @@ EOF # Regression from v1.5.0. This test passes fine in v1.5.0, fails in 1.6 @test "podman build - cache (#3920)" { - skip_if_remote "FIXME: pending #7136, runtime flag is not passing over remote" - if is_remote && is_rootless; then - skip "unreliable with podman-remote and rootless; #2972" - fi - # Make an empty test directory, with a subdirectory used for tar tmpdir=$PODMAN_TMPDIR/build-test mkdir -p $tmpdir/subtest || die "Could not mkdir $tmpdir/subtest" @@ -97,8 +91,6 @@ EOF } @test "podman build - URLs" { - skip_if_remote "FIXME: pending #7137" - tmpdir=$PODMAN_TMPDIR/build-test mkdir -p $tmpdir @@ -118,8 +110,6 @@ EOF @test "podman build - workdir, cmd, env, label" { - skip_if_remote "FIXME: pending #7137" - tmpdir=$PODMAN_TMPDIR/build-test mkdir -p $tmpdir @@ -194,8 +184,15 @@ EOF build_test is "${lines[0]}" "$workdir" "container default command: pwd" is "${lines[1]}" "$s_echo" "container default command: output from echo" + is "${lines[2]}" "$s_env1" "container default command: env1" - is "${lines[3]}" "$s_env2" "container default command: env2" + + if is_remote; then + is "${lines[3]}" "this-should-be-overridden-by-env-host" "podman-remote does not send local environment" + else + is "${lines[3]}" "$s_env2" "container default command: env2" + fi + is "${lines[4]}" "$s_env3" "container default command: env3 (from envfile)" is "${lines[5]}" "$s_env4" "container default command: env4 (from cmdline)" @@ -206,7 +203,12 @@ EOF printenv http_proxy https_proxy ftp_proxy is "${lines[0]}" "http-proxy-in-env-file" "env-file overrides env" is "${lines[1]}" "https-proxy-in-env-file" "env-file sets proxy var" - is "${lines[2]}" "ftp-proxy-from-env" "ftp-proxy is passed through" + + if is_remote; then + is "${lines[2]}" "ftp-proxy-in-image" "podman-remote does not send local environment" + else + is "${lines[2]}" "ftp-proxy-from-env" "ftp-proxy is passed through" + fi # test that workdir is set for command-line commands also run_podman run --rm build_test pwd @@ -271,8 +273,6 @@ Labels.$label_name | $label_value } @test "podman build - stdin test" { - skip_if_remote "FIXME: pending #7136" - # Random workdir, and random string to verify build output workdir=/$(random_string 10) random_echo=$(random_string 15) diff --git a/test/system/250-systemd.bats b/test/system/250-systemd.bats index bbb5a10fb..9bd3e15a1 100644 --- a/test/system/250-systemd.bats +++ b/test/system/250-systemd.bats @@ -41,7 +41,8 @@ function teardown() { fi cname=$(random_string) - run_podman create --name $cname --label "io.containers.autoupdate=image" --detach $IMAGE top + # See #7407 for --pull=always. + run_podman create --pull=always --name $cname --label "io.containers.autoupdate=image" --detach $IMAGE top run_podman generate systemd --new $cname echo "$output" > "$UNIT_FILE" |