(t *testing.T)
| 286 | } |
| 287 | |
| 288 | func TestWatchExec(t *testing.T) { |
| 289 | c := NewCLI(t) |
| 290 | const projectName = "test_watch_exec" |
| 291 | |
| 292 | defer c.cleanupWithDown(t, projectName) |
| 293 | |
| 294 | tmpdir := t.TempDir() |
| 295 | composeFilePath := filepath.Join(tmpdir, "compose.yaml") |
| 296 | CopyFile(t, filepath.Join("fixtures", "watch", "exec.yaml"), composeFilePath) |
| 297 | cmd := c.NewDockerComposeCmd(t, "-p", projectName, "-f", composeFilePath, "up", "--watch") |
| 298 | buffer := bytes.NewBuffer(nil) |
| 299 | cmd.Stdout = buffer |
| 300 | watch := icmd.StartCmd(cmd) |
| 301 | |
| 302 | poll.WaitOn(t, func(l poll.LogT) poll.Result { |
| 303 | out := buffer.String() |
| 304 | if strings.Contains(out, "64 bytes from") { |
| 305 | return poll.Success() |
| 306 | } |
| 307 | return poll.Continue("%v", watch.Stdout()) |
| 308 | }) |
| 309 | |
| 310 | t.Logf("Create new file") |
| 311 | |
| 312 | testFile := filepath.Join(tmpdir, "test") |
| 313 | assert.NilError(t, os.WriteFile(testFile, []byte("test\n"), 0o600)) |
| 314 | |
| 315 | poll.WaitOn(t, func(l poll.LogT) poll.Result { |
| 316 | out := buffer.String() |
| 317 | if strings.Contains(out, "SUCCESS") { |
| 318 | return poll.Success() |
| 319 | } |
| 320 | return poll.Continue("%v", out) |
| 321 | }) |
| 322 | c.RunDockerComposeCmdNoCheck(t, "-p", projectName, "kill", "-s", "9") |
| 323 | } |
| 324 | |
| 325 | func TestWatchMultiServices(t *testing.T) { |
| 326 | c := NewCLI(t) |
nothing calls this directly
no test coverage detected