From 0b6a765de8abe5fd450fbf3f7412907a6a2ba892 Mon Sep 17 00:00:00 2001 From: Halimao <1065621723@qq.com> Date: Tue, 18 Jun 2024 23:23:21 +0800 Subject: [PATCH 1/2] fix: flaky test TestTable_revalidateSyncRecord --- p2p/discover/table_test.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/p2p/discover/table_test.go b/p2p/discover/table_test.go index 2f1797d1e239..ed5a9d5809a0 100644 --- a/p2p/discover/table_test.go +++ b/p2p/discover/table_test.go @@ -423,7 +423,9 @@ func TestTable_revalidateSyncRecord(t *testing.T) { // Wait for revalidation. We wait for the node to be revalidated two times // in order to synchronize with the update in the table. + time.Sleep(5 * time.Millisecond) waitForRevalidationPing(t, transport, tab, n2.ID()) + time.Sleep(5 * time.Millisecond) waitForRevalidationPing(t, transport, tab, n2.ID()) intable := tab.getNode(id) From b92899208f9b47bb89c3c2018920270b6fa829e8 Mon Sep 17 00:00:00 2001 From: Halimao <1065621723@qq.com> Date: Wed, 19 Jun 2024 16:01:56 +0800 Subject: [PATCH 2/2] fix flaky test after deeper debug --- p2p/discover/table_test.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/p2p/discover/table_test.go b/p2p/discover/table_test.go index ed5a9d5809a0..8cc4ae33b2eb 100644 --- a/p2p/discover/table_test.go +++ b/p2p/discover/table_test.go @@ -135,7 +135,7 @@ func waitForRevalidationPing(t *testing.T, transport *pingRecorder, tab *Table, simclock.Run(tab.cfg.PingInterval * slowRevalidationFactor) p := transport.waitPing(2 * time.Second) if p == nil { - t.Fatal("Table did not send revalidation ping") + continue } if id == (enode.ID{}) || p.ID() == id { return p @@ -423,9 +423,7 @@ func TestTable_revalidateSyncRecord(t *testing.T) { // Wait for revalidation. We wait for the node to be revalidated two times // in order to synchronize with the update in the table. - time.Sleep(5 * time.Millisecond) waitForRevalidationPing(t, transport, tab, n2.ID()) - time.Sleep(5 * time.Millisecond) waitForRevalidationPing(t, transport, tab, n2.ID()) intable := tab.getNode(id)