Merge pull request #1437 from gtardif/compose-e2e-cleanup

Cleanup remaining containers after compose e2e tests
This commit is contained in:
Nicolas De loof 2021-03-19 08:06:46 +01:00 коммит произвёл GitHub
Родитель 23b03af744 34d03cce57
Коммит 3366131096
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 9 добавлений и 3 удалений

Просмотреть файл

@ -35,7 +35,6 @@ func TestLocalComposeRun(t *testing.T) {
lines := Lines(res.Stdout())
assert.Equal(t, lines[len(lines)-1], "Hello there!!", res.Stdout())
assert.Assert(t, !strings.Contains(res.Combined(), "orphan"))
res = c.RunDockerCmd("compose", "-f", "./fixtures/run-test/compose.yml", "run", "back", "echo", "Hello one more time")
lines = Lines(res.Stdout())
assert.Equal(t, lines[len(lines)-1], "Hello one more time", res.Stdout())
@ -96,8 +95,14 @@ func TestLocalComposeRun(t *testing.T) {
})
t.Run("compose run --publish", func(t *testing.T) {
c.RunDockerCmd("compose", "-f", "./fixtures/run-test/compose.yml", "run", "--rm", "--publish", "8080:80", "-d", "back", "/bin/sh", "-c", "sleep 10")
c.RunDockerCmd("compose", "-f", "./fixtures/run-test/compose.yml", "run", "--publish", "8080:80", "-d", "back", "/bin/sh", "-c", "sleep 1")
res := c.RunDockerCmd("ps")
assert.Assert(t, strings.Contains(res.Stdout(), "8080->80/tcp"), res.Stdout())
})
t.Run("down", func(t *testing.T) {
c.RunDockerCmd("compose", "-f", "./fixtures/run-test/compose.yml", "down")
res := c.RunDockerCmd("ps", "--all")
assert.Assert(t, !strings.Contains(res.Stdout(), "run-test"), res.Stdout())
})
}

Просмотреть файл

@ -137,7 +137,8 @@ func TestComposePull(t *testing.T) {
func TestAttachRestart(t *testing.T) {
c := NewParallelE2eCLI(t, binDir)
res := c.RunDockerOrExitError("compose", "--ansi=never", "--project-directory", "fixtures/attach-restart", "up")
res := c.RunDockerOrExitError("compose", "--ansi=never", "--project-directory", "./fixtures/attach-restart", "up")
defer c.RunDockerCmd("compose", "-p", "attach-restart", "down")
output := res.Stdout()
exitRegex := regexp.MustCompile("another_1 exited with code 1")