fix: Flaky test with the FeeEstimationQuery e2e test#2276
Conversation
Signed-off-by: Manish Dait <daitmanish88@gmail.com>
Signed-off-by: Manish Dait <daitmanish88@gmail.com>
Signed-off-by: Manish Dait <daitmanish88@gmail.com>
Signed-off-by: Manish Dait <daitmanish88@gmail.com>
Signed-off-by: Manish Dait <daitmanish88@gmail.com>
Signed-off-by: Manish Dait <daitmanish88@gmail.com>
Signed-off-by: Manish Dait <daitmanish88@gmail.com>
Signed-off-by: Manish Dait <daitmanish88@gmail.com>
508b96f to
668efdf
Compare
WalkthroughFee estimation query integration tests now wait for the mirror-node FeeEstimationService to become ready before execution. Module-level globals track polling state, a readiness helper probes with an intrinsic fee transaction until success or timeout, and a synchronization helper adds fixed delay. All four test variants invoke these helpers consistently. ChangesFee Estimation Readiness Polling
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
tests/integration/fee_estimate_query_e2e_test.py (1)
81-83:⚠️ Potential issue | 🟠 Major | ⚡ Quick winStrengthen assertions to validate result structure and content.
All four tests only assert
result is not None, which doesn't validate the actual fee estimation response. Integration tests should verify observable network behavior beyond success/failure.Consider asserting on the result's structure and content:
- Does
resultcontain fee amounts (node, network, service fees)?- Are the returned fees reasonable (positive values, within expected ranges)?
- For chunked transactions, do the fees reflect the chunk count?
💪 Example of stronger assertions
query = FeeEstimateQuery().set_transaction(tx) result = query.execute(env.client) assert result is not None +assert result.node_fee is not None and result.node_fee.to_tinybars() > 0 +assert result.network_fee is not None and result.network_fee.to_tinybars() > 0 +assert result.service_fee is not None and result.service_fee.to_tinybars() >= 0(Adjust field names based on actual
FeeEstimateQueryresult structure)As per coding guidelines: "Tests must assert observable network behavior, not just
SUCCESS" and "Validate resulting balances, ownership, and state changes (not just transaction success)."Also applies to: 96-98, 112-114, 130-132
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 4a709e65-3029-40cc-920f-de8516c992bf
📒 Files selected for processing (1)
tests/integration/fee_estimate_query_e2e_test.py
aceppaluni
left a comment
There was a problem hiding this comment.
@manishdait Thank you for fixing the flakiness of the tests.
Questions addressed in DM in discord.
Signed-off-by: Manish Dait <daitmanish88@gmail.com>
Description:
This PR addresses flaky failures in the integration test with
FeeEstimateQuerywould fail because theFeeEstimationServicehad not yet started after a fresh Hiero Solo Mirror Node start.Changes Made:
wait_for_fee_estimation_service_readyto probe the service using anINTRINSICmode query. This ensures the service is actually functional before the test suite proceeds.Related issue(s):
Fixes #2275
Notes for reviewer:
Checklist