test(infra): verify-domain drives the document wait + 30-day timeout live (refs #102)
Every registration now parks at WachtOpDocumenten first, so each existing block completes that task (documents received) before expecting Beoordelen/CBGVAdvies. Adds a timeout block: a registration whose documents never arrive has its P30D timer fired via the management-API move idiom, and the domain expires it to VERLOPEN. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -93,6 +93,27 @@ print(next((t['id'] for t in (d.get('data') or [])
|
|||||||
|
|
||||||
flcurl() { docker run --rm --network "$net" curlimages/curl:latest -fsS -u rest-admin:test "$@"; }
|
flcurl() { docker run --rm --network "$net" curlimages/curl:latest -fsS -u rest-admin:test "$@"; }
|
||||||
query='{"processDefinitionKey":"registratie","taskDefinitionKey":"Beoordelen","includeProcessVariables":true}'
|
query='{"processDefinitionKey":"registratie","taskDefinitionKey":"Beoordelen","includeProcessVariables":true}'
|
||||||
|
wacht_query='{"processDefinitionKey":"registratie","taskDefinitionKey":"WachtOpDocumenten","includeProcessVariables":true}'
|
||||||
|
|
||||||
|
# S-10a: every registration now parks at WachtOpDocumenten first (interrupting P30D timer). Completing
|
||||||
|
# that task stands in for the citizen's document upload (wired for real in S-10b), letting the process
|
||||||
|
# advance to the diploma routing / Beoordelen so the checks below still hold. The 30-day timeout branch
|
||||||
|
# is exercised separately at the end.
|
||||||
|
complete_wacht() { # reg_id
|
||||||
|
local rid="$1" wid="" r
|
||||||
|
for _ in $(seq 1 30); do
|
||||||
|
r="$(flcurl -X POST "$fl_base/query/tasks" -H 'Content-Type: application/json' -d "$wacht_query" 2>/dev/null || true)"
|
||||||
|
wid="$(printf '%s' "$r" | task_for_reg "$rid")"
|
||||||
|
[ -n "$wid" ] && break
|
||||||
|
sleep 2
|
||||||
|
done
|
||||||
|
[ -n "$wid" ] || { echo "FAIL — no WachtOpDocumenten task appeared for $rid" >&2; docker logs "$dom" 2>&1 | tail -15 >&2; exit 1; }
|
||||||
|
flcurl -X POST "$fl_base/runtime/tasks/$wid" -H 'Content-Type: application/json' -d '{"action":"complete"}' >/dev/null
|
||||||
|
echo ">> completed WachtOpDocumenten for $rid (documents received)"
|
||||||
|
}
|
||||||
|
|
||||||
|
echo ">> completing WachtOpDocumenten so the process advances (documents received)"
|
||||||
|
complete_wacht "$reg_id"
|
||||||
|
|
||||||
echo ">> polling Flowable for the Beoordelen user task (werkbak)"
|
echo ">> polling Flowable for the Beoordelen user task (werkbak)"
|
||||||
task_id=""
|
task_id=""
|
||||||
@@ -130,6 +151,7 @@ loc2="$(docker run --rm --network "$net" curlimages/curl:latest \
|
|||||||
[ -n "$loc2" ] || { echo "FAIL — second POST /registrations returned no Location" >&2; exit 1; }
|
[ -n "$loc2" ] || { echo "FAIL — second POST /registrations returned no Location" >&2; exit 1; }
|
||||||
reg_id2="${loc2##*/}"
|
reg_id2="${loc2##*/}"
|
||||||
echo ">> second registration $reg_id2"
|
echo ">> second registration $reg_id2"
|
||||||
|
complete_wacht "$reg_id2"
|
||||||
|
|
||||||
echo ">> polling Flowable for its Beoordelen task"
|
echo ">> polling Flowable for its Beoordelen task"
|
||||||
task_id2=""
|
task_id2=""
|
||||||
@@ -171,6 +193,7 @@ locf="$(docker run --rm --network "$net" curlimages/curl:latest \
|
|||||||
[ -n "$locf" ] || { echo "FAIL — foreign POST /registrations returned no Location" >&2; exit 1; }
|
[ -n "$locf" ] || { echo "FAIL — foreign POST /registrations returned no Location" >&2; exit 1; }
|
||||||
reg_idf="${locf##*/}"
|
reg_idf="${locf##*/}"
|
||||||
echo ">> foreign registration $reg_idf"
|
echo ">> foreign registration $reg_idf"
|
||||||
|
complete_wacht "$reg_idf"
|
||||||
|
|
||||||
echo ">> polling Flowable for its CBGV-advies task (foreign diplomas route here first)"
|
echo ">> polling Flowable for its CBGV-advies task (foreign diplomas route here first)"
|
||||||
cbgv_task=""
|
cbgv_task=""
|
||||||
@@ -241,6 +264,8 @@ except Exception:
|
|||||||
d={}
|
d={}
|
||||||
print(((d.get('data') or [{}])[0]).get('id',''))"; }
|
print(((d.get('data') or [{}])[0]).get('id',''))"; }
|
||||||
|
|
||||||
|
complete_wacht "$reg_id3"
|
||||||
|
|
||||||
echo ">> polling Flowable for its Beoordelen task"
|
echo ">> polling Flowable for its Beoordelen task"
|
||||||
task_id3=""; pid3=""
|
task_id3=""; pid3=""
|
||||||
for _ in $(seq 1 30); do
|
for _ in $(seq 1 30); do
|
||||||
@@ -278,4 +303,50 @@ for _ in $(seq 1 30); do
|
|||||||
done
|
done
|
||||||
[ -n "$escalated" ] || { echo "FAIL — Beoordelen task not reassigned to teamlead (candidate groups: '$groups')" >&2; docker logs "$dom" 2>&1 | tail -15 >&2; exit 1; }
|
[ -n "$escalated" ] || { echo "FAIL — Beoordelen task not reassigned to teamlead (candidate groups: '$groups')" >&2; docker logs "$dom" 2>&1 | tail -15 >&2; exit 1; }
|
||||||
echo "OK — the 14-day timer escalated the still-open Beoordelen task to the teamlead"
|
echo "OK — the 14-day timer escalated the still-open Beoordelen task to the teamlead"
|
||||||
|
|
||||||
|
# ── S-10a: document timeout. A registration parks at WachtOpDocumenten and — unlike every block above —
|
||||||
|
# its documents never arrive. We fire its 30-day boundary timer early via the management API; the
|
||||||
|
# INTERRUPTING timer cancels the wait and routes a token to the RegistratieVerlopen external task. The
|
||||||
|
# domain's timeout worker acquires it and expires the registration to VERLOPEN (ADR-0017). ────────────
|
||||||
|
echo ">> submitting a registration to let its document term lapse"
|
||||||
|
locv="$(docker run --rm --network "$net" curlimages/curl:latest \
|
||||||
|
-fsS -D - -o /dev/null -X POST "http://$dom_ip:8080/registrations" \
|
||||||
|
-H 'Content-Type: application/json' -d '{"bsn":"123456782"}' \
|
||||||
|
| sed -n 's/\r$//; s/^[Ll]ocation: //p' | head -1)"
|
||||||
|
[ -n "$locv" ] || { echo "FAIL — timeout POST /registrations returned no Location" >&2; exit 1; }
|
||||||
|
reg_idv="${locv##*/}"
|
||||||
|
echo ">> timeout registration $reg_idv"
|
||||||
|
|
||||||
|
echo ">> polling Flowable for its WachtOpDocumenten task"
|
||||||
|
wacht_id=""; pidv=""
|
||||||
|
for _ in $(seq 1 30); do
|
||||||
|
resp="$(flcurl -X POST "$fl_base/query/tasks" -H 'Content-Type: application/json' -d "$wacht_query" 2>/dev/null || true)"
|
||||||
|
read -r wacht_id pidv <<<"$(printf '%s' "$resp" | task_and_pid_for_reg "$reg_idv")"
|
||||||
|
[ -n "$wacht_id" ] && break
|
||||||
|
sleep 2
|
||||||
|
done
|
||||||
|
[ -n "$wacht_id" ] || { echo "FAIL — no WachtOpDocumenten task appeared for $reg_idv" >&2; docker logs "$dom" 2>&1 | tail -15 >&2; exit 1; }
|
||||||
|
echo ">> WachtOpDocumenten task $wacht_id (instance $pidv) is waiting for documents"
|
||||||
|
|
||||||
|
echo ">> firing the 30-day document timer early via the management API"
|
||||||
|
timer_idv="$(flcurl "$fl_base/management/timer-jobs?processInstanceId=$pidv" | first_job_id)"
|
||||||
|
[ -n "$timer_idv" ] || { echo "FAIL — no timer job found for instance $pidv" >&2; exit 1; }
|
||||||
|
# Move the timer job to an executable async job; the async executor fires the interrupting boundary
|
||||||
|
# event. It may run before we look, so executing it explicitly is a best-effort nudge (as for S-14).
|
||||||
|
flcurl -X POST "$fl_base/management/timer-jobs/$timer_idv" -H 'Content-Type: application/json' -d '{"action":"move"}' >/dev/null
|
||||||
|
async_idv="$(flcurl "$fl_base/management/jobs?processInstanceId=$pidv" 2>/dev/null | first_job_id || true)"
|
||||||
|
if [ -n "$async_idv" ]; then
|
||||||
|
flcurl -X POST "$fl_base/management/jobs/$async_idv" -H 'Content-Type: application/json' -d '{"action":"execute"}' >/dev/null 2>&1 || true
|
||||||
|
fi
|
||||||
|
echo ">> timer fired; the RegistratieVerlopen token is parked for the domain worker"
|
||||||
|
|
||||||
|
echo ">> polling the domain until the timeout worker expires the registration to VERLOPEN"
|
||||||
|
verlopen=""
|
||||||
|
for _ in $(seq 1 30); do
|
||||||
|
body="$(docker run --rm --network "$net" curlimages/curl:latest -fsS "http://$dom_ip:8080$locv" 2>/dev/null || true)"
|
||||||
|
printf '%s' "$body" | grep -qi 'verlopen' && { verlopen=1; break; }
|
||||||
|
sleep 2
|
||||||
|
done
|
||||||
|
[ -n "$verlopen" ] || { echo "FAIL — registration $reg_idv not VERLOPEN after the document timer fired (body: $body)" >&2; docker logs "$dom" 2>&1 | tail -15 >&2; exit 1; }
|
||||||
|
echo "OK — the 30-day document timer expired the registration to VERLOPEN"
|
||||||
exit 0
|
exit 0
|
||||||
|
|||||||
Reference in New Issue
Block a user