From 97ef3b9535e2486384f144474e8b7df64ff14716 Mon Sep 17 00:00:00 2001 From: Niek Otten Date: Wed, 22 Jul 2026 11:28:15 +0200 Subject: [PATCH] test(infra): acceptance check that make local completes the flow unseeded (refs #110) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds infra/run-local-flow-check.sh (+ `make verify-local`): submits a registration against a fresh local stack and asserts it opens a zaak, reaches the werkbak after documents, and appears in the openbaar register — all with no manual seeding. Fails today (ACL points at a placeholder zaaktype; the DMN is undeployed; no NRC abonnement is registered), covering the three S-B04 gaps. Co-Authored-By: Claude Opus 4.8 (1M context) --- Makefile | 7 +++- infra/run-local-flow-check.sh | 67 +++++++++++++++++++++++++++++++++++ 2 files changed, 73 insertions(+), 1 deletion(-) create mode 100755 infra/run-local-flow-check.sh diff --git a/Makefile b/Makefile index 40b9403..a0c22bc 100644 --- a/Makefile +++ b/Makefile @@ -43,7 +43,7 @@ export DOCKER_HOST := unix://$(PODMAN_SOCK) endif endif -.PHONY: ci lint build unit mutation frontend integration verify verify-up verify-acl verify-nrc verify-projection verify-bff verify-domain verify-notifications smoke up down local local-down changelog openzaak-up openzaak-smoke openzaak-seed openzaak-down stack-up stack-smoke stack-down keycloak-up keycloak-smoke keycloak-down flowable-up flowable-smoke flowable-down help +.PHONY: ci lint build unit mutation frontend integration verify verify-up verify-acl verify-nrc verify-projection verify-bff verify-domain verify-notifications smoke up down local verify-local local-down changelog openzaak-up openzaak-smoke openzaak-seed openzaak-down stack-up stack-smoke stack-down keycloak-up keycloak-smoke keycloak-down flowable-up flowable-smoke flowable-down help ## ci: run the full pipeline — lint, build, unit, mutation, frontend, verify (mirrors Gitea Actions) ## `verify` is the live-stack stage (full stack up once → ACL + notification checks). @@ -114,6 +114,11 @@ local: docker compose -f $(LOCAL_COMPOSE) up -d --build WAIT_TIMEOUT=420 bash infra/wait-healthy.sh $(WAIT_SVCS) +## verify-local: acceptance check for the local stack (S-B04) — a fresh `make local` completes the +## whole flow (zaaktype seeded + DMN deployed + NRC abonnement) with NO manual seeding. +verify-local: + bash infra/run-local-flow-check.sh + ## local-down: stop and remove the bind-mount stack local-down: docker compose -f $(LOCAL_COMPOSE) down --volumes diff --git a/infra/run-local-flow-check.sh b/infra/run-local-flow-check.sh new file mode 100755 index 0000000..bfbf0ab --- /dev/null +++ b/infra/run-local-flow-check.sh @@ -0,0 +1,67 @@ +#!/usr/bin/env bash +# +# Acceptance check for the local stack (S-B04, #110): a fresh `make local` must complete the whole +# flow with NO manual seeding. Run against an already-up local stack (infra/docker-compose.local.yml) +# via the host-published ports. It exercises, and thereby covers, the three bring-up gaps the slice +# fixes: +# +# 1. zaaktype seeded + ACL wired -> a submitted registration opens a zaak (zaakUrl gets filled). +# 2. diploma-eligibility DMN deployed -> providing documents completes WachtOpDocumenten, routes +# through the DMN, and the case lands on Beoordelen (visible in the behandel werkbak). +# 3. NRC abonnement registered -> the zaak shows up in the openbaar (public) register. +# +# Before the fix this fails at step 1 (ACL points at a placeholder zaaktype -> OpenZaak 400). +set -euo pipefail + +DOM=${DOM:-http://localhost:8130} # domain +BFF=${BFF:-http://localhost:8080} # bff (openbaar register) +BSN=${BSN:-123456782} +# A minimal, valid PDF, base64-encoded (the diploma upload). +PDF_B64="$(printf '%%PDF-1.4\n1 0 obj<>endobj\ntrailer<>\n%%%%EOF\n' | base64 | tr -d '\n')" + +echo ">> 1. submit a registration (no manual seeding expected)" +loc="$(curl -fsS -D - -o /dev/null -X POST "$DOM/registrations" \ + -H 'Content-Type: application/json' -d "{\"bsn\":\"$BSN\"}" \ + | sed -n 's/\r$//; s/^[Ll]ocation: //p' | head -1)" +[ -n "$loc" ] || { echo "FAIL: POST /registrations returned no Location" >&2; exit 1; } +id="${loc##*/}" +echo " accepted: $id" + +echo ">> 2. poll until the ACL opens the zaak (proves the zaaktype is seeded + wired)" +zaak="" +for _ in $(seq 1 30); do + zaak="$(curl -fsS "$DOM$loc" | python3 -c 'import sys,json;print(json.load(sys.stdin).get("zaakUrl") or "")' 2>/dev/null || true)" + [ -n "$zaak" ] && break + sleep 3 +done +[ -n "$zaak" ] || { echo "FAIL: zaak never opened — ACL zaaktype not wired (gap 1)" >&2; exit 1; } +echo " zaak opened: $zaak" + +echo ">> 3. provide documents (proves the diploma-eligibility DMN is deployed)" +code="$(curl -s -o /dev/null -w '%{http_code}' -X POST "$DOM/registrations/$id/documents" \ + -H 'Content-Type: application/json' \ + -d "{\"bsn\":\"$BSN\",\"contentBase64\":\"$PDF_B64\",\"fileName\":\"diploma.pdf\",\"contentType\":\"application/pdf\"}")" +[ "$code" = "204" ] || { echo "FAIL: provide documents -> $code (DMN missing routes WachtOpDocumenten to a 404 — gap 2)" >&2; exit 1; } +echo " documents accepted (204)" + +echo ">> 4. poll the werkbak until the registration awaits beoordeling (reached Beoordelen)" +in_werkbak="" +for _ in $(seq 1 20); do + in_werkbak="$(curl -fsS "$DOM/behandel/werkbak" | python3 -c "import sys,json;print(any(r.get('registrationId')=='$id' for r in json.load(sys.stdin)))" 2>/dev/null || true)" + [ "$in_werkbak" = "True" ] && break + sleep 3 +done +[ "$in_werkbak" = "True" ] || { echo "FAIL: registration never reached the werkbak (gap 2)" >&2; exit 1; } +echo " in the werkbak" + +echo ">> 5. poll the openbaar register until the reference is publicly visible (proves NRC abonnement)" +public="" +for _ in $(seq 1 30); do + public="$(curl -fsS "$BFF/openbaar/register" | python3 -c "import sys,json;print(any(r.get('reference')=='$id' for r in json.load(sys.stdin)))" 2>/dev/null || true)" + [ "$public" = "True" ] && break + sleep 3 +done +[ "$public" = "True" ] || { echo "FAIL: reference never appeared in the openbaar register — NRC abonnement not registered (gap 3)" >&2; exit 1; } +echo " visible in the openbaar register" + +echo "OK — a fresh local stack completed the flow with no manual seeding (zaaktype + DMN + abonnement)"