MCPcopy
hub / github.com/docker/compose / TestWatchIncludes

Function TestWatchIncludes

pkg/e2e/watch_test.go:450–485  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

448}
449
450func TestWatchIncludes(t *testing.T) {
451 c := NewCLI(t)
452 const projectName = "test_watch_includes"
453
454 defer c.cleanupWithDown(t, projectName)
455
456 tmpdir := t.TempDir()
457 composeFilePath := filepath.Join(tmpdir, "compose.yaml")
458 CopyFile(t, filepath.Join("fixtures", "watch", "include.yaml"), composeFilePath)
459
460 cmd := c.NewDockerComposeCmd(t, "-p", projectName, "-f", composeFilePath, "up", "--watch")
461 buffer := bytes.NewBuffer(nil)
462 cmd.Stdout = buffer
463 watch := icmd.StartCmd(cmd)
464
465 poll.WaitOn(t, func(l poll.LogT) poll.Result {
466 if strings.Contains(watch.Stdout(), "Attaching to ") {
467 return poll.Success()
468 }
469 return poll.Continue("%v", watch.Stdout())
470 })
471
472 assert.NilError(t, os.WriteFile(filepath.Join(tmpdir, "B.test"), []byte("test"), 0o600))
473 assert.NilError(t, os.WriteFile(filepath.Join(tmpdir, "A.test"), []byte("test"), 0o600))
474
475 poll.WaitOn(t, func(l poll.LogT) poll.Result {
476 cat := c.RunDockerComposeCmdNoCheck(t, "-p", projectName, "exec", "a", "ls", "/data/")
477 if strings.Contains(cat.Stdout(), "A.test") {
478 assert.Check(t, !strings.Contains(cat.Stdout(), "B.test"))
479 return poll.Success()
480 }
481 return poll.Continue("%v", cat.Combined())
482 })
483
484 c.RunDockerComposeCmdNoCheck(t, "-p", projectName, "kill", "-s", "9")
485}
486
487func TestCheckWarningXInitialSyn(t *testing.T) {
488 c := NewCLI(t)

Callers

nothing calls this directly

Calls 7

cleanupWithDownMethod · 0.95
NewDockerComposeCmdMethod · 0.95
NewCLIFunction · 0.85
CopyFileFunction · 0.85
TempDirMethod · 0.80
WriteFileMethod · 0.80

Tested by

no test coverage detected