Skip to main content

Module testkit

Module testkit 

Source
Expand description

Stream testing probes built on Datum’s normal runtime.

The testkit is always available instead of feature-gated: it has no extra dependencies, adds no alternate execution path, and later parity work packages need it in ordinary crate tests to validate stream semantics.

Probe semantics follow Datum’s real pull-based runtime rather than Akka’s push + batched-request model. In particular, terminal signals are observed only when downstream performs a pull, so TestSubscriberProbe::expect_complete and TestSubscriberProbe::expect_error require an outstanding credit. For empty or immediately failed sources, the expected pattern is request(1) and then expect_complete() / expect_error(). The testkit intentionally does not issue speculative pulls on behalf of the test, because that would consume elements the test never requested.

Likewise, TestSubscriberProbe::cancel is cooperative with the pull loop: cancellation is noticed at the worker’s next credit wait. If the worker is currently blocked inside upstream next(), it unblocks when upstream yields or when the upstream probe is dropped. TestPublisherProbe::drop fails open streams, so in probe-driven tests any such stall is bounded by the test’s lifetime rather than leaking indefinitely.

Structs§

TestPublisherProbe
TestSink
TestSource
TestSubscriberProbe

Functions§

assert_next_eq
assert_next_n_eq