Something went wrong. Try again.
xburner is an experimental HTTP and gRPC load generator written in Zig.
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101#!/bin/shset -eu
. "$(dirname "$0")/common.sh"xburner_init
TMP_DIR=$(xburner_mktemp_dir summary-golden)SERVER_LOG="${ROOT_DIR}/.zig-cache/summary-golden-server.log"
cleanup() { xburner_stop_background_pid "${SERVER_PID:-}" rm -rf "${TMP_DIR}"}
trap cleanup EXIT INT TERM
normalize_summary() { input_path=$1 output_path=$2
"${PYTHON_BIN}" - "$input_path" "$output_path" <<'PY'import jsonimport sys
input_path, output_path = sys.argv[1], sys.argv[2]with open(input_path, "r", encoding="utf-8") as f: data = json.load(f)
def keep(window): return { "requests_failed": window["requests_failed"], "iterations_failed": window["iterations_failed"], "dropped_iterations": window["dropped_iterations"], "transport_errors_total": window["transport_errors_total"], "transport_errors_timeout": window["transport_errors_timeout"], "transport_errors_connect_timeout": window["transport_errors_connect_timeout"], "transport_errors_io_timeout": window["transport_errors_io_timeout"], "script_errors_total": window["script_errors_total"], "script_timeouts_total": window["script_timeouts_total"], "hard_timeouts_total": window["hard_timeouts_total"], "poisoned_workers_total": window["poisoned_workers_total"], "vus_recreated_total": window["vus_recreated_total"], "unhealthy_vus_total": window["unhealthy_vus_total"], "spare_vus_activated_total": window["spare_vus_activated_total"], "request_summaries": [ { "name": item["name"], "summary": { "requests_failed": item["summary"]["requests_failed"], "transport_errors_total": item["summary"]["transport_errors_total"], "transport_errors_timeout": item["summary"]["transport_errors_timeout"], "transport_errors_connect_timeout": item["summary"]["transport_errors_connect_timeout"], "transport_errors_io_timeout": item["summary"]["transport_errors_io_timeout"], }, } for item in window.get("request_summaries", []) ], }
normalized = { "schema_version": data["schema_version"], "scenario_name": data["scenario_name"], "scenario_mode": data["scenario_mode"], "wasm_backend": data["wasm_backend"], "interrupted": data["interrupted"], "thresholds_failed": data["thresholds_failed"], "measured": keep(data["measured"]), "warmup": keep(data["warmup"]),}
with open(output_path, "w", encoding="utf-8") as f: json.dump(normalized, f, separators=(",", ":")) f.write("\n")PY}
compare_fixture() { fixture_path=$1 actual_path=$2 xburner_compare_fixture "summary golden mismatch" "${fixture_path}" "${actual_path}"}
xburner_build_if_neededxburner_build_workflow_sample_if_neededxburner_start_combined_fixture_servers "${SERVER_LOG}"
"${XBURNER_BIN}" run "${ROOT_DIR}/samples/simple-healthcheck.toml" > "${TMP_DIR}/simple_run.json"normalize_summary "${TMP_DIR}/simple_run.json" "${TMP_DIR}/simple_run.normalized.json"compare_fixture "${ROOT_DIR}/testdata/golden/simple_run_summary.json" \ "${TMP_DIR}/simple_run.normalized.json"
( cd "${ROOT_DIR}/samples" "${XBURNER_BIN}" run workflow-health.toml > "${TMP_DIR}/workflow_run.json")normalize_summary "${TMP_DIR}/workflow_run.json" "${TMP_DIR}/workflow_run.normalized.json"compare_fixture "${ROOT_DIR}/testdata/golden/workflow_run_summary.json" \ "${TMP_DIR}/workflow_run.normalized.json"
printf 'summary golden outputs match\n'