Skip to content

Latest commit

 

History

History
127 lines (97 loc) · 4.76 KB

quickstart.md

File metadata and controls

127 lines (97 loc) · 4.76 KB

Quickstart

This guide records an HTTP request, validates the fixture, replays it offline, and shows how to compare against a live service. It assumes the eggreplay CLI is installed, plus Python 3 and curl for the local example.

JSON and JUnit results go to stdout. Operational logs and diagnostics go to stderr.

Start an origin and record a request

In terminal 1, create a response file, start a local origin in the background, and run the recorder. Keep using this shell so ORIGIN_PID is available for cleanup.

mkdir -p eggr-quickstart
cd eggr-quickstart
printf '%s\n' '{"greeting":"hello"}' > api.json
python3 -m http.server 9100 --bind 127.0.0.1 &
ORIGIN_PID=$!
eggreplay record --listen 127.0.0.1:8080 \
  --upstream http://127.0.0.1:9100 --fixture demo.eggr

While the recorder runs, use terminal 2 to send a request through the gateway:

curl http://127.0.0.1:8080/api.json

Press Ctrl-C in terminal 1 to finalize the fixture. Recording publishes a fixture only after a clean shutdown, and a failed recording or shutdown removes its staging tree. Only a crash or SIGKILL can leave a hidden .incomplete-* directory; it is never reused or swept automatically. An existing path is never replaced unless you pass --overwrite, and then only when it is a valid fixture or an empty directory. Any other existing path is refused and left untouched.

A .eggr fixture is a directory containing a manifest, flow records, content-addressed body blobs, and any required extensions.

Validate and inspect

eggreplay validate --fixture demo.eggr --output json
eggreplay inspect --fixture demo.eggr --output json

validate checks fixture integrity without reading body blobs. inspect shows metadata. Add --bodies to read a bounded amount of body data or --websockets to inspect conversation metadata. Inspection never prints WebSocket message bytes. See the fixture schema guide for the on-disk format.

Replay offline

Stop the origin before starting the replay server. In terminal 1:

kill "$ORIGIN_PID"
wait "$ORIGIN_PID" 2>/dev/null || true
eggreplay serve --fixture demo.eggr --listen 127.0.0.1:9100

In terminal 2:

curl http://127.0.0.1:9100/api.json

The response comes from the fixture. Press Ctrl-C in terminal 1 to stop the server.

record and serve accept a routable --listen address only with the explicit --allow-non-loopback opt-in. There is no authentication on either listener: anyone who can reach it can consume the fixture or drive the upstream through the recorder, and TLS is not authentication. Keep the loopback default unless you have your own ingress controls.

A gateway recording stores the upstream authority it reached, so replay must use 127.0.0.1:9100 here, not the recorder's 8080 address. A request with a different Host does not match. Flows are consumed once by default, so a second identical request returns 409.

Compare against a live service

Start a candidate service at the recorded authority, then run test or replay:

eggreplay test --fixture demo.eggr \
  --target http://127.0.0.1:9100 --output junit

test exits 1 when there is a regression. replay produces the same typed report but exits 0 even when it contains findings. The default comparison suppresses Date values when the header is present on both sides and records the suppression in the report's suppressed list. If the header is missing on either side, its presence difference remains a finding.

To compare two existing fixtures without a network request, use diff:

eggreplay diff --baseline baseline.eggr --candidate candidate.eggr --output json

Replace the sample fixture names with paths that exist. diff never opens a socket. See the regression cookbook for schedulers, comparison options, and report fields.

Redaction and next steps

Recording can redact selected headers, query keys, and JSON/form fields before publishing any body bytes. Redacted request fields become matcher wildcards. Opaque binary data cannot be semantically redacted, so fixtures remain sensitive. See configuration for redaction options and limits.

Topic Guide
Every command and flag CLI and exit contracts
Matcher profiles and recording modes Configuration and matcher profiles
HAR import/export HAR interchange
HTTP/2 and gRPC support HTTP/2 support and gRPC views
Routes through Eggress Eggress routing
Proxy, CONNECT, and CA Interception threat model and CA and trust
Deliberate exclusions Non-goals