Skip to content

M7: the conformance suite, and the C1–C15 checklist - #45

Merged
merlimat merged 1 commit into
mainfrom
m7-conformance
Nov 23, 2026
Merged

merlimat merged 1 commit into
mainfrom
m7-conformance

Conversation

@merlimat

Copy link
Copy Markdown
Contributor

The spec's test guidance (conformance §5) as a named suite, as docs/8-quality.md §2.2 plans it: routing vectors, a split or merge during active produce and consume, a broker failover, cumulative ack across segments, and checkpoint round trips across a layout change. This is one of M7's two checks (PLAN.md); tests/PORTING.md follows in its own PR.

tests/conformance/README.md does two things:

  • It describes each case for any SDK, so other SDKs can run the same cases later: the environment it needs, what it sets up, does, and passes on.
  • It lists, for each of C1–C15 (conformance §2), the tests that show this client meets it, by layer.

The cases against a 5.0.1 broker are integration trials named conformance::<id>:

cargo test -p apache-pulsar --test integration conformance::

Reused tests

Where an existing test already covered a case, it moved into the suite's table rather than being written again:

Existing test Suite case
keys_keep_their_order_across_a_split conformance::split_during_produce
a_split_during_consumption_loses_no_message conformance::split_during_consume
a_partitioned_topic_routes_like_v4 conformance::legacy_routing
a_checkpoint_round_trips_with_java_across_layout_changes conformance::checkpoint_round_trip_across_layout_changes

The vector cases are the protocol crate's existing tests (routing_vectors, message_id_vectors, checkpoint_vectors).

New cases

  • routing_across_clients: the layout has five segments of two sizes (four, then one split). Rust's producer and Java's (a new RoutingTool.java) each send the same 128 keys. Each key lands in the same segment for both: the one whose range holds the key's hash in the layout get-metadata returns.
  • split_and_merge_under_load: a producer sends 16 keys without pause, with sends in flight, while a segment splits and its children merge back. A Queue and a Stream consumer receive meanwhile. No send fails, the Queue consumer gets every message once from segments 0 to 4, and the Stream consumer gets every key in order.
  • failover_by_unload and failover_by_broker_restart: a producer with no send timeout, and a Queue, a Stream and a Checkpoint consumer, all active while the topic fails over. In the first, the namespace is unloaded; the test checks in the topic's stats that the producer registered again on both segments. In the second, the broker is killed and started again. No send fails, and each consumer gets every message; the Stream and Checkpoint consumers get each key in order. A message may come twice after a failover; only its first delivery is checked.
  • cumulative_ack_across_segments: a Stream consumer receives from two segments in turn. Its ack of the tenth message settles the nine before it on both segments and nothing after: the backlog shows it, and a new consumer gets exactly the rest. Then segment 0 splits with delivered, unacknowledged messages. The children's messages wait until the ack of a message from the other segment drains the sealed parent.

Harness

The broker restart can't share the broker with other tests, so cases in conformance::EXCLUSIVE run after the others, one at a time, in a second libtest-mimic run. Env::restart_broker kills the broker container and starts it again, then waits for brokers healthcheck. That takes about 5 s locally and 10 s in a full run.

Testing

  • The nine cases pass against 5.0.1: in two full integration runs (63 trials, then the exclusive one) and in three more runs of the suite alone.
  • cargo fmt, and clippy -D warnings with Rust 1.100 for the workspace. CI's clippy doesn't reach the integration target (test = false); with -A clippy::type_complexity, which every module's TESTS table trips, it is clean too.
  • No library code changes, so coverage is unaffected.

The spec's test guidance (conformance §5) as a named suite, as docs/8-quality.md §2.2 plans
it: routing vectors, a split or merge during active produce and consume, a broker failover,
cumulative ack across segments, and checkpoint round trips across a layout change.
tests/conformance/README.md describes each case for any SDK, and lists, for each of C1–C15,
the tests that show this client meets it.

The cases against a 5.0.1 broker are integration trials named conformance::<id>. Four
existing tests moved into the suite's table rather than being written again; the vector
cases are the protocol crate's tests. New cases: the same key to the same segment from Rust's
and Java's producers on a layout of uneven ranges (RoutingTool.java); a split and a merge
under load, with a Queue and a Stream consumer reading; a failover by namespace unload and
one by killing and restarting the broker, with a producer and the three consumers active; a
Stream consumer's cumulative ack settling what came before it on every segment, a sealed one
included, and nothing after.

The broker restart runs once the other trials are done, one at a time, in a second
libtest-mimic run: Env::restart_broker kills the broker container and starts it again.
@merlimat
merlimat merged commit d38dc55 into main Nov 23, 2026
14 checks passed
@merlimat
merlimat deleted the m7-conformance branch November 23, 2026 23:17
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