Commit a91f97a
authored
test(e2e): assert backend dispatch matches workflow env on every lane (#1409)
* test(e2e): assert backend dispatch matches workflow env vars on every lane
Adds a single smoke test at tests/src/e2e/basic/test_backend_dispatch_smoke.py
that runs on all three e2e lanes (testcontainer, HAOS external, HAOS inaddon)
and asserts ha_container_with_fresh_config["backend"] matches what the
HAOS_TEST_IMAGE_PATH and HAOS_TEST_MODE env vars imply.
Lane → expected backend:
e2e-tests.yml (testcontainer): container
haos-e2e-tests.yml (external): haos
haos-e2e-inaddon-tests.yml: haos_inaddon
Silent-failure modes this catches (would have left previous CI green):
- HAOS_TEST_IMAGE_PATH set but conftest falls through to testcontainer
(the lane is unknowingly testing the wrong HA instance)
- HAOS_TEST_MODE=inaddon ignored, inaddon lane silently runs external
dispatch — the addon integration is never actually exercised
- haos_inaddon backend reached but addon_mcp_url missing, leaving
mcp_client fixtures pointing at the wrong endpoint
Placed under basic/ (NOT haos_only/) on purpose: the auto-applied
haos_only marker would skip the test when is_haos_backend_selected()
returns False, which is exactly the silent-failure case we want to
catch. basic/ has no auto-applied markers so the test runs everywhere.
* test(e2e): add behavioral cross-check + collection floor to dispatch smoke
The original smoke test (test_backend_dispatch_matches_workflow_env) only
asserted the ``backend`` field that conftest sets. That guards against
the dispatch picking the wrong code path, but it can't catch the case
where conftest reports backend=X while a different HA instance is
actually running.
Adds two layered guards:
- test_supervisor_addon_tool_behavior_matches_backend: calls
ha_get_addon (which only works when a real Supervisor is running) and
asserts success-vs-failure matches the claimed backend.
- HAOS external + inaddon: tool returns success=True with non-empty
addons list (the bake installs Node-RED, ESPHome, etc.)
- testcontainer: tool returns success=False because no Supervisor
proxy exists (RESOURCE_NOT_FOUND from supervisor/api WebSocket call)
The asymmetry makes it impossible for one backend to impersonate the
other while keeping the test green — exactly the "goes both ways"
guarantee.
- test_session_collected_test_count_above_floor: asserts
request.session.items length >= 850 (current baseline is ~913 across
all lanes). Catches collection-time regressions where a test file
fails to import and pytest silently drops tens of tests, leaving the
suite green with reduced coverage.
All three tests stay under basic/ (no auto-applied haos_only marker)
so they run unconditionally on every lane.
* test(e2e): add per-lane skip-count ceiling + tighten dispatch smoke docstrings
Addresses the gap surfaced by pr-test-analyzer review: none of the three
existing dispatch smoke tests catch the "tests transition pass → skip
silently" failure mode. The conftest itself documents a real prior
incident of this class at tests/src/e2e/conftest.py:158-166 (PR #1375
audit, 14 supervisor_mock tests silently skipping on every testcontainer
run because an external_only marker was scoped wrong).
Adds:
- test_session_skipped_count_below_ceiling: counts items with skip
markers in request.session.items and asserts the count stays below
a per-lane ceiling. Baseline 2026-05-22: container=46, haos=14,
haos_inaddon=22. Ceilings set 5-9 above current to absorb normal
marker-gated additions without flapping, while still catching a
~10+ test mass-skip incident.
Also tightens three docstrings flagged by the comment-analyzer review:
- Test 1 docstring now notes test-side env check is an approximation
of conftest's is_haos_backend_selected (which also checks path
existence), and explains why the test deliberately doesn't share
the helper.
- Test 2 docstring is precise about the failure path on testcontainer
(raises ToolError → safe_call_tool decodes to success=False) and
flags the dict-conversion as load-bearing so a future maintainer
doesn't "simplify" to assert_mcp_failure.
- Test 3 docstring acknowledges the 3-test variance between container
(912) and HAOS (915) lanes rather than calling collection
"mode-independent."
* test(e2e): complete schema validation for all backend dispatch branches
Addresses Gemini review feedback on PR #1409. The dispatch smoke test
now asserts the full container_info schema on every branch:
- haos_inaddon: add ``port is None`` and ``config_path is None``
assertions (matching the external branch's coverage).
- container: add ``config_path is not None`` and
``.get('addon_mcp_url') is None`` assertions.
The container-branch ``addon_mcp_url`` assertion uses ``.get()`` instead
of bracket access because the container fixture dict at
conftest.py:1698-1706 does NOT include an ``addon_mcp_url`` key — only
the HAOS branches do. Inline comment notes the asymmetry.
---------
Co-authored-by: kingpanther13 <kingpanther13@users.noreply.github.com>1 parent 5de1d6e commit a91f97a
1 file changed
Lines changed: 239 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
0 commit comments