(t *testing.T)
| 34 | } |
| 35 | |
| 36 | func TestRestart(t *testing.T) { |
| 37 | c := NewParallelCLI(t) |
| 38 | const projectName = "e2e-restart" |
| 39 | |
| 40 | t.Run("Up a project", func(t *testing.T) { |
| 41 | // This is just to ensure the containers do NOT exist |
| 42 | c.RunDockerComposeCmd(t, "--project-name", projectName, "down") |
| 43 | |
| 44 | res := c.RunDockerComposeCmd(t, "-f", "./fixtures/restart-test/compose.yaml", "--project-name", projectName, "up", "-d") |
| 45 | assert.Assert(t, strings.Contains(res.Combined(), "Container e2e-restart-restart-1 Started"), res.Combined()) |
| 46 | |
| 47 | c.WaitForCmdResult(t, c.NewDockerComposeCmd(t, "--project-name", projectName, "ps", "-a", "--format", |
| 48 | "json"), |
| 49 | StdoutContains(`"State":"exited"`), 10*time.Second, 1*time.Second) |
| 50 | |
| 51 | res = c.RunDockerComposeCmd(t, "--project-name", projectName, "ps", "-a") |
| 52 | assertServiceStatus(t, projectName, "restart", "Exited", res.Stdout()) |
| 53 | |
| 54 | c.RunDockerComposeCmd(t, "-f", "./fixtures/restart-test/compose.yaml", "--project-name", projectName, "restart") |
| 55 | |
| 56 | // Give the same time but it must NOT exit |
| 57 | time.Sleep(time.Second) |
| 58 | |
| 59 | res = c.RunDockerComposeCmd(t, "--project-name", projectName, "ps") |
| 60 | assertServiceStatus(t, projectName, "restart", "Up", res.Stdout()) |
| 61 | |
| 62 | // Clean up |
| 63 | c.RunDockerComposeCmd(t, "--project-name", projectName, "down") |
| 64 | }) |
| 65 | } |
| 66 | |
| 67 | func TestRestartWithDependencies(t *testing.T) { |
| 68 | c := NewCLI(t, WithEnv( |
nothing calls this directly
no test coverage detected