Skip to content

refactor(firmware): Inject dispatcher into BleOtaTransport#4339

Merged
jamesarich merged 1 commit into
mainfrom
fix/flaky-test
Jan 27, 2026
Merged

refactor(firmware): Inject dispatcher into BleOtaTransport#4339
jamesarich merged 1 commit into
mainfrom
fix/flaky-test

Conversation

@jamesarich

Copy link
Copy Markdown
Collaborator

This commit introduces dependency injection for the CoroutineDispatcher in BleOtaTransport. This change improves testability by allowing a TestDispatcher to be provided during unit tests, ensuring more reliable and deterministic test execution.

Key changes:

  • BleOtaTransport now accepts a CoroutineDispatcher in its constructor, defaulting to Dispatchers.Default.
  • The internal transportScope is now created using the injected dispatcher.
  • BleOtaTransportTest and BleOtaTransportMtuTest are updated to inject an UnconfinedTestDispatcher, and runTest is configured to use it.
  • The notificationFlow in BleOtaTransportTest is updated with extra buffer capacity to prevent a race condition in the test setup.

This commit introduces dependency injection for the `CoroutineDispatcher` in `BleOtaTransport`. This change improves testability by allowing a `TestDispatcher` to be provided during unit tests, ensuring more reliable and deterministic test execution.

Key changes:
- `BleOtaTransport` now accepts a `CoroutineDispatcher` in its constructor, defaulting to `Dispatchers.Default`.
- The internal `transportScope` is now created using the injected dispatcher.
- `BleOtaTransportTest` and `BleOtaTransportMtuTest` are updated to inject an `UnconfinedTestDispatcher`, and `runTest` is configured to use it.
- The `notificationFlow` in `BleOtaTransportTest` is updated with extra buffer capacity to prevent a race condition in the test setup.

Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
@github-actions github-actions Bot added the bugfix PR tag label Jan 27, 2026
@jamesarich jamesarich enabled auto-merge January 27, 2026 18:33
@codecov

codecov Bot commented Jan 27, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 0.00%. Comparing base (78c2a11) to head (ff08bbd).
⚠️ Report is 7 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@          Coverage Diff          @@
##            main   #4339   +/-   ##
=====================================
  Coverage   0.00%   0.00%           
=====================================
  Files          3       3           
  Lines         28      28           
  Branches       8       8           
=====================================
  Misses        28      28           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jamesarich jamesarich added this pull request to the merge queue Jan 27, 2026
github-merge-queue Bot pushed a commit that referenced this pull request Jan 27, 2026
Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jan 27, 2026
@jamesarich jamesarich added this pull request to the merge queue Jan 27, 2026
Merged via the queue into main with commit e2328ad Jan 27, 2026
11 checks passed
@jamesarich jamesarich deleted the fix/flaky-test branch January 27, 2026 21:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix PR tag

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant