test antiEntropy set to 0 works as expected

This commit is contained in:
Matt Jaffee 2018-08-09 15:54:31 -05:00
parent 287ea370fd
commit b761121f47
No known key found for this signature in database
GPG key ID: 08A3DFFF987B11BF

View file

@ -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")
}
}