diff --git a/server_internal_test.go b/server_internal_test.go index e64f80a0f..e22681764 100644 --- a/server_internal_test.go +++ b/server_internal_test.go @@ -15,8 +15,10 @@ package pilosa import ( + "io/ioutil" "runtime" "testing" + "time" ) // Ensure the file handle count is working @@ -33,3 +35,28 @@ func TestCountOpenFiles(t *testing.T) { t.Error("countOpenFiles returned invalid value 0.") } } + +func TestMonitorAntiEntropyZero(t *testing.T) { + + td, err := ioutil.TempDir("", "") + if err != nil { + t.Fatalf("getting temp dir: %v", err) + } + s, err := NewServer(OptServerDataDir(td), + OptServerAntiEntropyInterval(0)) + if err != nil { + t.Fatalf("making new server: %v", err) + } + + ch := make(chan struct{}) + go func() { + s.monitorAntiEntropy() + close(ch) + }() + + select { + case <-ch: + case <-time.After(time.Second): + t.Fatalf("monitorAntiEntropy should have returned immediately with duration 0") + } +}