Build multinode test policies in the inputs shape so they reference their sources

This commit is contained in:
Anthony Stirling
2026-08-25 12:40:17 +01:00
parent 3a7a605e1d
commit 2e15b45213
2 changed files with 8 additions and 4 deletions
+4 -2
View File
@@ -146,10 +146,12 @@ JSON
fi
if [ -n "${src_id:-}" ]; then
# 'inputs', not the legacy {trigger, sourceIds}: Policy has no sourceIds field, so the old
# shape binds inputs=null and seeds a policy that watches nothing while still returning 200.
pol_body=$(cat <<JSON
{"name":"Compress incoming PDFs","enabled":true,
"trigger":{"type":"schedule","options":{"schedule":{"type":"every","count":5,"unit":"MINUTES"}}},
"sourceIds":["$src_id"],
"inputs":[{"sourceId":"$src_id",
"trigger":{"type":"schedule","options":{"schedule":{"type":"every","count":5,"unit":"MINUTES"}}}}],
"steps":[{"operation":"/api/v1/misc/compress-pdf","parameters":{}}],
"output":{"type":"s3","options":{"connectionId":$conn_id,"prefix":"processed/"}}}
JSON
@@ -101,9 +101,11 @@ def _names_on_node(node, path, token):
def _policy_body(name, source_ids=None, enabled=True):
# Must be the 'inputs' shape. Policy has no sourceIds field, so a legacy
# {sourceIds, trigger} body binds inputs=null and silently stores a policy referencing nothing.
return json.dumps({
"name": name, "enabled": enabled, "trigger": None,
"sourceIds": source_ids or [],
"name": name, "enabled": enabled,
"inputs": [{"sourceId": sid, "trigger": None} for sid in (source_ids or [])],
"steps": [{"operation": "/api/v1/misc/compress-pdf", "parameters": {}}],
"output": {"type": "inline", "options": {}},
})