mirror of
https://github.com/libp2p/go-libp2p-peerstore.git
synced 2025-02-05 06:10:09 +08:00
fix: assert that peer record is accepted in test
This test is flaking on windows when using the leveldb datastore. Hopefully, this extra check will help us narrow it down.
This commit is contained in:
parent
eef7cecd29
commit
4a4c4886f7
@ -457,8 +457,11 @@ func testCertifiedAddresses(m pstore.AddrBook) func(*testing.T) {
|
||||
rec4.Addrs = certifiedAddrs
|
||||
signedRec4, err := record.Seal(rec4, priv)
|
||||
test.AssertNilError(t, err)
|
||||
_, err = cab.ConsumePeerRecord(signedRec4, time.Hour)
|
||||
accepted, err = cab.ConsumePeerRecord(signedRec4, time.Hour)
|
||||
test.AssertNilError(t, err)
|
||||
if !accepted {
|
||||
t.Error("expected peer record to be accepted")
|
||||
}
|
||||
// AssertAddressesEqual(t, certifiedAddrs, m.Addrs(id))
|
||||
AssertAddressesEqual(t, allAddrs, m.Addrs(id))
|
||||
|
||||
@ -475,7 +478,10 @@ func testCertifiedAddresses(m pstore.AddrBook) func(*testing.T) {
|
||||
}
|
||||
|
||||
// Test that natural TTL expiration clears signed peer records
|
||||
_, err = cab.ConsumePeerRecord(signedRec4, time.Second)
|
||||
accepted, err = cab.ConsumePeerRecord(signedRec4, time.Second)
|
||||
if !accepted {
|
||||
t.Error("expected peer record to be accepted")
|
||||
}
|
||||
test.AssertNilError(t, err)
|
||||
AssertAddressesEqual(t, certifiedAddrs, m.Addrs(id))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user