Merge pull request #81 from hpcloud/fix-race-in-test
Fixes race in test
This commit is contained in:
commit
f4e2250826
2
Makefile
2
Makefile
|
@ -1,7 +1,7 @@
|
|||
default: test
|
||||
|
||||
test: *.go
|
||||
go test -v ./...
|
||||
go test -v -race ./...
|
||||
|
||||
fmt:
|
||||
gofmt -w .
|
||||
|
|
11
tail_test.go
11
tail_test.go
|
@ -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
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue