From 0bd497352aef86a863bdaec86f76d4ed91e16d32 Mon Sep 17 00:00:00 2001 From: Sam Kleinman Date: Fri, 23 Apr 2021 10:51:48 -0400 Subject: [PATCH] statesync: fix unreliable test (#6390) Somehow my previous attempt to fix this test was somewhat non-deterministic. I think I misjudged how the "median" would impact the test. I ran the test in question 10 times without seeing a failure (which would show up 10-30% of the time previously,) so I'm pretty sure this is fixed. --- statesync/snapshots_test.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/statesync/snapshots_test.go b/statesync/snapshots_test.go index 69acd33eb..95583514b 100644 --- a/statesync/snapshots_test.go +++ b/statesync/snapshots_test.go @@ -148,11 +148,11 @@ func TestSnapshotPool_Ranked_Best(t *testing.T) { snapshot *snapshot peers []p2p.NodeID }{ - {&snapshot{Height: 2, Format: 2, Chunks: 4, Hash: []byte{1, 3}}, []p2p.NodeID{"AA", "BB", "CC"}}, - {&snapshot{Height: 1, Format: 1, Chunks: 4, Hash: []byte{1, 2}}, []p2p.NodeID{"AA", "BB", "CC"}}, - {&snapshot{Height: 2, Format: 2, Chunks: 5, Hash: []byte{1, 2}}, []p2p.NodeID{"AA"}}, - {&snapshot{Height: 2, Format: 1, Chunks: 3, Hash: []byte{1, 2}}, []p2p.NodeID{"AA", "BB"}}, - {&snapshot{Height: 1, Format: 2, Chunks: 5, Hash: []byte{1, 2}}, []p2p.NodeID{"AA", "BB"}}, + {&snapshot{Height: 2, Format: 2, Chunks: 4, Hash: []byte{1, 3}}, []p2p.NodeID{"AA", "BB", "CC", "DD"}}, + {&snapshot{Height: 1, Format: 1, Chunks: 4, Hash: []byte{1, 2}}, []p2p.NodeID{"AA", "BB", "CC", "DD"}}, + {&snapshot{Height: 2, Format: 2, Chunks: 5, Hash: []byte{1, 2}}, []p2p.NodeID{"AA", "BB"}}, + {&snapshot{Height: 2, Format: 1, Chunks: 3, Hash: []byte{1, 2}}, []p2p.NodeID{"AA", "BB", "CC"}}, + {&snapshot{Height: 1, Format: 2, Chunks: 5, Hash: []byte{1, 2}}, []p2p.NodeID{"AA", "BB", "CC"}}, } // Add snapshots in reverse order, to make sure the pool enforces some order.