v1 conformance tests guide (non-normative)
Synced from repo docs
This page is synced from docs/guides/v1-conformance-tests.md via docs/public-docs.json. Edit the owning repo source instead of this generated copy. GitHub source: https://github.com/byteor-systems/indexbus/blob/master/docs/guides/v1-conformance-tests.md
This guide describes how to validate IndexBus v1 behavior using a conformance-style test suite.
It is non-normative; the normative contract is the v1 spec.
- Spec: ../spec/v1-semantics.md
- Spec: ../spec/v1-failure-lifecycle.md
Goal
Provide a stable set of tests that:
- enforce the v1 behavioral contract,
- prevent accidental semantic drift,
- help independent implementations validate correctness.
Conformance style rules
These are the default constraints for v1 conformance tests:
- Prefer deterministic, in-process layouts and execution.
- Use local/in-process harnesses where possible.
- Avoid cross-process and network integration unless the spec item itself is explicitly about cross-process behavior.
- Keep assertions topology-based.
- Assert invariants that hold regardless of OS scheduling (ordering, boundedness, single-delivery, progress-after-consume).
- Do not assert fairness, latency, or timing-sensitive behavior.
What to test (mapping to spec)
Start with the "Conformance checklist" in the semantics spec and ensure each item has a runnable test.
Examples:
- SPSC FIFO ordering and
Fullbehavior. - MPSC per-producer ordering.
- Fanout broadcast partial delivery is permitted (and never violates per-consumer queue invariants).
- Fanout work-queue never delivers the same message to two consumers.
- Credits: no-credit consumers are skipped; park policies avoid dequeuing.
- State stream never returns a torn snapshot.
Appendix C checklist → tests
This table maps the semantics spec Appendix C items to concrete tests.
Notes:
- Some items are covered by unit tests in
src/tests.rs; others are covered by integration tests intests/. - Prefer adding new conformance coverage as integration tests to keep the mapping stable.
Known gaps (recommended next tests)
- Router loop: explicit “consumer queue full → drop (broadcast) / all-full drop (work-queue)” attribution semantics at the integration-test level (avoid relying on unit tests only).
Where to place tests
Recommended structure:
- Put core semantic tests near the implementation, e.g.
crates/indexbus-core/tests/. - Add end-to-end router loop tests under
crates/indexbus-route/tests/. - Prefer the local/in-process transport (
indexbus-transport-local) for deterministic tests.
Running tests
- Workspace tests:
cargo test - Per-crate:
cargo test -p indexbus-core
Performance safety
Conformance tests should avoid asserting micro-timing and should not require high-resolution timers. Prefer:
- deterministic topology,
- bounded loops,
- explicit yields/backoffs if needed.
What conformance does not guarantee
- It does not guarantee fairness.
- It does not guarantee durability or replay.
- It does not make best-effort observability counters exact.