Merge pull request #81 from hpcloud/fix-race-in-test

Fixes race in test
This commit is contained in:
Mark Yen 2016-04-08 12:58:07 -07:00
commit f4e2250826
2 changed files with 8 additions and 5 deletions

View File

@ -1,7 +1,7 @@
default: test
test: *.go
go test -v ./...
go test -v -race ./...
fmt:
gofmt -w .

View File

@ -25,6 +25,13 @@ func init() {
}
}
func TestMain(m *testing.M) {
// Use a smaller poll duration for faster test runs. Keep it below
// 100ms (which value is used as common delays for tests)
watch.POLL_DURATION = 5 * time.Millisecond
os.Exit(m.Run())
}
func TestMustExist(t *testing.T) {
tail, err := TailFile("/no/such/file", Config{Follow: true, MustExist: true})
if err == nil {
@ -387,10 +394,6 @@ func NewTailTest(name string, t *testing.T) TailTest {
tt.Fatal(err)
}
// Use a smaller poll duration for faster test runs. Keep it below
// 100ms (which value is used as common delays for tests)
watch.POLL_DURATION = 5 * time.Millisecond
return tt
}