Skip to content
This repository was archived by the owner on Nov 27, 2023. It is now read-only.

Commit 34d03cc

Browse files
committed
Cleanup remaining containers after compose e2e tests
Signed-off-by: Guillaume Tardif <[email protected]>
1 parent 3f50200 commit 34d03cc

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

local/e2e/compose/compose_run_test.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ func TestLocalComposeRun(t *testing.T) {
3535
lines := Lines(res.Stdout())
3636
assert.Equal(t, lines[len(lines)-1], "Hello there!!", res.Stdout())
3737
assert.Assert(t, !strings.Contains(res.Combined(), "orphan"))
38-
3938
res = c.RunDockerCmd("compose", "-f", "./fixtures/run-test/compose.yml", "run", "back", "echo", "Hello one more time")
4039
lines = Lines(res.Stdout())
4140
assert.Equal(t, lines[len(lines)-1], "Hello one more time", res.Stdout())
@@ -96,8 +95,14 @@ func TestLocalComposeRun(t *testing.T) {
9695
})
9796

9897
t.Run("compose run --publish", func(t *testing.T) {
99-
c.RunDockerCmd("compose", "-f", "./fixtures/run-test/compose.yml", "run", "--rm", "--publish", "8080:80", "-d", "back", "/bin/sh", "-c", "sleep 10")
98+
c.RunDockerCmd("compose", "-f", "./fixtures/run-test/compose.yml", "run", "--publish", "8080:80", "-d", "back", "/bin/sh", "-c", "sleep 1")
10099
res := c.RunDockerCmd("ps")
101100
assert.Assert(t, strings.Contains(res.Stdout(), "8080->80/tcp"), res.Stdout())
102101
})
102+
103+
t.Run("down", func(t *testing.T) {
104+
c.RunDockerCmd("compose", "-f", "./fixtures/run-test/compose.yml", "down")
105+
res := c.RunDockerCmd("ps", "--all")
106+
assert.Assert(t, !strings.Contains(res.Stdout(), "run-test"), res.Stdout())
107+
})
103108
}

local/e2e/compose/compose_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,8 @@ func TestComposePull(t *testing.T) {
137137
func TestAttachRestart(t *testing.T) {
138138
c := NewParallelE2eCLI(t, binDir)
139139

140-
res := c.RunDockerOrExitError("compose", "--ansi=never", "--project-directory", "fixtures/attach-restart", "up")
140+
res := c.RunDockerOrExitError("compose", "--ansi=never", "--project-directory", "./fixtures/attach-restart", "up")
141+
defer c.RunDockerCmd("compose", "-p", "attach-restart", "down")
141142
output := res.Stdout()
142143

143144
exitRegex := regexp.MustCompile("another_1 exited with code 1")

0 commit comments

Comments
 (0)