Repository: docker/compose-cli
Pull request #1220 (2021-02-02 14:47:03)

golden file in subfolder trigger MkDir ¯\_(ツ)_/¯
**What I did**

Workaround an issue with test failing when filesystem is set read-only (typically, `make test` with contianerized build)

https://github.com/gotestyourself/gotest.tools/blob/main/golden/golden.go#L179 do trigger `MkDir` even when update flag is disabled.

**(not mandatory) A picture of a cute animal, if possible in relation with what you did**
![image](https://user-images.githubusercontent.com/132757/106616767-32eaf900-656e-11eb-8f75-e6c05f96a7df.png)



Patch:
diff --git a/aci/compose.go b/aci/compose.go
index 43c765cb..ab6f56c7 100644
--- a/aci/compose.go
+++ b/aci/compose.go
@@ -124,19 +124,19 @@ func (cs *aciComposeService) Down(ctx context.Context, projectName string, optio
 	return err
 }
 
-func (cs *aciComposeService) Ps(ctx context.Context, projectName string, options compose.PsOptions) ([]compose.ContainerSummary, error) {
+func (cs *aciComposeService) Ps(ctx context.Context, project string) ([]compose.ContainerSummary, error) {
 	groupsClient, err := login.NewContainerGroupsClient(cs.ctx.SubscriptionID)
 	if err != nil {
 		return nil, err
 	}
 
-	group, err := groupsClient.Get(ctx, cs.ctx.ResourceGroup, projectName)
+	group, err := groupsClient.Get(ctx, cs.ctx.ResourceGroup, project)
 	if err != nil {
 		return nil, err
 	}
 
 	if group.Containers == nil || len(*group.Containers) == 0 {
-		return nil, fmt.Errorf("no containers found in ACI container group %s", projectName)
+		return nil, fmt.Errorf("no containers found in ACI container group %s", project)
 	}
 
 	res := []compose.ContainerSummary{}
@@ -158,7 +158,7 @@ func (cs *aciComposeService) Ps(ctx context.Context, projectName string, options
 		res = append(res, compose.ContainerSummary{
 			ID:         id,
 			Name:       id,
-			Project:    projectName,
+			Project:    project,
 			Service:    *container.Name,
 			State:      convert.GetStatus(container, group),
 			Publishers: publishers,
diff --git a/api/client/compose.go b/api/client/compose.go
index 16198c47..df0ee7d2 100644
--- a/api/client/compose.go
+++ b/api/client/compose.go
@@ -64,7 +64,7 @@ func (c *composeService) Logs(context.Context, string, compose.LogConsumer, comp
 	return errdefs.ErrNotImplemented
 }
 
-func (c *composeService) Ps(context.Context, string, compose.PsOptions) ([]compose.ContainerSummary, error) {
+func (c *composeService) Ps(context.Context, string) ([]compose.ContainerSummary, error) {
 	return nil, errdefs.ErrNotImplemented
 }
 
diff --git a/api/compose/api.go b/api/compose/api.go
index c504d14f..acb3d00f 100644
--- a/api/compose/api.go
+++ b/api/compose/api.go
@@ -44,7 +44,7 @@ type Service interface {
 	// Logs executes the equivalent to a `compose logs`
 	Logs(ctx context.Context, projectName string, consumer LogConsumer, options LogOptions) error
 	// Ps executes the equivalent to a `compose ps`
-	Ps(ctx context.Context, projectName string, options PsOptions) ([]ContainerSummary, error)
+	Ps(ctx context.Context, projectName string) ([]ContainerSummary, error)
 	// List executes the equivalent to a `docker stack ls`
 	List(ctx context.Context) ([]Stack, error)
 	// Convert translate compose model into backend's native format
@@ -91,11 +91,6 @@ type RunOptions struct {
 	Reader     io.Reader
 }
 
-// PsOptions group options of the Ps API
-type PsOptions struct {
-	All bool
-}
-
 // PortPublisher hold status about published port
 type PortPublisher struct {
 	URL           string
diff --git a/cli/cmd/compose/ps.go b/cli/cmd/compose/ps.go
index 8837d586..7252ddb6 100644
--- a/cli/cmd/compose/ps.go
+++ b/cli/cmd/compose/ps.go
@@ -27,14 +27,12 @@ import (
 	"github.com/spf13/cobra"
 
 	"github.com/docker/compose-cli/api/client"
-	"github.com/docker/compose-cli/api/compose"
 	"github.com/docker/compose-cli/cli/formatter"
 )
 
 type psOptions struct {
 	*projectOptions
 	Format string
-	All    bool
 	Quiet  bool
 }
 
@@ -51,7 +49,6 @@ func psCommand(p *projectOptions) *cobra.Command {
 	}
 	psCmd.Flags().StringVar(&opts.Format, "format", "pretty", "Format the output. Values: [pretty | json].")
 	psCmd.Flags().BoolVarP(&opts.Quiet, "quiet", "q", false, "Only display IDs")
-	psCmd.Flags().BoolVarP(&opts.All, "all", "a", false, "Show all stopped containers (including those created by the run command)")
 	return psCmd
 }
 
@@ -65,9 +62,7 @@ func runPs(ctx context.Context, opts psOptions) error {
 	if err != nil {
 		return err
 	}
-	containers, err := c.ComposeService().Ps(ctx, projectName, compose.PsOptions{
-		All: opts.All,
-	})
+	containers, err := c.ComposeService().Ps(ctx, projectName)
 	if err != nil {
 		return err
 	}
diff --git a/cli/server/proxy/compose.go b/cli/server/proxy/compose.go
index 0fac7cc9..43939549 100644
--- a/cli/server/proxy/compose.go
+++ b/cli/server/proxy/compose.go
@@ -59,7 +59,7 @@ func (p *proxy) Services(ctx context.Context, request *composev1.ComposeServices
 		projectName = project.Name
 	}
 	response := []*composev1.Service{}
-	_, err := Client(ctx).ComposeService().Ps(ctx, projectName, compose.PsOptions{})
+	_, err := Client(ctx).ComposeService().Ps(ctx, projectName)
 	if err != nil {
 		return nil, err
 	}
diff --git a/ecs/local/compose.go b/ecs/local/compose.go
index a7bfd747..62451e09 100644
--- a/ecs/local/compose.go
+++ b/ecs/local/compose.go
@@ -162,8 +162,8 @@ func (e ecsLocalSimulation) Logs(ctx context.Context, projectName string, consum
 	return e.compose.Logs(ctx, projectName, consumer, options)
 }
 
-func (e ecsLocalSimulation) Ps(ctx context.Context, projectName string, options compose.PsOptions) ([]compose.ContainerSummary, error) {
-	return e.compose.Ps(ctx, projectName, options)
+func (e ecsLocalSimulation) Ps(ctx context.Context, projectName string) ([]compose.ContainerSummary, error) {
+	return e.compose.Ps(ctx, projectName)
 }
 func (e ecsLocalSimulation) List(ctx context.Context) ([]compose.Stack, error) {
 	return e.compose.List(ctx)
diff --git a/ecs/ps.go b/ecs/ps.go
index 4b957222..a1c4ea7b 100644
--- a/ecs/ps.go
+++ b/ecs/ps.go
@@ -22,12 +22,12 @@ import (
 	"github.com/docker/compose-cli/api/compose"
 )
 
-func (b *ecsAPIService) Ps(ctx context.Context, projectName string, options compose.PsOptions) ([]compose.ContainerSummary, error) {
-	cluster, err := b.aws.GetStackClusterID(ctx, projectName)
+func (b *ecsAPIService) Ps(ctx context.Context, project string) ([]compose.ContainerSummary, error) {
+	cluster, err := b.aws.GetStackClusterID(ctx, project)
 	if err != nil {
 		return nil, err
 	}
-	servicesARN, err := b.aws.ListStackServices(ctx, projectName)
+	servicesARN, err := b.aws.ListStackServices(ctx, project)
 	if err != nil {
 		return nil, err
 	}
@@ -43,7 +43,7 @@ func (b *ecsAPIService) Ps(ctx context.Context, projectName string, options comp
 			return nil, err
 		}
 
-		tasks, err := b.aws.DescribeServiceTasks(ctx, cluster, projectName, service.Name)
+		tasks, err := b.aws.DescribeServiceTasks(ctx, cluster, project, service.Name)
 		if err != nil {
 			return nil, err
 		}
diff --git a/ecs/testdata/simple/simple-cloudformation-conversion.golden b/ecs/testdata/simple-cloudformation-conversion.golden
similarity index 100%
rename from ecs/testdata/simple/simple-cloudformation-conversion.golden
rename to ecs/testdata/simple-cloudformation-conversion.golden
diff --git a/kube/compose.go b/kube/compose.go
index 22b80ada..3cfd32e3 100644
--- a/kube/compose.go
+++ b/kube/compose.go
@@ -94,7 +94,7 @@ func (s *composeService) Logs(ctx context.Context, projectName string, consumer
 }
 
 // Ps executes the equivalent to a `compose ps`
-func (s *composeService) Ps(ctx context.Context, projectName string, options compose.PsOptions) ([]compose.ContainerSummary, error) {
+func (s *composeService) Ps(ctx context.Context, projectName string) ([]compose.ContainerSummary, error) {
 	return nil, errdefs.ErrNotImplemented
 }
 
diff --git a/local/compose/ps.go b/local/compose/ps.go
index 87d1218c..9dfcdd7e 100644
--- a/local/compose/ps.go
+++ b/local/compose/ps.go
@@ -27,12 +27,11 @@ import (
 	"github.com/docker/compose-cli/api/compose"
 )
 
-func (s *composeService) Ps(ctx context.Context, projectName string, options compose.PsOptions) ([]compose.ContainerSummary, error) {
+func (s *composeService) Ps(ctx context.Context, projectName string) ([]compose.ContainerSummary, error) {
 	containers, err := s.apiClient.ContainerList(ctx, moby.ContainerListOptions{
 		Filters: filters.NewArgs(
 			projectFilter(projectName),
 		),
-		All: options.All,
 	})
 	if err != nil {
 		return nil, err


Test patch:
diff --git a/ecs/cloudformation_test.go b/ecs/cloudformation_test.go
index e9895e55..2bd5972a 100644
--- a/ecs/cloudformation_test.go
+++ b/ecs/cloudformation_test.go
@@ -47,7 +47,7 @@ func TestSimpleConvert(t *testing.T) {
 	resultAsJSON, err := marshall(template, "yaml")
 	assert.NilError(t, err)
 	result := fmt.Sprintf("%s\n", string(resultAsJSON))
-	expected := "simple/simple-cloudformation-conversion.golden"
+	expected := "simple-cloudformation-conversion.golden"
 	golden.Assert(t, result, expected)
 }