From 01e146e104ebbef6c852fe802b2de44fdaa71280 Mon Sep 17 00:00:00 2001 From: Marten Seemann Date: Thu, 26 May 2022 12:38:59 +0200 Subject: [PATCH] basichost: fix flaky TestSignedPeerRecordWithNoListenAddrs --- p2p/host/basic/basic_host_test.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/p2p/host/basic/basic_host_test.go b/p2p/host/basic/basic_host_test.go index f4f7f53658..ca71218d0e 100644 --- a/p2p/host/basic/basic_host_test.go +++ b/p2p/host/basic/basic_host_test.go @@ -105,7 +105,15 @@ func TestSignedPeerRecordWithNoListenAddrs(t *testing.T) { t.Fatalf("peerstore doesn't support certified addrs") } // the signed record with the new addr is added async - require.Eventually(t, func() bool { return cab.GetPeerRecord(h.ID()) != nil }, 100*time.Millisecond, 10*time.Millisecond) + var env *record.Envelope + require.Eventually(t, func() bool { + env = cab.GetPeerRecord(h.ID()) + return env != nil + }, 500*time.Millisecond, 10*time.Millisecond) + rec, err := env.Record() + require.NoError(t, err) + require.NotEmpty(t, rec.(*peer.PeerRecord).Addrs) + } func TestProtocolHandlerEvents(t *testing.T) {