From df568e4963944d36f877aa36831e2f6892dbaf04 Mon Sep 17 00:00:00 2001 From: Stefano Pogliani Date: Mon, 23 Mar 2020 20:54:19 +0000 Subject: Support label filters for podman pod ps. Update the podman pod ps command to support filtering by labels. This brings the command in line with the documentation as well as the functionality by the containers equivalent podman ps. Signed-off-by: Stefano Pogliani --- test/e2e/common_test.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'test/e2e/common_test.go') diff --git a/test/e2e/common_test.go b/test/e2e/common_test.go index 16b971e65..f64d423d2 100644 --- a/test/e2e/common_test.go +++ b/test/e2e/common_test.go @@ -519,6 +519,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 != "" { -- cgit v1.2.3-54-g00ecf