Skip to content

Commit

Permalink
stores: truncate timestamps for comparison
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisSchinnerl committed Jul 2, 2024
1 parent 5c0ef81 commit 15495a6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions stores/chain_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ func TestProcessChainUpdate(t *testing.T) {
}

// assert update host is successful
ts := time.Now().Add(-time.Minute)
ts := time.Now().Truncate(time.Second).Add(-time.Minute).UTC()
if err := ss.ProcessChainUpdate(context.Background(), func(tx chain.ChainUpdateTx) error {
return tx.UpdateHost(hks[0], chain.HostAnnouncement{NetAddress: "foo"}, 1, types.BlockID{}, ts)
}); err != nil {
Expand All @@ -147,7 +147,7 @@ func TestProcessChainUpdate(t *testing.T) {
t.Fatal("unexpected error", err)
} else if h.NetAddress != "foo" {
t.Fatal("unexpected net address", h.NetAddress)
} else if !h.LastAnnouncement.Equal(ts) {
} else if !h.LastAnnouncement.Truncate(time.Second).Equal(ts) {
t.Fatalf("unexpected last announcement %v != %v", h.LastAnnouncement, ts)
}

Expand Down

0 comments on commit 15495a6

Please sign in to comment.