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

Function TestWatchBrokenLink

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

Source from the content-addressed store, hash-verified

331}
332
333func TestWatchBrokenLink(t *testing.T) {
334 if runtime.GOOS == "windows" {
335 t.Skip("no user-space symlinks on windows")
336 }
337 f := newNotifyFixture(t)
338
339 newRoot, err := NewDir(t.Name())
340 if err != nil {
341 t.Fatal(err)
342 }
343 defer func() {
344 err := newRoot.TearDown()
345 if err != nil {
346 fmt.Printf("error tearing down temp dir: %v\n", err)
347 }
348 }()
349
350 link := filepath.Join(newRoot.Path(), "brokenLink")
351 missingFile := filepath.Join(newRoot.Path(), "missingFile")
352 err = os.Symlink(missingFile, link)
353 if err != nil {
354 t.Fatal(err)
355 }
356
357 f.watch(newRoot.Path())
358 err = os.Remove(link)
359 assert.NilError(t, err)
360 f.assertEvents(link)
361}
362
363func TestMoveAndReplace(t *testing.T) {
364 f := newNotifyFixture(t)

Callers

nothing calls this directly

Calls 8

newNotifyFixtureFunction · 0.85
NewDirFunction · 0.85
TearDownMethod · 0.80
assertEventsMethod · 0.80
RemoveMethod · 0.65
NameMethod · 0.45
PathMethod · 0.45
watchMethod · 0.45

Tested by

no test coverage detected