fixed race condition reported in issue #881

This commit is contained in:
caffix
2017-11-20 16:45:59 -05:00
parent f9bc22ec6a
commit 4087326f45
2 changed files with 49 additions and 43 deletions

View File

@@ -210,7 +210,10 @@ func TestTrustMetricStopPause(t *testing.T) {
// Give the pause some time to take place
time.Sleep(10 * time.Millisecond)
tm.mtx.Lock()
first := tm.numIntervals
tm.mtx.Unlock()
// Allow more time to pass and check the intervals are unchanged
time.Sleep(50 * time.Millisecond)
assert.Equal(t, first, tm.numIntervals)
@@ -223,7 +226,10 @@ func TestTrustMetricStopPause(t *testing.T) {
// Give the stop some time to take place
time.Sleep(10 * time.Millisecond)
tm.mtx.Lock()
second := tm.numIntervals
tm.mtx.Unlock()
// Allow more time to pass and check the intervals are unchanged
time.Sleep(50 * time.Millisecond)
assert.Equal(t, second, tm.numIntervals)