From 9f38710c1f3442ccb5f3243a3406b0d7c6f8e914 Mon Sep 17 00:00:00 2001 From: josh <josh@elixxir.io> Date: Wed, 8 Sep 2021 15:04:47 -0700 Subject: [PATCH] Fix further racey issue in tests --- network/dataStructures/waitingRounds_test.go | 15 ++++++--------- network/instance_test.go | 2 +- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/network/dataStructures/waitingRounds_test.go b/network/dataStructures/waitingRounds_test.go index 9db1a8fb..a55b93c1 100644 --- a/network/dataStructures/waitingRounds_test.go +++ b/network/dataStructures/waitingRounds_test.go @@ -269,15 +269,12 @@ func TestWaitingRounds_GetUpcomingRealtime_GetFurthest(t *testing.T) { // Populate the waiting rounds for i, round := range expectedRounds { - localIndex := i - go func(round *Round, index int) { - time.Sleep(30 * time.Millisecond) - err := testutils.SignRoundInfoRsa(round.info, t) - if err != nil { - t.Errorf("Failed to sign round info #%d: %+v", localIndex, err) - } - testWR.Insert(round) - }(round, localIndex) + time.Sleep(30 * time.Millisecond) + err := testutils.SignRoundInfoRsa(round.info, t) + if err != nil { + t.Errorf("Failed to sign round info #%d: %+v", i, err) + } + testWR.Insert(round) } // Attempt to get the furthest round in the queue diff --git a/network/instance_test.go b/network/instance_test.go index b6fab285..12ad768d 100644 --- a/network/instance_test.go +++ b/network/instance_test.go @@ -919,7 +919,7 @@ func TestInstance_NodeEventModel(t *testing.T) { timeout := 5 for { counterVal := atomic.LoadUint32(&counter) - totalNodeGateways := uint32(len(newNdf.Nodes)+len(newNdf.Gateways)) + totalNodeGateways := uint32(len(newNdf.Nodes) + len(newNdf.Gateways)) if counterVal == totalNodeGateways { break } else { -- GitLab