aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cmd/podman/pods/ps.go5
-rw-r--r--pkg/api/handlers/utils/pods.go1
-rw-r--r--pkg/domain/entities/pods.go1
-rw-r--r--pkg/domain/infra/abi/pods.go1
-rw-r--r--test/e2e/images_test.go15
-rw-r--r--test/e2e/pod_ps_test.go16
6 files changed, 24 insertions, 15 deletions
diff --git a/cmd/podman/pods/ps.go b/cmd/podman/pods/ps.go
index 5703bd172..1385ff270 100644
--- a/cmd/podman/pods/ps.go
+++ b/cmd/podman/pods/ps.go
@@ -178,6 +178,11 @@ func (l ListPodReporter) Created() string {
return units.HumanDuration(time.Since(l.ListPodsReport.Created)) + " ago"
}
+// Labels returns a map of the pod's labels
+func (l ListPodReporter) Labels() map[string]string {
+ return l.ListPodsReport.Labels
+}
+
// NumberofContainers returns an int representation for
// the number of containers belonging to the pod
func (l ListPodReporter) NumberOfContainers() int {
diff --git a/pkg/api/handlers/utils/pods.go b/pkg/api/handlers/utils/pods.go
index fb795fa6a..5b6f6d34d 100644
--- a/pkg/api/handlers/utils/pods.go
+++ b/pkg/api/handlers/utils/pods.go
@@ -66,6 +66,7 @@ func GetPods(w http.ResponseWriter, r *http.Request) ([]*entities.ListPodsReport
Namespace: pod.Namespace(),
Status: status,
InfraId: infraId,
+ Labels: pod.Labels(),
}
for _, ctr := range ctrs {
state, err := ctr.State()
diff --git a/pkg/domain/entities/pods.go b/pkg/domain/entities/pods.go
index 1a38a7aa4..37acba6e6 100644
--- a/pkg/domain/entities/pods.go
+++ b/pkg/domain/entities/pods.go
@@ -29,6 +29,7 @@ type ListPodsReport struct {
Name string
Namespace string
Status string
+ Labels map[string]string
}
type ListPodContainer struct {
diff --git a/pkg/domain/infra/abi/pods.go b/pkg/domain/infra/abi/pods.go
index 16c222cbd..320880920 100644
--- a/pkg/domain/infra/abi/pods.go
+++ b/pkg/domain/infra/abi/pods.go
@@ -360,6 +360,7 @@ func (ic *ContainerEngine) PodPs(ctx context.Context, options entities.PodPSOpti
Name: p.Name(),
Namespace: p.Namespace(),
Status: status,
+ Labels: p.Labels(),
})
}
return reports, nil
diff --git a/test/e2e/images_test.go b/test/e2e/images_test.go
index 9a073cde6..b16cff411 100644
--- a/test/e2e/images_test.go
+++ b/test/e2e/images_test.go
@@ -151,7 +151,6 @@ var _ = Describe("Podman images", func() {
})
It("podman images filter reference", func() {
- SkipIfRemote()
podmanTest.RestoreAllArtifacts()
result := podmanTest.PodmanNoCache([]string{"images", "-q", "-f", "reference=docker.io*"})
result.WaitWithDefaultTimeout()
@@ -177,7 +176,6 @@ var _ = Describe("Podman images", func() {
})
It("podman images filter before image", func() {
- SkipIfRemote()
dockerfile := `FROM docker.io/library/alpine:latest
RUN apk update && apk add strace
`
@@ -189,7 +187,6 @@ RUN apk update && apk add strace
})
It("podman images filter after image", func() {
- SkipIfRemote()
podmanTest.RestoreAllArtifacts()
rmi := podmanTest.PodmanNoCache([]string{"rmi", "busybox"})
rmi.WaitWithDefaultTimeout()
@@ -205,7 +202,6 @@ RUN apk update && apk add strace
})
It("podman image list filter after image", func() {
- SkipIfRemote()
podmanTest.RestoreAllArtifacts()
rmi := podmanTest.PodmanNoCache([]string{"image", "rm", "busybox"})
rmi.WaitWithDefaultTimeout()
@@ -221,7 +217,6 @@ RUN apk update && apk add strace
})
It("podman images filter dangling", func() {
- SkipIfRemote()
dockerfile := `FROM docker.io/library/alpine:latest
`
podmanTest.BuildImage(dockerfile, "foobar.com/before:latest", "false")
@@ -233,9 +228,6 @@ RUN apk update && apk add strace
})
It("podman check for image with sha256: prefix", func() {
- if podmanTest.RemoteTest {
- Skip("Does not work on remote client")
- }
session := podmanTest.Podman([]string{"inspect", "--format=json", ALPINE})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
@@ -248,9 +240,6 @@ RUN apk update && apk add strace
})
It("podman check for image with sha256: prefix", func() {
- if podmanTest.RemoteTest {
- Skip("Does not work on remote client")
- }
session := podmanTest.Podman([]string{"image", "inspect", "--format=json", ALPINE})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
@@ -297,7 +286,6 @@ RUN apk update && apk add strace
})
It("podman images --all flag", func() {
- SkipIfRemote()
podmanTest.RestoreAllArtifacts()
dockerfile := `FROM docker.io/library/alpine:latest
RUN mkdir hello
@@ -317,7 +305,6 @@ ENV foo=bar
})
It("podman images filter by label", func() {
- SkipIfRemote()
dockerfile := `FROM docker.io/library/alpine:latest
LABEL version="1.0"
LABEL "com.example.vendor"="Example Vendor"
@@ -330,7 +317,6 @@ LABEL "com.example.vendor"="Example Vendor"
})
It("podman with images with no layers", func() {
- SkipIfRemote()
dockerfile := strings.Join([]string{
`FROM scratch`,
`LABEL org.opencontainers.image.authors="<somefolks@example.org>"`,
@@ -395,7 +381,6 @@ LABEL "com.example.vendor"="Example Vendor"
})
It("podman images --filter readonly", func() {
- SkipIfRemote()
dockerfile := `FROM docker.io/library/alpine:latest
`
podmanTest.BuildImage(dockerfile, "foobar.com/before:latest", "false")
diff --git a/test/e2e/pod_ps_test.go b/test/e2e/pod_ps_test.go
index 81d97b72d..8dcaf6af1 100644
--- a/test/e2e/pod_ps_test.go
+++ b/test/e2e/pod_ps_test.go
@@ -243,4 +243,20 @@ var _ = Describe("Podman ps", func() {
infra.WaitWithDefaultTimeout()
Expect(len(infra.OutputToString())).To(BeZero())
})
+
+ It("podman pod ps format with labels", func() {
+ _, ec, _ := podmanTest.CreatePod("")
+ Expect(ec).To(Equal(0))
+
+ _, ec1, _ := podmanTest.CreatePodWithLabels("", map[string]string{
+ "io.podman.test.label": "value1",
+ "io.podman.test.key": "irrelevant-value",
+ })
+ Expect(ec1).To(Equal(0))
+
+ session := podmanTest.Podman([]string{"pod", "ps", "--format", "{{.Labels}}"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ Expect(session.OutputToString()).To(ContainSubstring("value1"))
+ })
})