MCPcopy Create free account
hub / github.com/hpcloud/tail / TestMustExist

Function TestMustExist

tail_test.go:36–52  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

34}
35
36func TestMustExist(t *testing.T) {
37 tail, err := TailFile("/no/such/file", Config{Follow: true, MustExist: true})
38 if err == nil {
39 t.Error("MustExist:true is violated")
40 tail.Stop()
41 }
42 tail, err = TailFile("/no/such/file", Config{Follow: true, MustExist: false})
43 if err != nil {
44 t.Error("MustExist:false is violated")
45 }
46 tail.Stop()
47 _, err = TailFile("README.md", Config{Follow: true, MustExist: true})
48 if err != nil {
49 t.Error("MustExist:true on an existing file is violated")
50 }
51 tail.Cleanup()
52}
53
54func TestWaitsForFileToExist(t *testing.T) {
55 tailTest := NewTailTest("waits-for-file-to-exist", t)

Callers

nothing calls this directly

Calls 3

TailFileFunction · 0.85
StopMethod · 0.80
CleanupMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…