Fix flaky test TestServer_ConcurrentPointsWriter_Subscriber

The LocalServer could be closed before the goroutine writing points
exited causing nil pointer panic.

Fixes #9583
pull/9621/head
Jason Wilder 2018-03-22 14:33:55 -06:00
parent 477de23e35
commit 8730be1e9f
1 changed files with 4 additions and 0 deletions

View File

@ -9158,7 +9158,10 @@ func TestServer_ConcurrentPointsWriter_Subscriber(t *testing.T) {
}
// goroutine to write points
done := make(chan struct{})
var wg sync.WaitGroup
wg.Add(1)
go func() {
defer wg.Done()
for {
select {
case <-done:
@ -9176,6 +9179,7 @@ func TestServer_ConcurrentPointsWriter_Subscriber(t *testing.T) {
time.Sleep(10 * time.Millisecond)
close(done)
wg.Wait()
}
// Ensure time in where clause is inclusive