Skip to content

Commit

Permalink
Improve fragile test TestComposeStreams (#2757)
Browse files Browse the repository at this point in the history
  • Loading branch information
rfay committed Jan 26, 2021
1 parent 37826a4 commit 9db9035
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/dockerutil/dockerutils_test.go
Expand Up @@ -239,14 +239,14 @@ func TestComposeWithStreams(t *testing.T) {
err = ComposeWithStreams(composeFiles, os.Stdin, os.Stderr, os.Stdout, "exec", "-T", "web", "ls", "-d", "xx", "/var/run/apache2")
assert.Error(err)
output = stdout()
assert.Equal("ls: cannot access 'xx': No such file or directory\n", output)
assert.Contains(output, "ls: cannot access 'xx': No such file or directory")

// Flip stdout and stderr and create an error and normal stdout. We should see only the success captured in stdout
stdout = util.CaptureStdOut()
err = ComposeWithStreams(composeFiles, os.Stdin, os.Stdout, os.Stderr, "exec", "-T", "web", "ls", "-d", "xx", "/var/run/apache2")
assert.Error(err)
output = stdout()
assert.Equal("/var/run/apache2\n", output)
assert.Contains(output, "/var/run/apache2", output)
}

// TestCheckCompose tests detection of docker-compose.
Expand Down

0 comments on commit 9db9035

Please sign in to comment.