(t *testing.T)
| 65 | } |
| 66 | |
| 67 | func TestRestartWithDependencies(t *testing.T) { |
| 68 | c := NewCLI(t, WithEnv( |
| 69 | "COMPOSE_PROJECT_NAME=e2e-restart-deps", |
| 70 | )) |
| 71 | baseService := "nginx" |
| 72 | depWithRestart := "with-restart" |
| 73 | depNoRestart := "no-restart" |
| 74 | |
| 75 | t.Cleanup(func() { |
| 76 | c.RunDockerComposeCmd(t, "down", "--remove-orphans") |
| 77 | }) |
| 78 | |
| 79 | c.RunDockerComposeCmd(t, "-f", "./fixtures/restart-test/compose-depends-on.yaml", "up", "-d") |
| 80 | |
| 81 | res := c.RunDockerComposeCmd(t, "restart", baseService) |
| 82 | out := res.Combined() |
| 83 | assert.Assert(t, strings.Contains(out, fmt.Sprintf("Container e2e-restart-deps-%s-1 Restarting", baseService)), out) |
| 84 | assert.Assert(t, strings.Contains(out, fmt.Sprintf("Container e2e-restart-deps-%s-1 Healthy", baseService)), out) |
| 85 | assert.Assert(t, strings.Contains(out, fmt.Sprintf("Container e2e-restart-deps-%s-1 Started", depWithRestart)), out) |
| 86 | assert.Assert(t, !strings.Contains(out, depNoRestart), out) |
| 87 | |
| 88 | c = NewParallelCLI(t, WithEnv( |
| 89 | "COMPOSE_PROJECT_NAME=e2e-restart-deps", |
| 90 | "LABEL=recreate", |
| 91 | )) |
| 92 | res = c.RunDockerComposeCmd(t, "-f", "./fixtures/restart-test/compose-depends-on.yaml", "up", "-d") |
| 93 | out = res.Combined() |
| 94 | assert.Assert(t, strings.Contains(out, fmt.Sprintf("Container e2e-restart-deps-%s-1 Stopped", depWithRestart)), out) |
| 95 | assert.Assert(t, strings.Contains(out, fmt.Sprintf("Container e2e-restart-deps-%s-1 Recreated", baseService)), out) |
| 96 | assert.Assert(t, strings.Contains(out, fmt.Sprintf("Container e2e-restart-deps-%s-1 Healthy", baseService)), out) |
| 97 | assert.Assert(t, strings.Contains(out, fmt.Sprintf("Container e2e-restart-deps-%s-1 Started", depWithRestart)), out) |
| 98 | assert.Assert(t, strings.Contains(out, fmt.Sprintf("Container e2e-restart-deps-%s-1 Running", depNoRestart)), out) |
| 99 | } |
| 100 | |
| 101 | func TestRestartWithProfiles(t *testing.T) { |
| 102 | c := NewParallelCLI(t, WithEnv( |
nothing calls this directly
no test coverage detected
searching dependent graphs…