(t *testing.T)
| 192 | } |
| 193 | |
| 194 | func 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. |
nothing calls this directly
no test coverage detected
searching dependent graphs…