From 4cdb7ba1d3a3e956eb0ff5e1ce490700c2188318 Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Wed, 20 Jan 2021 16:08:29 -0800 Subject: [PATCH] fix a flake in the sync manager edge case test Depending on scheduling, we may see c2 before we see c1. --- chain/sync_manager_test.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/chain/sync_manager_test.go b/chain/sync_manager_test.go index 61985b964..a5ff033ac 100644 --- a/chain/sync_manager_test.go +++ b/chain/sync_manager_test.go @@ -117,6 +117,13 @@ func TestSyncManagerEdgeCase(t *testing.T) { // get the next sync target; it should be c1 as the heaviest tipset but added last (same weight as c2) bop = <-stc + if bop.ts.Equals(c2) { + // there's a small race and we might get c2 first. + // But we should still end on c1. + bop.done() + bop = <-stc + } + if !bop.ts.Equals(c1) { t.Fatalf("Expected tipset %s to sync, but got %s", c1, bop.ts) }