-
Notifications
You must be signed in to change notification settings - Fork 182
chore: improve logging in RPC compare tests #6210
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughUpdated Docker Compose entrypoint scripts for Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant Entrypoint as Docker service entrypoint
participant Wrapper as shell wrapper script
participant Tool as api-compare
participant ReportFS as /data/... (mounted)
rect rgb(245,250,240)
Entrypoint->>Wrapper: start
Wrapper->>Wrapper: set -uxo pipefail
Wrapper->>Tool: run with --report-mode=failure-only --report-dir=/data/...
Tool-->>ReportFS: write full_report.json (if failures)
Tool-->>Wrapper: exit (status)
Wrapper->>Wrapper: capture status ($?)
Wrapper->>Entrypoint: print "==== API Compare Report ===="
Wrapper->>ReportFS: cat full_report.json (or print fallback)
Wrapper-->>Entrypoint: exit with recorded status
end
sequenceDiagram
autonumber
participant Runner as test harness
participant run_tests as function
rect rgb(250,245,255)
Runner->>run_tests: invoke
run_tests->>run_tests: execute tests, collect results
run_tests->>run_tests: print_summary() (now unconditional)
alt report_dir provided
run_tests->>Filesystem: save full report to report_dir
end
run_tests->>run_tests: evaluate has_failures and return/exit accordingly
run_tests-->>Runner: return status
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20–30 minutes
Suggested reviewers
Pre-merge checks and finishing touches✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (7)
Comment |
9e070be to
c67c576
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
scripts/tests/api_compare/docker-compose.yml (1)
242-243: Consider defensive handling for report file access (optional).The code assumes
/data/api-compare-report/full_report.jsonexists afterforest-tool api comparecompletes. If the file doesn't exist or becomes unreadable,catwill error to stderr but the script continues (no-eflag), potentially masking issues. Since this is test infrastructure, a minor enhancement for robustness:- status=$$? - echo "==== API Compare Report ====" - cat /data/api-compare-report/full_report.json + status=$$? + echo "==== API Compare Report ====" + cat /data/api-compare-report/full_report.json || echo "(Report file not accessible)"This ensures visible feedback if the report is unavailable, while still preserving the original exit code.
Also applies to: 245-249
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
scripts/tests/api_compare/docker-compose.yml(3 hunks)
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: LesnyRumcajs
PR: ChainSafe/forest#5907
File: src/rpc/methods/state.rs:523-570
Timestamp: 2025-08-06T15:44:33.467Z
Learning: LesnyRumcajs prefers to rely on BufWriter's Drop implementation for automatic flushing rather than explicit flush() calls in Forest codebase.
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (7)
- GitHub Check: tests
- GitHub Check: tests-release
- GitHub Check: Build MacOS
- GitHub Check: Build Ubuntu
- GitHub Check: cargo-publish-dry-run
- GitHub Check: Build forest binaries on Linux AMD64
- GitHub Check: All lint checks
🔇 Additional comments (2)
scripts/tests/api_compare/docker-compose.yml (2)
231-249: Shutdown bug fix and enhanced report logging look solid.Removing the
-eflag and explicitly capturing the exit status ensures the shutdown step runs even whenforest-tool api comparefails. This addresses the stated issue of Forest lingering in the background during offline checks. The report logging before shutdown is a nice addition for debugging.The strategy of capturing the original status and propagating it at the end is the right approach here.
275-289: Offline service follows the same solid pattern.The
api-compare-offlineservice mirrors theapi-comparechanges correctly, maintaining consistency across both test variants. The same considerations and optional improvements from the main service apply here.
3c137ed
Summary of changes
Changes introduced in this pull request:
set -ein case of a failure of the compare. This would make Forest run in background during the offline check, increasing memory usage of the entire setup.Reference issue to close (if applicable)
Closes
Other information and links
Change checklist
Summary by CodeRabbit
Chores
Tests