8000 fix(workspace): isolate host and device integration test roots by shroominic · Pull Request #141 · shroominic/OpenGlucose · GitHub
[go: up one dir, main page]

Skip to content

fix(workspace): isolate host and device integration test roots - #141

Closed
shroominic wants to merge 1 commit into
mainfrom
fix/workspace-test-integration-runner
Closed

shroominic wants to merge 1 commit into
mainfrom
fix/workspace-test-integration-runner

Conversation

@shroominic
Copy link
Copy Markdown
Owner

Fixes #140.

What was wrong

scripts/flutter-workspace.sh collected test/integration/* and
integration_test/* into one argument list and handed both to a single
flutter test call. Flutter rejects that mix, so make test-integration exited
2 on any tree that contains an openhealth/integration_test/ directory:

==> openhealth: discovered integration tests
  integration_test/runner_repro_test.dart
  test/integration/demo_lifecycle_test.dart
Integration tests and unit tests cannot be run in a single invocation. Use separate invocations of `flutter test` to run integration tests and unit tests.

The runner is unchanged from main; the target only went red once the sensor
lanes added the device-backed root.

What changed

Two lanes, discovered and run separately:

  • Host lane: test/integration/* plus tag-marked files, unchanged behaviour.
    Plain Dart packages keep integration_test/* as an ordinary test root, since
    the device concept only exists for Flutter projects.
  • Device lane: integration_test/* in its own flutter test invocation. Those
    harnesses are device-backed, so they run with --device-id <id> when
    FLUTTER_TEST_DEVICE_ID is set, and are otherwise reported as deferred next
    to the variable that enables them. A host without a device no longer fails
    closed on a lane it cannot run.

Decision recorded (non-blocking)

The defect is that one invocation mixed the roots. The minimal correct
equivalent has to also stop a device-less host from treating device-backed
harnesses as runnable: with only the split, make test-integration would move
from "mixed invocation" to "no device found" and CI would stay red for the same
trees. The device lane is therefore explicit and opt-in through
FLUTTER_TEST_DEVICE_ID, and it never goes quiet: the deferral message names
each file and the knob. CI (ubuntu-latest, no hardware) is green; a developer
with a phone runs the same target with the variable set.

Tests

New scripts/test-workspace-integration-runner.rb drives the real script
against a fixture repository with stubbed Flutter tooling, so it runs anywhere.
It was written first and failed against the unmodified script (the stub recorded
flutter test --no-pub integration_test/device_test.dart test/integration/demo_test.dart);
it passes after the change. It pins: no invocation mixes the roots, the host
lane runs exactly once, the device lane is deferred without
FLUTTER_TEST_DEVICE_ID, the device lane targets the named device when it is
set, host-only trees keep the single-invocation shape, and the existing
nothing-found diagnostic still fails closed. It runs from make tooling-check.

Verification (this branch, plus a throwaway integration_test/ fixture)

Command Result
make test-integration (both roots present) exit 0: host lane All tests passed!, device lane deferred with the enabling variable named
make test-integration (fixture removed, as on main) exit 0
make test-unit exit 0 (cgm_core 123, cgm_ble 4, cgm_ble_flutter 21, cgm_aidex 79, openhealth 285)
make lint exit 0, no issues in any project
make format-check exit 0, 0 changed
make tooling-check exit 0: pinned ShellCheck, actionlint, and all Ruby contract checks, including the new one

Impact

Unblocks the red make test-integration CI on the sensor aggregates #128
(release/v0.3.0) and #139 (release/v0.4.0), and on any lane that adds
8000 openhealth/integration_test/. No lane branch is modified by this PR.

`make test-integration` handed `test/integration/*` and `integration_test/*`
to one `flutter test` call, which Flutter rejects:

  Integration tests and unit tests cannot be run in a single invocation.

The two roots now run as separate lanes. The host lane keeps its behaviour
(`test/integration/*` plus tag-marked files, and `integration_test/*` for plain
Dart packages). The device lane runs `integration_test/*` in its own
invocation and only against hardware named by `FLUTTER_TEST_DEVICE_ID`;
otherwise it reports the deferred files and the knob that enables them, so a
host without a device stays green instead of failing closed on a lane it
cannot run.

Adds scripts/test-workspace-integration-runner.rb, which drives the real
script against a fixture repository with stubbed Flutter tooling and pins the
lane split, the deferral notice, the device-id plumbing, and the existing
nothing-found diagnostic. The check runs from `make tooling-check`.
@shroominic
Copy link
Copy Markdown
Owner Author

Carried by the GS1 consolidation in PR #209 (branch feature/cbio-gs1, head 3eca4f4).

This PR is contained in the consolidated line; the merge that carries it is 5f41ba9.

Closing as subsumed by the consolidation - not as won't fix. The per-defect evidence stays in this thread, and the carrying commit above is where the change now lives.

@shroominic shroominic closed this Sep 18, 2026
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.

fix(workspace): make test-integration separates the host and device test roots

1 participant

0