Skip to content

Commit

Permalink
Fix flaky TestQueryPremiumSamples test (#773)
Browse files Browse the repository at this point in the history
* De-tune exactness of return value check for TestQueryPremiumSamples to reduce test flakes.
  • Loading branch information
clemire authored Nov 8, 2023
1 parent 16d738f commit 365c8dc
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions protocol/x/perpetuals/client/cli/query_premiums_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,12 @@ func TestQueryPremiumSamples(t *testing.T) {

var resp types.QueryPremiumSamplesResponse
require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp))
require.Equal(t, types.PremiumStore{
AllMarketPremiums: []types.MarketPremiums{},
}, resp.PremiumSamples)

// In CI, we see that PremiumSamples may have NumPremiums set to a non-zero value. Waiting for a block height before
// the query does not reproduce this locally, so we just check that the response PremiumSamples are non-nil the rest
// of the struct is as expected.
require.NotNil(t, resp.PremiumSamples)
require.Len(t, resp.PremiumSamples.AllMarketPremiums, 0)
}

func TestQueryPremiumVotes(t *testing.T) {
Expand Down

0 comments on commit 365c8dc

Please sign in to comment.