Skip to content

feat(moq-test-relay): add a test relay for client validation - #280

Open
nnazo wants to merge 6 commits into
cloudflare:mainfrom
nnazo:nnazo/test-relay
Open

nnazo wants to merge 6 commits into
cloudflare:mainfrom
nnazo:nnazo/test-relay

Conversation

@nnazo

@nnazo nnazo commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

Adds moq-test-relay, a relay that knows which interop test is running. It checks the client's messages from the relay side and reports one TAP result, following the test relay interface proposed in englishm/moq-interop-runner#149. It covers the eight catalog tests, including both variants of subscribe-before-announce, on WebTransport and raw QUIC.

Running it against moq-test-client found three client defects, fixed here as separate commits. Three namespace tests passed without the relay's answer. The nine T0 tests ended by dropping their sessions, which FINs the control stream (draft-18 section 3.3 forbids that) and sends no connection close; the data-plane and moq-test tests keep their current teardown. And the client rejected the catalog's names for three tests; it now accepts them as aliases, while --list and TAP output keep its own names.

Shared crates change in three places:

  • moq-transport: PublishedNamespace::closed_cause() tells a withdrawn namespace from a session teardown. closed() is unchanged.
  • moq-transport: PublishNamespace::ok() now returns Cancel when the request ends without any response; it used to return Ok. PublishNamespace::serve serves an accepted namespace, and publish_namespace uses it.
  • moq-native-ietf: Client::wait_idle() waits until closing connections have left the endpoint, so a process does not exit before its CONNECTION_CLOSE is sent.

Based on #278 which has required changes for this work.

A subscriber could not tell a withdrawn PUBLISH_NAMESPACE from a session
that simply ended. PublishedNamespace::closed() resolves the same way when
the peer cancels the request stream and when the stream task is dropped at
teardown.

Add PublishedNamespace::closed_cause(). It reports PeerCancelled, with the
stream error code, when the peer sent RESET_STREAM or STOP_SENDING, and
Teardown otherwise. A cancel followed at once by a session close still
reports the cancel. closed() and the wire behavior are unchanged. Nothing
calls it yet; moq-test-relay will use it to check that a client withdrew
its namespace.

remote: test-relay
Add moq-test-relay, a relay that knows which interop test is running. It
checks the client's messages from the relay side and reports one TAP
result, following the test relay interface in
englishm/moq-interop-runner#149. It covers the
eight catalog procedures, including both variants of
subscribe-before-announce, on WebTransport and raw QUIC. It reports each
session's role, transport, negotiated version and initial connection ID.

After its verdict, the relay keeps serving until the client closes its
sessions or SIGTERM arrives, with a 60-second safety cap, so a client that
is still finishing is not cut off. Requests outside a test's procedure are
answered and recorded as TAP comments without failing the test. Closing
the control stream breaks draft 18 Section 3.3; the relay tolerates it only
after the session has finished its steps and is then closed gracefully.

remote: test-relay
… accepted

PublishNamespace::ok() returned Ok when the request ended without any
response, so a caller of Publisher::publish_namespace_start could read a
dropped request as acceptance. It returns Cancel instead.

Add PublishNamespace::serve, which serves the handle's SUBSCRIBE and
TRACK_STATUS requests until the namespace ends. A caller can await ok()
and then serve the namespace without copying the serving loop.
publish_namespace now calls publish_namespace_start and then serve, with
no change in behavior.

remote: test-relay
The interop catalog calls three tests announce-only, announce-subscribe
and subscribe-before-announce, and this client calls them
publish-namespace-only, publish-namespace-subscribe and
subscribe-before-publish-namespace. With TESTCASE set to a catalog name,
the client exited 2. Accept the catalog names as aliases in --test and
TESTCASE. --list and the TAP output keep the client's own names.

remote: test-relay
Closing a raw QUIC connection returns before CONNECTION_CLOSE leaves the
endpoint. A process that exits straight after closing can leave its peer
waiting for an idle timeout. Add Client::wait_idle, which waits until the
endpoint's connections have finished closing. Nothing calls it yet;
moq-test-client will use it when a test ends.

remote: test-relay
@nnazo
nnazo changed the base branch from draft-18-dev to main November 14, 2026 21:03
…fully

Three scenarios passed without the relay's answer. publish-namespace-only
and publish-namespace-done treated two seconds without an error as
REQUEST_OK. publish-namespace-subscribe sent SUBSCRIBE without waiting for
the publisher's REQUEST_OK, and counted an error or its timeout as
success. They now wait for REQUEST_OK, and the routing scenario passes
only on SUBSCRIBE_OK.

The nine T0 scenarios ended by dropping their sessions. That FINs the
control stream, which draft 18 Section 3.3 forbids during a session, and
no connection close reached the relay. They now close their sessions
with code 0 while the session driver still owns the control stream, and
wait up to two seconds for the close to leave. The data-* and moq-test-*
scenarios keep their current teardown. publish-namespace-done waits
100 ms after cancelling its request, because closing a raw QUIC
connection at once can discard the cancellation.

remote: test-relay
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.

1 participant