Skip to content

Commit

Permalink
chore: fix test failure
Browse files Browse the repository at this point in the history
  • Loading branch information
Woosang Son committed Apr 5, 2021
1 parent bdecd79 commit a4b7e3f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions codec/types/any_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,10 @@ func TestNewAnyWithCustomTypeURLWithErrorNoAllocation(t *testing.T) {
any, err := types.NewAnyWithCustomTypeURL(eom, fauxURL)
runtime.ReadMemStats(&ms2)
// Ensure that no fresh allocation was made.
if diff := ms2.HeapAlloc - ms1.HeapAlloc; diff > 0 {
t.Errorf("Unexpected allocation of %d bytes", diff)
if ms2.HeapAlloc > ms1.HeapAlloc {
// In some cases, `ms1.HeapAlloc` is larger than `ms2.HeapAlloc`.
// It is probably because the gc worked.
t.Errorf("Unexpected allocation of %d bytes", ms2.HeapAlloc - ms1.HeapAlloc)
}
if err == nil {
t.Fatal("err wasn't returned")
Expand Down

0 comments on commit a4b7e3f

Please sign in to comment.