fix data race in test

This commit is contained in:
Steven Allen 2021-01-20 14:43:19 -08:00
parent f1719d1e23
commit fe5b5702f9

View File

@ -150,8 +150,11 @@ func TestSyncManagerEdgeCase(t *testing.T) {
t.Fatalf("Expected tipset %s to sync, but got %s", e1, last)
}
if len(sm.state) != 0 {
t.Errorf("active syncs expected empty but got: %d", len(sm.state))
sm.mx.Lock()
activeSyncs := len(sm.state)
sm.mx.Unlock()
if activeSyncs != 0 {
t.Errorf("active syncs expected empty but got: %d", activeSyncs)
}
})
}