Skip to content

Latest commit

 

History

History
42 lines (34 loc) · 1.85 KB

testing.md

File metadata and controls

42 lines (34 loc) · 1.85 KB

Testing

Unit tests cover the filter, NACK tracker, egress, and frame-decode paths:

make test

The E2E suite (test/run-e2e.sh) starts a listener instance, injects frames as unicast UDP directly to the listener's bound port, and verifies delivery via a sink-test-frames sink. Five scenarios are exercised sequentially:

  1. Basic delivery: all frames forwarded; verified by sink count and bsl_frames_forwarded_total Prometheus metric.
  2. Shard filter: -shard-include 0 passes only the group-0 frame.
  3. Strip-header: on by default, forwards raw payload bytes (the BSV tx); -strip-header=false forwards the full frame. Sink counts raw datagrams.
  4. BRC-130 fragmentation: fragmented payloads are reassembled and delivered.
  5. Reference lane: -lane-tx, -lane-header and -lane-block to three TCP sinks (sink-test-frames -tcp -bytes N). Transaction payloads reach the tx lane, each block announce puts its 80-byte header on the header lane, and announces with no whole block are dropped from the block lane as not_strippable; verified by sink byte counts and the bsl_lane_* metrics.

sink-test-frames (cmd/sink-test-frames) listens on 127.0.0.1:-port (default 9102). Over UDP it counts decoded frames, or raw datagrams with -raw, and exits 0 at -count; with -tcp -bytes N it accepts TCP connections and exits 0 once N bytes have arrived. It exits 1 if -timeout (default 30s) passes first. Both targets must be positive to complete: at the default -count 0, or -bytes 0, it runs until the timeout (exit 1), or forever with -timeout 0.

The suite requires shard-proxy checked out at ../shard-proxy (for send-test-frames). make test-e2e builds all binaries fresh before running:

make test-e2e

See also architecture.md#testing for why unicast injection works.