Skip to content

Commit

Permalink
Merge pull request #9566 from milas/e2e-ps-stdout
Browse files Browse the repository at this point in the history
e2e: fix spurious `ps` failures
  • Loading branch information
glours authored Jun 16, 2022
2 parents 3f10753 + 152c2d9 commit bec4ea4
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions pkg/e2e/ps_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"testing"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

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

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

count := 0
assert.Equal(t, 2, len(output))
Expand Down

0 comments on commit bec4ea4

Please sign in to comment.