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

Function TestWatchNonexistentDirectory

pkg/watch/notify_test.go:417–444  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

415}
416
417func TestWatchNonexistentDirectory(t *testing.T) {
418 f := newNotifyFixture(t)
419
420 root := f.JoinPath("root")
421 err := os.Mkdir(root, 0o777)
422 if err != nil {
423 t.Fatal(err)
424 }
425 parent := f.JoinPath("parent")
426 file := f.JoinPath("parent", "a")
427
428 f.watch(parent)
429 f.fsync()
430 f.events = nil
431
432 err = os.Mkdir(parent, 0o777)
433 if err != nil {
434 t.Fatal(err)
435 }
436
437 // for directories that were the root of an Add, we don't report creation, cf. watcher_darwin.go
438 f.assertEvents()
439
440 f.events = nil
441 f.WriteFile(file, "hello")
442
443 f.assertEvents(file)
444}
445
446func TestWatchNonexistentFileInNonexistentDirectory(t *testing.T) {
447 f := newNotifyFixture(t)

Callers

nothing calls this directly

Calls 6

newNotifyFixtureFunction · 0.85
JoinPathMethod · 0.80
fsyncMethod · 0.80
assertEventsMethod · 0.80
WriteFileMethod · 0.80
watchMethod · 0.45

Tested by

no test coverage detected