✅ server: improve test stability and ci error handling#778
Conversation
🦋 Changeset detectedLatest commit: e0df745 The changes in this PR will be included in the next version bump. This PR includes changesets to release 0 packagesWhen changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
WalkthroughRefactors test infra and workflows: adds a placeholder changeset, improves CI Maestro install retry and path selection, overhauls embedded Postgres and child-process lifecycle in tests with logging and AbortController-based teardown, updates tests to use concurrent/wait-for-state helpers, and makes spotlight teardown async with refined error handling. Changes
Sequence Diagram(s)sequenceDiagram
participant TestRunner as Test Runner
participant DBSetup as Database Setup
participant PG as Embedded Postgres
participant Firehose as Firehose Process
participant Substreams as Substreams Process
participant WaitHelpers as Wait Helpers
TestRunner->>DBSetup: start()
DBSetup->>PG: spawn Postgres
DBSetup->>Firehose: spawn firehose (with AbortController)
DBSetup->>Substreams: spawn substreams (with AbortController)
par readiness checks
DBSetup->>PG: wait for readiness file / TCP
DBSetup->>WaitHelpers: wait for eth TCP endpoint
DBSetup->>WaitHelpers: wait for substreams TCP endpoint
end
Firehose->>DBSetup: stdout/stderr streamed via watchProcessOutput
Substreams->>DBSetup: stdout/stderr streamed via watchProcessOutput
alt all ready
DBSetup->>TestRunner: return client + teardown
else timeout or error
DBSetup->>Firehose: abort/kill
DBSetup->>Substreams: abort/kill
DBSetup->>PG: terminate process
DBSetup->>TestRunner: fail with aggregated logs
end
TestRunner->>DBSetup: teardown()
DBSetup->>Firehose: graceful terminate
DBSetup->>Substreams: graceful terminate
DBSetup->>PG: close client & terminate
DBSetup-->>TestRunner: teardown complete
Estimated code review effort🎯 4 (Complex) | ⏱️ ~50 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
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 |
Summary of ChangesHello @cruzdanilo, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly improves the stability and diagnostic capabilities of the server's integration tests. By adding comprehensive error handling, detailed logging for external processes, and refining test waiting conditions, it aims to reduce flaky test failures and provide clearer insights into the root cause of issues, especially within continuous integration environments. Highlights
Changelog
Ignored Files
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request significantly improves test stability and CI error handling. The changes in server/test/database.ts introduce robust management of child processes with better logging and error reporting, which will be very helpful for debugging CI failures. The test logic in server/test/hooks/activity.test.ts is refactored to use more reliable waiting mechanisms, enhancing test stability. The teardown logic in server/test/spotlight.ts is also improved. Overall, these are excellent changes. I have a couple of minor suggestions to further refine the code.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5b8dfa75c1
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #778 +/- ##
==========================================
+ Coverage 68.90% 68.99% +0.08%
==========================================
Files 207 207
Lines 7015 7069 +54
Branches 2192 2218 +26
==========================================
+ Hits 4834 4877 +43
- Misses 2001 2003 +2
- Partials 180 189 +9
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Summary by CodeRabbit