fix(host-tests): speak TLS to the canonical conformance fake server #18
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/host-conformance-wss-fixture"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
fix(host-tests): speak TLS to the canonical conformance fake server
Why
Piece 3 (
computer) made the canonical fake realtime server TLS-only:FakeServer.__init__(ssl_context, ota_schedule=None)now takes a requiredSSLContext. The esp32 host suite loads that file by path, so oncecomputer'sdevelcarried piece 3, all six esp32 conformance tests died atfixture setup -- loudly, exactly as intended:
Before this branch: 152 passed, 6 errors. After: 158 passed.
What
The esp32 suite now pairs the fake server with an ephemeral, in-test
self-signed leaf and dials
wss://-- the same "test doubles mint their ownthrowaway certificate" rule the fleet TLS design states, never the shared
../.dev-trustset.host/tests/tls_certs.py(new): mint a two-day self-signed leaf withopenssland build the paired server/client contexts. Self-contained --this is the esp32-side counterpart of
computer/tests/tls_certs.py, not across-repo import.
host/tests/fake_server_fixture.py: session-scoped throwaway cert, passssl_context=toFakeServer, expose a client context that trusts it.host/tests/conftest.py:ws_urlis nowwss://...; re-export the certfixture.
host/tests/test_conformance.py: use the asyncio client, notwebsockets.sync.client.host/tests/requirements.txt:websockets>=13-- the harness importswebsockets.asyncio, which 12.0 does not provide.docs/conformance.md: say the harness is TLS-only.Why the asyncio client (and not the sync one)
The first cut of this branch used
websockets.sync.clientinwss://mode andturned the suite flaky (~1 in 6-10 runs). Measured on this host (Python
3.14, websockets 17.2), same server, same certificate, same conditions:
websockets.sync.clientwebsockets.connect(asyncio)Every failure is the client's opening handshake never completing --
TimeoutError: timed out while waiting for handshake responseafter the full10 s
open_timeout-- and instrumenting the server shows its handler neverran for that connection: the connection is never taken through the
handshake server-side. It is not root-caused to a definitive line, and it is
not resource exhaustion (at failure: 113 threads, 342 fds, cgroup pids 118 --
well inside limits). The asyncio client is clean over the same load, and it is
the pattern
computer/tests/conformancealready uses.Verification
Command (
host/tests):158 passedeach.Follow-up
Piece 2's Task 6 (the on-hardware dev-trust run) is still deferred; it is not
affected by this change.
Piece 3 (computer) made the canonical fake realtime server TLS-only: FakeServer.__init__ now requires an ssl.SSLContext, so the esp32 host conformance fixture failed at setup ("FakeServer.__init__() missing 1 required positional argument: 'ssl_context'") for all six conformance tests. Pair the server with a throwaway self-signed leaf and dial wss://. - host/tests/tls_certs.py: mint a two-day self-signed leaf with openssl and build the paired server/client contexts. Self-contained: this is the esp32-side copy of computer/tests/tls_certs.py, never a cross-repo import. - fake_server_fixture.py: session-scoped throwaway cert, pass ssl_context= to FakeServer, expose a client context that trusts it. - conftest.py: ws_url is now wss://; re-export the cert fixture. - test_conformance.py: use the asyncio client, not websockets.sync.client. Over this TLS harness the sync client intermittently (~5%) never receives the opening handshake response and dies with "timed out while waiting for handshake response" after the full open_timeout, while the asyncio client is clean over the same connections (180+ verified). It is also the pattern computer's own conformance suite uses. - requirements.txt: websockets>=13 -- the harness imports websockets.asyncio, which 12.0 does not provide. - docs/conformance.md: say the harness is TLS-only. Verified: host suite 158 passed across 8 consecutive full runs (was 152 passed + 6 errors before this change) and 30/30 conformance-only runs.