Skip to content

Commit e31b95c

Browse files
committed
test: tweak pause test to try and prevent failures in Windows CI
This test keeps failing with a timeout in Windows. I don't actually think it should take that long to bring up an nginx container, so I'm guessing that there's something else going on that's causing trouble. Increase the verbosity when running Compose commands: I think this will generally make E2E test failures easier to diagnose by always logging the full command that's going to be run and also capturing stdout. Add a health check and use `--wait` when launching the fixture for the pause test. Combined with the verbosity increase, this should make it easier to understand what's going on here. Signed-off-by: Milas Bowman <[email protected]>
1 parent d4f156c commit e31b95c

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

pkg/e2e/fixtures/pause/compose.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,16 @@ services:
22
a:
33
image: nginx:alpine
44
ports: [80]
5+
healthcheck:
6+
test: wget --spider -S -T1 http://localhost:80
7+
interval: 1s
8+
timeout: 1s
59
b:
610
image: nginx:alpine
711
ports: [80]
812
depends_on:
913
- a
14+
healthcheck:
15+
test: wget --spider -S -T1 http://localhost:80
16+
interval: 1s
17+
timeout: 1s

pkg/e2e/framework.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ func NewCLI(t testing.TB, opts ...CLIOption) *CLI {
103103
for _, opt := range opts {
104104
opt(c)
105105
}
106-
t.Log(c.RunDockerComposeCmdNoCheck(t, "version").Combined())
106+
c.RunDockerComposeCmdNoCheck(t, "version")
107107
return c
108108
}
109109

@@ -305,7 +305,10 @@ func (c *CLI) RunDockerComposeCmd(t testing.TB, args ...string) *icmd.Result {
305305
// RunDockerComposeCmdNoCheck runs a docker compose command, don't presume of any expectation and returns a result
306306
func (c *CLI) RunDockerComposeCmdNoCheck(t testing.TB, args ...string) *icmd.Result {
307307
t.Helper()
308-
return icmd.RunCmd(c.NewDockerComposeCmd(t, args...))
308+
cmd := c.NewDockerComposeCmd(t, args...)
309+
cmd.Stdout = os.Stdout
310+
t.Logf("Running command: %s", strings.Join(cmd.Command, " "))
311+
return icmd.RunCmd(cmd)
309312
}
310313

311314
// NewDockerComposeCmd creates a command object for Compose, either in plugin

pkg/e2e/pause_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ func TestPauseServiceAlreadyPaused(t *testing.T) {
101101
t.Cleanup(cleanup)
102102

103103
// launch a and wait for it to come up
104-
cli.RunDockerComposeCmd(t, "up", "-d", "a")
104+
cli.RunDockerComposeCmd(t, "up", "--wait", "a")
105105
HTTPGetWithRetry(t, urlForService(t, cli, "a", 80), http.StatusOK, 50*time.Millisecond, 10*time.Second)
106106

107107
// pause a twice - first time should pass, second time fail

0 commit comments

Comments
 (0)