test(jobs): remove hardcoded number of jobs in tests

This commit is contained in:
Edouard Vanbelle
2026-08-09 17:03:08 +02:00
parent c61341b890
commit bbc1e77e33
+31 -26
View File
@@ -67,40 +67,45 @@ Authorization: Bearer {{admin_token}}
HTTP 200 HTTP 200
[Asserts] [Asserts]
# Names — the four scheduler tenants. # Presence asserts — each scheduled tenant we EXPECT must be
# listed. Failure of any one means the registration wiring was
# dropped; adding a new tenant elsewhere never breaks these.
#
# Deliberately shape-not-cardinality: an earlier version of this
# step hardcoded `count == 12` / `count == 4` totals, which broke
# on EVERY new registration in unrelated PRs. Duplicate-name
# registration is already trapped at boot with a panic (see
# `TrashCleanupService::register` — the registry rejects same-name
# reinserts loudly), so the total-count gate added nothing that
# `contains` didn't already cover, at the cost of drive-by
# maintenance every quarter.
jsonpath "$[*].name" contains "trash_cleanup" jsonpath "$[*].name" contains "trash_cleanup"
jsonpath "$[*].name" contains "usage_reconcile" jsonpath "$[*].name" contains "usage_reconcile"
jsonpath "$[*].name" contains "dedup_gc" jsonpath "$[*].name" contains "dedup_gc"
jsonpath "$[*].name" contains "grant_cleanup" jsonpath "$[*].name" contains "grant_cleanup"
jsonpath "$[*].name" contains "session_cleanup"
# Scheduled jobs' interval_ms values, in whatever order: # Schema asserts — the response shape itself. Every scheduled
# TrashCleanup → 24 h = 86_400_000 ms # tenant carries an `interval_ms` value; recursive-descent
# GrantCleanup → 24 h = 86_400_000 ms # `contains` on the specific intervals we ship pins the
# StorageReconcile → 600 s = 600_000 ms # non-default cadences without caring about the ordering or the
# Recursive descent collects all interval_ms values across the # total number of scheduled tenants.
# array; `contains` doesn't care about order. # TrashCleanup / GrantCleanup / SessionCleanup → 24 h = 86_400_000 ms
# StorageReconcile → 600 s = 600_000 ms
jsonpath "$..interval_ms" contains 86400000 jsonpath "$..interval_ms" contains 86400000
jsonpath "$..interval_ms" contains 600000 jsonpath "$..interval_ms" contains 600000
# On-demand job (`dedup_gc`) has no interval_ms field, so the # Floor asserts — catastrophic-regression guard, not a fragile
# total count of interval_ms values is 3, not 4. Combined with # total. Bump the floors in lockstep with the `contains "..."`
# the four-name check above, this pins the on-demand-omission # presence checks above: 5 named tenants total (trash_cleanup,
# behaviour without hitting the single-match filter trap. # usage_reconcile, dedup_gc, grant_cleanup, session_cleanup) →
jsonpath "$..interval_ms" count == 3 # ≥ 5 `running` entries; 4 of those are scheduled (dedup_gc is
# on-demand and carries no `interval_ms`) → ≥ 4 `interval_ms`
# Every entry carries a `running` bool — same aggregate primitive. # values. New unrelated tenants only PUSH the actual counts UP,
# Count matches the registered-tenant count: 4 Part 1 periodics # never below these floors, so they don't break on drive-by
# (trash_cleanup, usage_reconcile, dedup_gc, grant_cleanup) + 5 # additions.
# Part 2 recoverables (drives_consistency, folders_consistency, jsonpath "$..running" count >= 5
# files_consistency, blobs_consistency, backend_consistency — jsonpath "$..interval_ms" count >= 4
# wrapped by RecoverableAdapter so they appear here alongside the
# periodics) + 1 coordinator (consistency_batch — a plain
# JobHandler that dispatches every registered `*_consistency`) +
# 2 on-demand admin ops (backend_migration — the readonly-mode +
# cutover backend swap; backend_rotate — K3, in-place per-blob
# format normalisation, no readonly).
# Bump when a new tenant registers.
jsonpath "$..running" count == 12
jsonpath "$[*].name" contains "drives_consistency" jsonpath "$[*].name" contains "drives_consistency"
jsonpath "$[*].name" contains "folders_consistency" jsonpath "$[*].name" contains "folders_consistency"
jsonpath "$[*].name" contains "files_consistency" jsonpath "$[*].name" contains "files_consistency"