From a1de0b96c36da3001dee68c8cd9af428e78c5562 Mon Sep 17 00:00:00 2001 From: Nicolas De Loof Date: Fri, 24 Nov 2023 10:19:34 +0100 Subject: [PATCH] Restore `Project` is ps json output Signed-off-by: Nicolas De Loof --- cmd/formatter/container.go | 6 ++++++ pkg/e2e/ps_test.go | 2 ++ 2 files changed, 8 insertions(+) diff --git a/cmd/formatter/container.go b/cmd/formatter/container.go index 1381b52f8..f1eb47caf 100644 --- a/cmd/formatter/container.go +++ b/cmd/formatter/container.go @@ -33,6 +33,7 @@ const ( defaultContainerTableFormat = "table {{.Name}}\t{{.Image}}\t{{.Command}}\t{{.Service}}\t{{.RunningFor}}\t{{.Status}}\t{{.Ports}}" nameHeader = "NAME" + projectHeader = "PROJECT" serviceHeader = "SERVICE" commandHeader = "COMMAND" runningForHeader = "CREATED" @@ -112,6 +113,7 @@ func NewContainerContext() *ContainerContext { containerCtx.Header = formatter.SubHeaderContext{ "ID": formatter.ContainerIDHeader, "Name": nameHeader, + "Project": projectHeader, "Service": serviceHeader, "Image": formatter.ImageHeader, "Command": commandHeader, @@ -164,6 +166,10 @@ func (c *ContainerContext) Service() string { return c.c.Service } +func (c *ContainerContext) Project() string { + return c.c.Project +} + func (c *ContainerContext) Image() string { return c.c.Image } diff --git a/pkg/e2e/ps_test.go b/pkg/e2e/ps_test.go index 11a9b8715..b9d6cd44f 100644 --- a/pkg/e2e/ps_test.go +++ b/pkg/e2e/ps_test.go @@ -64,6 +64,7 @@ func TestPs(t *testing.T) { "--format", "json") type element struct { Name string + Project string Publishers api.PortPublishers } var output []element @@ -78,6 +79,7 @@ func TestPs(t *testing.T) { count := 0 assert.Equal(t, 2, len(output)) for _, service := range output { + assert.Equal(t, projectName, service.Project) publishers := service.Publishers if service.Name == "e2e-ps-busybox-1" { assert.Equal(t, 1, len(publishers))