Skip to content

Commit bec4ea4

Browse files
authored
Merge pull request docker#9566 from milas/e2e-ps-stdout
e2e: fix spurious `ps` failures
2 parents 3f10753 + 152c2d9 commit bec4ea4

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

pkg/e2e/ps_test.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import (
2222
"testing"
2323

2424
"github.com/stretchr/testify/assert"
25+
"github.com/stretchr/testify/require"
2526

2627
"github.com/docker/compose/v2/pkg/api"
2728
)
@@ -41,7 +42,7 @@ func TestPs(t *testing.T) {
4142

4243
t.Run("pretty", func(t *testing.T) {
4344
res = c.RunDockerComposeCmd(t, "-f", "./fixtures/ps-test/compose.yaml", "--project-name", projectName, "ps")
44-
lines := strings.Split(res.Combined(), "\n")
45+
lines := strings.Split(res.Stdout(), "\n")
4546
assert.Equal(t, 4, len(lines))
4647
count := 0
4748
for _, line := range lines[1:3] {
@@ -61,8 +62,8 @@ func TestPs(t *testing.T) {
6162
res = c.RunDockerComposeCmd(t, "-f", "./fixtures/ps-test/compose.yaml", "--project-name", projectName, "ps",
6263
"--format", "json")
6364
var output []api.ContainerSummary
64-
err := json.Unmarshal([]byte(res.Combined()), &output)
65-
assert.NoError(t, err)
65+
err := json.Unmarshal([]byte(res.Stdout()), &output)
66+
require.NoError(t, err, "Failed to unmarshal ps JSON output")
6667

6768
count := 0
6869
assert.Equal(t, 2, len(output))

0 commit comments

Comments
 (0)