diff --git a/infra/run-domain-check.sh b/infra/run-domain-check.sh index e99f3fd..7b3ce31 100755 --- a/infra/run-domain-check.sh +++ b/infra/run-domain-check.sh @@ -80,8 +80,13 @@ fl_base="http://$(ip "$fl"):8080/flowable-rest/service" reg_id="${loc##*/}" # Extracts the Beoordelen task id for our registration from a Flowable task-query response on stdin. +# Tolerates an empty/non-JSON body (a transient failure during the poll) by printing nothing. task_for_reg() { REG_ID="$reg_id" python3 -c "import os,sys,json -d=json.load(sys.stdin); rid=os.environ['REG_ID'] +try: + d=json.load(sys.stdin) +except Exception: + d={} +rid=os.environ['REG_ID'] print(next((t['id'] for t in (d.get('data') or []) if any(v.get('name')=='registrationId' and v.get('value')==rid for v in (t.get('processVariables') or []))), ''))"; } @@ -91,7 +96,7 @@ query='{"processDefinitionKey":"registratie","taskDefinitionKey":"Beoordelen","i echo ">> polling Flowable for the Beoordelen user task (werkbak)" task_id="" for _ in $(seq 1 30); do - resp="$(flcurl -X POST "$fl_base/runtime/tasks/query" -H 'Content-Type: application/json' -d "$query" 2>/dev/null || true)" + resp="$(flcurl -X POST "$fl_base/query/tasks" -H 'Content-Type: application/json' -d "$query" 2>/dev/null || true)" task_id="$(printf '%s' "$resp" | task_for_reg)" [ -n "$task_id" ] && break sleep 2 @@ -108,7 +113,7 @@ flcurl -X POST "$fl_base/runtime/tasks/$task_id" -H 'Content-Type: application/j -d '{"action":"complete","variables":[{"name":"besluit","type":"string","value":"goedkeuren"}]}' >/dev/null echo ">> asserting the process finished (no Beoordelen task remains for the registration)" -resp="$(flcurl -X POST "$fl_base/runtime/tasks/query" -H 'Content-Type: application/json' -d "$query")" +resp="$(flcurl -X POST "$fl_base/query/tasks" -H 'Content-Type: application/json' -d "$query")" still="$(printf '%s' "$resp" | task_for_reg)" [ -z "$still" ] || { echo "FAIL — Beoordelen task $still still active after completion" >&2; exit 1; } echo "OK — behandelaar claimed and completed the Beoordelen task; the registratie process finished" diff --git a/services/domain/Big.Infrastructure/FlowableWorkflowClient.cs b/services/domain/Big.Infrastructure/FlowableWorkflowClient.cs index 323ede0..597a6e6 100644 --- a/services/domain/Big.Infrastructure/FlowableWorkflowClient.cs +++ b/services/domain/Big.Infrastructure/FlowableWorkflowClient.cs @@ -62,7 +62,7 @@ public sealed class FlowableWorkflowClient(HttpClient http, FlowableOptions opti var request = new TaskQueryRequest(ProcessDefinitionKey, BeoordelenTaskKey, IncludeProcessVariables: true); var page = await PostAsync( - "service/runtime/tasks/query", request, ct); + "service/query/tasks", request, ct); var tasks = page?.Data ?? []; return [.. tasks.Select(t => new BeoordelingTask(t.Id, RegistrationId.Parse(t.RegistrationId())))]; diff --git a/services/domain/Big.Tests/FlowableWorkflowClientTests.cs b/services/domain/Big.Tests/FlowableWorkflowClientTests.cs index b36b13e..3262506 100644 --- a/services/domain/Big.Tests/FlowableWorkflowClientTests.cs +++ b/services/domain/Big.Tests/FlowableWorkflowClientTests.cs @@ -167,7 +167,7 @@ public class FlowableWorkflowClientTests Assert.Equal("task-1", task.TaskId); Assert.Equal(rid, task.RegistrationId); Assert.Equal(HttpMethod.Post, capture.Seen!.Method); - Assert.Equal("http://flowable/flowable-rest/service/runtime/tasks/query", + Assert.Equal("http://flowable/flowable-rest/service/query/tasks", capture.Seen.RequestUri!.ToString()); Assert.Equal("rest-admin:test", DecodeBasic(capture.Seen)); Assert.Contains("\"processDefinitionKey\":\"registratie\"", capture.Body);