From c10e7e04e66ab55ad443ce7a76c1aca352375bdf Mon Sep 17 00:00:00 2001 From: Carl Niklas Rydberg Date: Sat, 7 Feb 2026 20:29:08 +0100 Subject: [PATCH] Add v2 end-to-end smoke test script --- README.md | 6 +++ scripts/smoke_v2.sh | 95 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 101 insertions(+) create mode 100755 scripts/smoke_v2.sh diff --git a/README.md b/README.md index 5fc727b..4da307a 100644 --- a/README.md +++ b/README.md @@ -58,6 +58,12 @@ Run integration coverage (requires running `amduatd` + `jq`): ./tests/integration_v2.sh ``` +Run a fast end-to-end smoke (startup + ingest + sync + retrieve + tombstone): + +```sh +./scripts/smoke_v2.sh +``` + ## Notes - This scaffold assumes local Unix-socket access to `amduatd`. diff --git a/scripts/smoke_v2.sh b/scripts/smoke_v2.sh new file mode 100755 index 0000000..f21bce4 --- /dev/null +++ b/scripts/smoke_v2.sh @@ -0,0 +1,95 @@ +#!/usr/bin/env bash +set -euo pipefail + +ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" +# Use an isolated cursor file so smoke runs do not mutate normal sync state. +export CURSOR_FILE="${ROOT_DIR}/.cursor.smoke.$$" +# shellcheck source=/dev/null +source "${ROOT_DIR}/src/app_v2.sh" + +require_jq() { + if ! command -v jq >/dev/null 2>&1; then + echo "smoke_v2.sh: jq is required" >&2 + exit 2 + fi +} + +fail() { + echo "smoke_v2.sh: FAIL: $1" >&2 + exit 1 +} + +step() { + echo "== $1 ==" +} + +cleanup() { + rm -f "${CURSOR_FILE}" >/dev/null 2>&1 || true +} +trap cleanup EXIT + +require_jq +app_init + +run_id="$(date +%s)" +idempotency_key="smoke-seed-${run_id}" +doc_name="smoke-doc-${run_id}" +topic_name="smoke-topic-${run_id}" +goal_pred="ms.within_domain" + +step "startup" +startup_out="$(app_startup_checks)" || fail "startup checks failed" +printf '%s' "${startup_out}" | grep -q '"ok":true' || fail "readyz did not report ok=true" + +step "ingest" +payload="$(cat </dev/null || fail "tombstone call failed" +post_retrieve="$(app_retrieve_with_fallback "${doc_name}" "${goal_pred}")" || fail "post-tombstone retrieve failed" +post_edges_count="$(printf '%s' "${post_retrieve}" | jq '.edges | length')" +[[ "${post_edges_count}" == "0" ]] || fail "tombstoned edge still visible in default retrieval" + +amduat_api_call GET "/v2/graph/subgraph?roots[]=${doc_name}&max_depth=2&dir=outgoing&limit_nodes=200&limit_edges=400&include_tombstoned=true&max_result_bytes=1048576" || fail "include_tombstoned subgraph failed" +visible_out="${AMDUAT_LAST_BODY}" +visible_has_edge="$(printf '%s' "${visible_out}" | jq --arg edge_ref "${edge_ref}" '[.edges[] | select(.edge_ref == $edge_ref)] | length')" +[[ "${visible_has_edge}" != "0" ]] || fail "tombstoned edge not visible with include_tombstoned=true" + +echo "smoke_v2.sh: PASS"