test(oracle): add missing retry and price bounds test coverage#370
Merged
dev-jodee merged 8 commits intosolana-foundation:release/2.2.0from Mar 6, 2026
Merged
Conversation
…from oracle response
Contributor
Greptile SummaryThis PR adds 7 new tests across Key observations:
Confidence Score: 5/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant T as Test
participant R as RetryingPriceOracle
participant O as PriceOracle (Mock/Jupiter)
participant H as HTTP Server (mockito)
Note over T,H: empty_mints — short-circuit
T->>R: get_token_prices([])
R-->>T: Ok({})
Note over T,H: retries_all_fail — 3 attempts
T->>R: get_token_prices([mint])
R->>O: get_prices attempt 1
O-->>R: Err(RpcError)
R->>O: get_prices attempt 2
O-->>R: Err(RpcError)
R->>O: get_prices attempt 3
O-->>R: Err(RpcError)
R-->>T: Err(RpcError)
Note over T,H: retry_then_succeed — 2 attempts
T->>R: get_token_price(mint)
R->>O: get_prices attempt 1
O-->>R: Err(RpcError)
R->>O: get_prices attempt 2
O-->>R: Ok({mint: price})
R-->>T: Ok(TokenPrice)
Note over T,H: not_found — Ok but key missing
T->>R: get_token_price(missing)
R->>O: get_prices (1 call only)
O-->>R: Ok({}) no error no retry
R-->>T: Err(InternalServerError)
Note over T,H: rate_limit_429
T->>O: get_prices([mint])
O->>H: GET /price/v3
H-->>O: 429
O-->>T: Err(RateLimitExceeded)
Note over T,H: price_bounds validation
T->>O: get_prices([out_of_bounds_mint])
O->>H: GET /price/v3
H-->>O: 200 with extreme price
O->>O: validate SOL price — pass
O->>O: validate token price — fail
O-->>T: Err(RpcError bounds message)
Last reviewed commit: 28382cd |
|
✅ Fork external live tests passed. fork-external-live-pass:dff49cbf2337f92ba1aaa58668801ede98816bac |
dev-jodee
approved these changes
Mar 6, 2026
041c6b0
into
solana-foundation:release/2.2.0
11 of 12 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
RetryingPriceOracle and JupiterPriceOracle had several untested code paths
— adds 7 tests covering retry exhaustion, partial retry recovery, empty
mint short-circuit, missing mint error, HTTP 429 handling, and price
bounds validation (max/min).