Skip to content

test: improve E2E test robustness and prevent orphaned emulators#94

Merged
kevmoo merged 2 commits intomainfrom
robust_e2e_test
Mar 27, 2026
Merged

test: improve E2E test robustness and prevent orphaned emulators#94
kevmoo merged 2 commits intomainfrom
robust_e2e_test

Conversation

@kevmoo
Copy link
Copy Markdown
Collaborator

@kevmoo kevmoo commented Mar 27, 2026

  • Converted eagerly evaluated late client variables to nullables in e2e_test.dart to prevent LateInitializationError from hijacking tearDownAll if setup fails.
  • Wrapped client disconnections in a try/finally block to guarantee the Firebase emulator is signaled to shut down regardless of client errors.
  • Added a try/catch block around _waitForReady checking during emulator startup to explicitly kill the underlying process if a timeout occurs.

- Converted eagerly evaluated `late` client variables to nullables in `e2e_test.dart` to prevent `LateInitializationError` from hijacking `tearDownAll` if setup fails.
- Wrapped client disconnections in a `try/finally` block to guarantee the Firebase emulator is signaled to shut down regardless of client errors.
- Added a `try/catch` block around `_waitForReady` checking during emulator startup to explicitly kill the underlying process if a timeout occurs.
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the E2E tests by replacing late variables with nullable types and adding error handling to the emulator startup and teardown processes. A try/finally block was introduced to ensure the emulator is stopped during cleanup. The review feedback suggests refining the teardown logic to call each client's close method independently, ensuring that a failure in one does not prevent others from being closed.

@kevmoo
Copy link
Copy Markdown
Collaborator Author

kevmoo commented Mar 27, 2026

/gemini review

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a TestClientBase abstract class to standardize HTTP client lifecycle management across E2E helper classes and refactors the main test suite to use nullable types for clients and the emulator. Feedback suggests improving code readability in setUpAll by using local non-nullable variables instead of repeated null assertions. Additionally, it is recommended to replace the fixed 2-second delay during emulator startup with a more deterministic readiness check to avoid potential test flakiness.

@kevmoo kevmoo merged commit 0f6d117 into main Mar 27, 2026
8 checks passed
@kevmoo kevmoo deleted the robust_e2e_test branch March 27, 2026 15:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants