Skip to content
This repository has been archived by the owner on Aug 19, 2022. It is now read-only.

Commit

Permalink
fix: assert that peer record is accepted in test
Browse files Browse the repository at this point in the history
This test is flaking on windows when using the leveldb datastore.
Hopefully, this extra check will help us narrow it down.
  • Loading branch information
Stebalien committed Jul 21, 2021
1 parent eef7cec commit 4a4c488
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions test/addr_book_suite.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand All @@ -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))

Expand Down

0 comments on commit 4a4c488

Please sign in to comment.