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

Function TestLocationMiddle

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

Source from the content-addressed store, hash-verified

192}
193
194func TestLocationMiddle(t *testing.T) {
195 // Test reading from middle.
196 tailTest := NewTailTest("location-middle", t)
197 tailTest.CreateFile("test.txt", "hello\nworld\n")
198 tail := tailTest.StartTail("test.txt", Config{Follow: true, Location: &SeekInfo{-6, os.SEEK_END}})
199 go tailTest.VerifyTailOutput(tail, []string{"world", "more", "data"}, false)
200
201 <-time.After(100 * time.Millisecond)
202 tailTest.AppendFile("test.txt", "more\ndata\n")
203
204 // Delete after a reasonable delay, to give tail sufficient time
205 // to read all lines.
206 <-time.After(100 * time.Millisecond)
207 tailTest.RemoveFile("test.txt")
208 tailTest.Cleanup(tail, true)
209}
210
211// The use of polling file watcher could affect file rotation
212// (detected via renames), so test these explicitly.

Callers

nothing calls this directly

Calls 7

CreateFileMethod · 0.95
StartTailMethod · 0.95
VerifyTailOutputMethod · 0.95
AppendFileMethod · 0.95
RemoveFileMethod · 0.95
CleanupMethod · 0.95
NewTailTestFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…