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

Function TestRemoveAndAddBack

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

Source from the content-addressed store, hash-verified

245}
246
247func TestRemoveAndAddBack(t *testing.T) {
248 f := newNotifyFixture(t)
249
250 path := filepath.Join(f.paths[0], "change")
251
252 d1 := []byte("hello\ngo\n")
253 err := os.WriteFile(path, d1, 0o644)
254 if err != nil {
255 t.Fatal(err)
256 }
257 f.watch(path)
258 f.assertEvents(path)
259
260 err = os.Remove(path)
261 if err != nil {
262 t.Fatal(err)
263 }
264
265 f.assertEvents(path)
266 f.events = nil
267
268 err = os.WriteFile(path, d1, 0o644)
269 if err != nil {
270 t.Fatal(err)
271 }
272
273 f.assertEvents(path)
274}
275
276func TestSingleFile(t *testing.T) {
277 f := newNotifyFixture(t)

Callers

nothing calls this directly

Calls 5

newNotifyFixtureFunction · 0.85
WriteFileMethod · 0.80
assertEventsMethod · 0.80
RemoveMethod · 0.65
watchMethod · 0.45

Tested by

no test coverage detected