account for POLL_DURATION in the reopen test
ref: https://travis-ci.org/ActiveState/tail/builds/21301728
This commit is contained in:
parent
0383a079b7
commit
3da62cd5ae
15
tail_test.go
15
tail_test.go
|
@ -132,10 +132,13 @@ func TestLocationMiddle(_t *testing.T) {
|
||||||
|
|
||||||
func _TestReOpen(_t *testing.T, poll bool) {
|
func _TestReOpen(_t *testing.T, poll bool) {
|
||||||
var name string
|
var name string
|
||||||
|
var delay time.Duration
|
||||||
if poll {
|
if poll {
|
||||||
name = "reopen-polling"
|
name = "reopen-polling"
|
||||||
|
delay = 300 * time.Millisecond // account for POLL_DURATION
|
||||||
} else {
|
} else {
|
||||||
name = "reopen-inotify"
|
name = "reopen-inotify"
|
||||||
|
delay = 100 * time.Millisecond
|
||||||
}
|
}
|
||||||
t := NewTailTest(name, _t)
|
t := NewTailTest(name, _t)
|
||||||
t.CreateFile("test.txt", "hello\nworld\n")
|
t.CreateFile("test.txt", "hello\nworld\n")
|
||||||
|
@ -146,22 +149,22 @@ func _TestReOpen(_t *testing.T, poll bool) {
|
||||||
go t.VerifyTailOutput(tail, []string{"hello", "world", "more", "data", "endofworld"})
|
go t.VerifyTailOutput(tail, []string{"hello", "world", "more", "data", "endofworld"})
|
||||||
|
|
||||||
// deletion must trigger reopen
|
// deletion must trigger reopen
|
||||||
<-time.After(100 * time.Millisecond)
|
<-time.After(delay)
|
||||||
t.RemoveFile("test.txt")
|
t.RemoveFile("test.txt")
|
||||||
<-time.After(100 * time.Millisecond)
|
<-time.After(delay)
|
||||||
t.CreateFile("test.txt", "more\ndata\n")
|
t.CreateFile("test.txt", "more\ndata\n")
|
||||||
|
|
||||||
// rename must trigger reopen
|
// rename must trigger reopen
|
||||||
<-time.After(100 * time.Millisecond)
|
<-time.After(delay)
|
||||||
t.RenameFile("test.txt", "test.txt.rotated")
|
t.RenameFile("test.txt", "test.txt.rotated")
|
||||||
<-time.After(100 * time.Millisecond)
|
<-time.After(delay)
|
||||||
t.CreateFile("test.txt", "endofworld")
|
t.CreateFile("test.txt", "endofworld")
|
||||||
|
|
||||||
// Delete after a reasonable delay, to give tail sufficient time
|
// Delete after a reasonable delay, to give tail sufficient time
|
||||||
// to read all lines.
|
// to read all lines.
|
||||||
<-time.After(100 * time.Millisecond)
|
<-time.After(delay)
|
||||||
t.RemoveFile("test.txt")
|
t.RemoveFile("test.txt")
|
||||||
<-time.After(100 * time.Millisecond)
|
<-time.After(delay)
|
||||||
|
|
||||||
// Do not bother with stopping as it could kill the tomb during
|
// Do not bother with stopping as it could kill the tomb during
|
||||||
// the reading of data written above. Timings can vary based on
|
// the reading of data written above. Timings can vary based on
|
||||||
|
|
Loading…
Reference in New Issue