From d3c2fc3e948b9395ee1f287ad39136237d12bc90 Mon Sep 17 00:00:00 2001 From: Edouard Vanbelle Date: Thu, 30 Jul 2026 01:33:13 +0200 Subject: [PATCH] fix(job): correct amount of jobs + remove cound due to grace window --- tests/api/admin_jobs.hurl | 30 +++++++++++++++++------------- tests/api/recoverable_jobs.hurl | 13 +++++++++---- 2 files changed, 26 insertions(+), 17 deletions(-) diff --git a/tests/api/admin_jobs.hurl b/tests/api/admin_jobs.hurl index 082423cf..03fe890f 100644 --- a/tests/api/admin_jobs.hurl +++ b/tests/api/admin_jobs.hurl @@ -90,13 +90,14 @@ jsonpath "$..interval_ms" count == 3 # Every entry carries a `running` bool — same aggregate primitive. # Count matches the registered-tenant count: 4 Part 1 periodics -# (trash_cleanup, storage_reconcile, dedup_gc, grant_cleanup) + 3 +# (trash_cleanup, storage_reconcile, dedup_gc, grant_cleanup) + 5 # Part 2 recoverables (drives_consistency, folders_consistency, -# files_consistency — wrapped by RecoverableAdapter so they appear -# here alongside the periodics) + 1 coordinator (consistency_batch -# — a plain JobHandler that dispatches every registered -# `*_consistency`). Bump when a new tenant registers. -jsonpath "$..running" count == 8 +# files_consistency, blobs_consistency, backend_consistency — +# wrapped by RecoverableAdapter so they appear here alongside the +# periodics) + 1 coordinator (consistency_batch — a plain +# JobHandler that dispatches every registered `*_consistency`). +# Bump when a new tenant registers. +jsonpath "$..running" count == 10 jsonpath "$[*].name" contains "drives_consistency" jsonpath "$[*].name" contains "folders_consistency" jsonpath "$[*].name" contains "files_consistency" @@ -214,11 +215,12 @@ jsonpath "$.outcome.count" exists # Step 4c — Trigger `consistency_batch`. Coordinator (plain # JobHandler) — snapshots the registry, filters names # ending `_consistency`, sequentially triggers each. -# `outcome.count` = number of children dispatched (3 as -# of Slice 6: drives + folders + files). `extra.per_check` -# carries a per-child outcome map. Batch itself always -# returns ok — child failures live inside per_check. -# `?deep=true` propagates as `extra.deep`. +# `outcome.count` = number of children dispatched (5 as +# of Slice 10: drives + folders + files + blobs + +# backend). `extra.per_check` carries a per-child outcome +# map. Batch itself always returns ok — child failures +# live inside per_check. `?deep=true` propagates as +# `extra.deep`. # ───────────────────────────────────────────────────────────── POST {{base_url}}/api/admin/jobs/consistency_batch/trigger?deep=true Authorization: Bearer {{admin_token}} @@ -227,14 +229,16 @@ HTTP 200 [Asserts] jsonpath "$.ok" == true jsonpath "$.outcome.outcome" == "ok" -jsonpath "$.outcome.count" == 3 +jsonpath "$.outcome.count" == 5 jsonpath "$.outcome.extra.deep" == true -jsonpath "$.outcome.extra.ok" == 3 +jsonpath "$.outcome.extra.ok" == 5 jsonpath "$.outcome.extra.err" == 0 # per_check is keyed by child job name. jsonpath "$.outcome.extra.per_check.drives_consistency.outcome" == "ok" jsonpath "$.outcome.extra.per_check.folders_consistency.outcome" == "ok" jsonpath "$.outcome.extra.per_check.files_consistency.outcome" == "ok" +jsonpath "$.outcome.extra.per_check.blobs_consistency.outcome" == "ok" +jsonpath "$.outcome.extra.per_check.backend_consistency.outcome" == "ok" # ───────────────────────────────────────────────────────────── diff --git a/tests/api/recoverable_jobs.hurl b/tests/api/recoverable_jobs.hurl index b9f38736..5757dbac 100644 --- a/tests/api/recoverable_jobs.hurl +++ b/tests/api/recoverable_jobs.hurl @@ -125,10 +125,15 @@ HTTP 200 jsonpath "$.id" == "{{run_id}}" jsonpath "$.job_name" == "drives_consistency" jsonpath "$.status" == "Completed" -# scanned_count is bumped by the handler's checkpoint call — at -# least 0 (empty drives table) but ordinarily > 0 for any real -# fixture data. Present-ness of the field is what we pin. -jsonpath "$.stats.scanned_count" isNumber +# `stats` is always present (JSONB NOT NULL DEFAULT '{}'); its +# per-key shape is job-specific. `scanned_count` is bumped by the +# handler's `checkpoint()` call, but the drives handler only +# checkpoints when it processes a batch — a run that finds zero +# rows in the first batch (e.g. all fixture drives sit inside the +# 1h grace window on `storage.drives.created_at`) completes +# without ever calling checkpoint, so `scanned_count` may be +# absent. Pin `stats` existence; leave the counter unpinned. +jsonpath "$.stats" exists # ─────────────────────────────────────────────────────────────