diff --git a/tests/e2e/e2e_oracle_test.go b/tests/e2e/e2e_oracle_test.go index 821bda1158..b4fed8d9bd 100644 --- a/tests/e2e/e2e_oracle_test.go +++ b/tests/e2e/e2e_oracle_test.go @@ -4,8 +4,40 @@ import ( "time" "github.com/umee-network/umee/v6/tests/grpc" + leveragetypes "github.com/umee-network/umee/v6/x/leverage/types" ) +// TestAllPrices wairs for all tokens in the leverage registry to have prices. +func (s *E2ETest) TestAllPrices() { + tokens := []leveragetypes.Token{} + s.Require().Eventually( + func() bool { + var err error + tokens, err = s.QueryRegisteredTokens(s.UmeeREST()) + if err != nil { + return false + } + return true + }, + time.Minute, time.Second, "get registered tokens", + ) + s.Require().Eventually( + func() bool { + exchangeRates, err := s.QueryExchangeRate(s.UmeeREST(), "") + if err != nil { + return false + } + for _, t := range tokens { + if exchangeRates.AmountOf(t.SymbolDenom).IsZero() { + return false + } + } + return true + }, + time.Minute, time.Second, "ensure all tokens have prices", + ) +} + // TestMedians queries for the oracle params, collects historical // prices based on those params, checks that the stored medians and // medians deviations are correct, updates the oracle params with diff --git a/tests/e2e/setup/utils.go b/tests/e2e/setup/utils.go index ada0b79daf..b1636b088f 100644 --- a/tests/e2e/setup/utils.go +++ b/tests/e2e/setup/utils.go @@ -23,6 +23,7 @@ import ( appparams "github.com/umee-network/umee/v6/app/params" "github.com/umee-network/umee/v6/client" + leveragetypes "github.com/umee-network/umee/v6/x/leverage/types" oracletypes "github.com/umee-network/umee/v6/x/oracle/types" "github.com/umee-network/umee/v6/x/uibc" ) @@ -207,6 +208,16 @@ func (s *E2ETestSuite) QueryExchangeRate(endpoint, denom string) (sdk.DecCoins, return resp.ExchangeRates, nil } +func (s *E2ETestSuite) QueryRegisteredTokens(endpoint string) ([]leveragetypes.Token, error) { + endpoint = fmt.Sprintf("%s/umee/leverage/v1/registered_tokens", endpoint) + var resp leveragetypes.QueryRegisteredTokensResponse + if err := s.QueryREST(endpoint, &resp); err != nil { + return nil, err + } + + return resp.Registry, nil +} + func (s *E2ETestSuite) QueryHistAvgPrice(endpoint, denom string) (sdk.Dec, error) { endpoint = fmt.Sprintf("%s/umee/historacle/v1/avg_price/%s", endpoint, strings.ToUpper(denom)) var resp oracletypes.QueryAvgPriceResponse