summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/apiv2/40-pods.at14
-rw-r--r--test/e2e/common_test.go22
-rw-r--r--test/e2e/config.go2
-rw-r--r--test/e2e/pod_ps_test.go23
-rw-r--r--test/endpoint/endpoint.go2
5 files changed, 51 insertions, 12 deletions
diff --git a/test/apiv2/40-pods.at b/test/apiv2/40-pods.at
index ab345b8f2..70d9f8203 100644
--- a/test/apiv2/40-pods.at
+++ b/test/apiv2/40-pods.at
@@ -12,11 +12,11 @@ t GET libpod/pods/notfoo/exists 404
t GET libpod/pods/foo/json 200 \
.Config.name=foo \
.Config.id=$pod_id \
- .Containers=null
+ .Containers\|length=1
t GET libpod/pods/json 200 \
- .[0].Config.name=foo \
- .[0].Config.id=$pod_id \
- .[0].Containers=null
+ .[0].Name=foo \
+ .[0].Id=$pod_id \
+ .[0].Containers\|length=1
# Cannot create a dup pod with the same name
t POST libpod/pods/create name=foo 409 .cause="pod already exists"
@@ -24,7 +24,7 @@ t POST libpod/pods/create name=foo 409 .cause="pod already exists"
#t POST libpod/pods/create a=b 400 .cause='bad parameter' # FIXME: unimplemented
if root || have_cgroupsv2; then
- t POST libpod/pods/foo/pause '' 204
+ t POST libpod/pods/foo/pause '' 200
else
# Rootless cgroupsv1 : unsupported
t POST libpod/pods/foo/pause '' 500 \
@@ -34,7 +34,7 @@ fi
t POST libpod/pods/foo/unpause '' 200
t POST libpod/pods/foo/unpause '' 200 # (2nd time)
t POST libpod/pods/foo/stop '' 304
-t POST libpod/pods/foo/restart '' 500 .cause="no such container"
+t POST libpod/pods/foo/restart '' 200
t POST libpod/pods/bar/restart '' 404
@@ -44,7 +44,7 @@ t POST libpod/pods/bar/restart '' 404
#t POST libpod/pods/prune 'a=b' 400 # FIXME: 2020-02-24 returns 200
# Clean up; and try twice, making sure that the second time fails
-t DELETE libpod/pods/foo 204
+t DELETE libpod/pods/foo 200
t DELETE libpod/pods/foo 404
# vim: filetype=sh
diff --git a/test/e2e/common_test.go b/test/e2e/common_test.go
index 16b971e65..b10c3237d 100644
--- a/test/e2e/common_test.go
+++ b/test/e2e/common_test.go
@@ -15,6 +15,7 @@ import (
"time"
"github.com/containers/libpod/libpod"
+ "github.com/containers/libpod/libpod/define"
"github.com/containers/libpod/pkg/inspect"
"github.com/containers/libpod/pkg/rootless"
. "github.com/containers/libpod/test/utils"
@@ -320,7 +321,7 @@ func (s *PodmanSessionIntegration) InspectImageJSON() []inspect.ImageData {
}
// InspectContainer returns a container's inspect data in JSON format
-func (p *PodmanTestIntegration) InspectContainer(name string) []libpod.InspectContainerData {
+func (p *PodmanTestIntegration) InspectContainer(name string) []define.InspectContainerData {
cmd := []string{"inspect", name}
session := p.Podman(cmd)
session.WaitWithDefaultTimeout()
@@ -492,8 +493,8 @@ func (p *PodmanTestIntegration) PullImage(image string) error {
// InspectContainerToJSON takes the session output of an inspect
// container and returns json
-func (s *PodmanSessionIntegration) InspectContainerToJSON() []libpod.InspectContainerData {
- var i []libpod.InspectContainerData
+func (s *PodmanSessionIntegration) InspectContainerToJSON() []define.InspectContainerData {
+ var i []define.InspectContainerData
err := json.Unmarshal(s.Out.Contents(), &i)
Expect(err).To(BeNil())
return i
@@ -519,6 +520,21 @@ func (p *PodmanTestIntegration) CreatePod(name string) (*PodmanSessionIntegratio
return session, session.ExitCode(), session.OutputToString()
}
+// CreatePod creates a pod with no infra container and some labels.
+// it optionally takes a pod name
+func (p *PodmanTestIntegration) CreatePodWithLabels(name string, labels map[string]string) (*PodmanSessionIntegration, int, string) {
+ var podmanArgs = []string{"pod", "create", "--infra=false", "--share", ""}
+ if name != "" {
+ podmanArgs = append(podmanArgs, "--name", name)
+ }
+ for labelKey, labelValue := range labels {
+ podmanArgs = append(podmanArgs, "--label", fmt.Sprintf("%s=%s", labelKey, labelValue))
+ }
+ session := p.Podman(podmanArgs)
+ session.WaitWithDefaultTimeout()
+ return session, session.ExitCode(), session.OutputToString()
+}
+
func (p *PodmanTestIntegration) RunTopContainerInPod(name, pod string) *PodmanSessionIntegration {
var podmanArgs = []string{"run", "--pod", pod}
if name != "" {
diff --git a/test/e2e/config.go b/test/e2e/config.go
index 95b0481b3..49a47c7da 100644
--- a/test/e2e/config.go
+++ b/test/e2e/config.go
@@ -10,7 +10,7 @@ var (
ALPINEAMD64ID = "961769676411f082461f9ef46626dd7a2d1e2b2a38e6a44364bcbecf51e66dd4"
ALPINEARM64DIGEST = "docker.io/library/alpine@sha256:db7f3dcef3d586f7dd123f107c93d7911515a5991c4b9e51fa2a43e46335a43e"
ALPINEARM64ID = "915beeae46751fc564998c79e73a1026542e945ca4f73dc841d09ccc6c2c0672"
- infra = "k8s.gcr.io/pause:3.1"
+ infra = "k8s.gcr.io/pause:3.2"
BB = "docker.io/library/busybox:latest"
healthcheck = "docker.io/libpod/alpine_healthcheck:latest"
ImageCacheDir = "/tmp/podman/imagecachedir"
diff --git a/test/e2e/pod_ps_test.go b/test/e2e/pod_ps_test.go
index aa07be55c..551ad3818 100644
--- a/test/e2e/pod_ps_test.go
+++ b/test/e2e/pod_ps_test.go
@@ -204,4 +204,27 @@ var _ = Describe("Podman ps", func() {
Expect(session.ExitCode()).To(Equal(0))
Expect(session.OutputToString()).To(BeEmpty())
})
+
+ It("podman pod ps filter labels", func() {
+ _, ec, podid1 := podmanTest.CreatePod("")
+ Expect(ec).To(Equal(0))
+
+ _, ec, podid2 := podmanTest.CreatePodWithLabels("", map[string]string{
+ "io.podman.test.label": "value1",
+ "io.podman.test.key": "irrelevant-value",
+ })
+ Expect(ec).To(Equal(0))
+
+ _, ec, podid3 := podmanTest.CreatePodWithLabels("", map[string]string{
+ "io.podman.test.label": "value2",
+ })
+ Expect(ec).To(Equal(0))
+
+ session := podmanTest.Podman([]string{"pod", "ps", "--no-trunc", "--filter", "label=io.podman.test.key", "--filter", "label=io.podman.test.label=value1"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ Expect(session.OutputToString()).To(Not(ContainSubstring(podid1)))
+ Expect(session.OutputToString()).To(ContainSubstring(podid2))
+ Expect(session.OutputToString()).To(Not(ContainSubstring(podid3)))
+ })
})
diff --git a/test/endpoint/endpoint.go b/test/endpoint/endpoint.go
index f1634b6f0..5b5484865 100644
--- a/test/endpoint/endpoint.go
+++ b/test/endpoint/endpoint.go
@@ -26,7 +26,7 @@ var (
ImageCacheDir = "/tmp/podman/imagecachedir"
VarlinkBinary = "/usr/bin/varlink"
ALPINE = "docker.io/library/alpine:latest"
- infra = "k8s.gcr.io/pause:3.1"
+ infra = "k8s.gcr.io/pause:3.2"
BB = "docker.io/library/busybox:latest"
redis = "docker.io/library/redis:alpine"
fedoraMinimal = "quay.io/libpod/fedora-minimal:latest"