MCPcopy Index your code
hub / github.com/hpcloud/tail / TestWaitsForFileToExistRelativePath

Function TestWaitsForFileToExistRelativePath

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

Source from the content-addressed store, hash-verified

62}
63
64func TestWaitsForFileToExistRelativePath(t *testing.T) {
65 tailTest := NewTailTest("waits-for-file-to-exist-relative", t)
66
67 oldWD, err := os.Getwd()
68 if err != nil {
69 tailTest.Fatal(err)
70 }
71 os.Chdir(tailTest.path)
72 defer os.Chdir(oldWD)
73
74 tail, err := TailFile("test.txt", Config{})
75 if err != nil {
76 tailTest.Fatal(err)
77 }
78
79 go tailTest.VerifyTailOutput(tail, []string{"hello", "world"}, false)
80
81 <-time.After(100 * time.Millisecond)
82 if err := ioutil.WriteFile("test.txt", []byte("hello\nworld\n"), 0600); err != nil {
83 tailTest.Fatal(err)
84 }
85 tailTest.Cleanup(tail, true)
86}
87
88func TestStop(t *testing.T) {
89 tail, err := TailFile("_no_such_file", Config{Follow: true, MustExist: false})

Callers

nothing calls this directly

Calls 5

VerifyTailOutputMethod · 0.95
CleanupMethod · 0.95
NewTailTestFunction · 0.85
TailFileFunction · 0.85
FatalMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…