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

Function TestNewDirectoriesAreRecursivelyWatched

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

Source from the content-addressed store, hash-verified

173}
174
175func TestNewDirectoriesAreRecursivelyWatched(t *testing.T) {
176 f := newNotifyFixture(t)
177
178 root := f.TempDir("root")
179
180 // watch parent
181 f.watch(root)
182 f.fsync()
183 f.events = nil
184
185 // add a sub directory
186 subPath := filepath.Join(root, "sub")
187 f.MkdirAll(subPath)
188
189 // change something inside sub directory
190 changeFilePath := filepath.Join(subPath, "change")
191 file, err := os.OpenFile(changeFilePath, os.O_RDONLY|os.O_CREATE, 0o666)
192 if err != nil {
193 t.Fatal(err)
194 }
195 _ = file.Close()
196 f.assertEvents(subPath, changeFilePath)
197}
198
199func TestWatchNonExistentPath(t *testing.T) {
200 f := newNotifyFixture(t)

Callers

nothing calls this directly

Calls 7

newNotifyFixtureFunction · 0.85
TempDirMethod · 0.80
fsyncMethod · 0.80
MkdirAllMethod · 0.80
assertEventsMethod · 0.80
CloseMethod · 0.65
watchMethod · 0.45

Tested by

no test coverage detected