Expand description
§faucet-conformance
A reusable test battery that any faucet connector can call from its own
tests/ to prove it upholds the connector contract. Passing this battery is
the Tier-1 criterion for a connector — there is no separate tiering
scheme; a connector is “supported” exactly when it invokes and passes these
checks in CI.
use faucet_conformance as conf;
let source = /* your Source */
conf::assert_config_schema_valid(&source);
conf::assert_bounded_memory(&source, 100, 1000).await;All six checks are fully implemented:
assert_config_schema_valid— the config schema is a valid JSON Schema.assert_bounded_memory— the source pages instead of buffering.assert_bookmark_roundtrip— an incremental source resumes from its bookmark rather than restarting.assert_idempotent_replay— re-delivering committed rows leaves no duplicates (atomic-watermark or keyed-upsert mechanism).assert_capabilities_truthful— advertised capabilities match real behaviour.assert_errors_not_panics— failures surface as a typedfaucet_core::FaucetError, never a panic.
Each check has both a passing and a #[should_panic] failing test in this
crate — a check that cannot fail is worthless.
Modules§
- doubles
- Synthetic
Source/Sinkdoubles the battery drives (and that connector authors can reuse in their own tests).
Traits§
- HasConfig
Schema - Anything that can expose a config JSON Schema + a label — blanket-implemented
for every
Sourcesoassert_config_schema_validaccepts a source directly. (Sinks can be checked viaassert_config_schema_valid_value.)
Functions§
- assert_
bookmark_ roundtrip - Check 3. Drive an incremental source to completion, capture the bookmark
it emits, feed it back via
apply_start_bookmark, and assert the second run resumes after that point — strictly fewer records reappear (zero for a fully-consumed static source). - assert_
bounded_ memory - Check 2. Drive
stream_pagesover a source that yieldstotalrecords and assert the consumer never holds more than ~batch_sizerecords live at once (i.e. the source pages instead of buffering everything). - assert_
capabilities_ truthful - Check 5. Assert a sink’s advertised capabilities match real behaviour:
- assert_
config_ schema_ valid - Check 1. Assert the connector’s
config_schema()is a structurally valid JSON Schema that round-trips throughserde_json. - assert_
config_ schema_ valid_ value - The value-level core of
assert_config_schema_valid— usable for sinks:assert_config_schema_valid_value(&sink.config_schema(), sink.connector_name()). - assert_
errors_ not_ panics - Check 6. Drive a source configured to fail (unreachable endpoint / bad
config) and assert it surfaces a typed
faucet_core::FaucetErrorwithout unwinding. Catches any panic and re-raises it as a check failure, so a connector thatunwrap()s on bad input is caught rather than crashing the test process silently. - assert_
idempotent_ replay - Check 4. Assert re-delivering already-committed rows leaves no duplicates in the destination — the trust-critical effectively-once check.