feat(tasks): track authenticated native progress until final reply

Renew broker idle waits only for encrypted current-task progress, keep an absolute deadline and binding/session/worker fences, and retain original-message reply deduplication. Add guarded prepare-update staging that reuses the active broker key material and application configuration. Validation: 216 passed, 2 skipped; guarded update and long-task routing covered with synthetic Docker configuration and loopback WebSocket tests. Real ECS build and acceptance remain pending.
This commit is contained in:
ex_tianzy
2026-11-04 18:12:12 +08:00
parent ce965aaf58
commit 660d7a48d2
7 changed files with 225 additions and 4 deletions
+37
View File
@@ -510,3 +510,40 @@ def test_overlay_validator_rejects_database_volume_or_network_change(scenario,fi
merged[field] = {"unexpected":{}}
with pytest.raises(deploy.DeployError):
deploy.validate_overlay(base,merged,plan["candidate_image"])
def test_prepare_update_preserves_key_material_and_parent_plan_without_restart(scenario):
parent=prepared(scenario)
root=scenario['output']
original_key=(root/'credential-keyring.json').read_bytes()
original_plan=(root/'plan.json').read_bytes()
image='sha256:'+'a'*64
for name in ('connector','router'):scenario['roles'][name]['image']=image
deploy.write_json(root/'candidate.json',{'image':image,'tag':parent['candidate_image']})
output=root.parent/'update'
args=argparse.Namespace(plan=str(root),source_root=str(ROOT),output=str(output))
scenario['calls'].clear()
deploy.prepare_update(args)
updated=deploy.load_plan(output)
assert (output/'credential-keyring.json').read_bytes()==original_key
assert (root/'plan.json').read_bytes()==original_plan
assert updated['base_image']==image and updated['roles']['connector']['image']==image
assert updated['candidate_image']!=parent['candidate_image']
assert updated['update_preserves_credentials'] is True
overlay=json.loads((output/'compose.broker.json').read_text())
old=json.loads((root/'compose.broker.json').read_text())
assert overlay['services']['connector']['environment']==old['services']['connector']['environment']
assert not any('up' in call or 'build' in call or 'tag' in call for call in scenario['calls'])
def test_prepare_update_rejects_partial_switch_and_existing_output(scenario):
parent=prepared(scenario);root=scenario['output'];image='sha256:'+'a'*64
deploy.write_json(root/'candidate.json',{'image':image,'tag':parent['candidate_image']})
scenario['roles']['connector']['image']=image
output=root.parent/'update'
args=argparse.Namespace(plan=str(root),source_root=str(ROOT),output=str(output))
with pytest.raises(deploy.DeployError,match='both services'):deploy.prepare_update(args)
assert not output.exists()
scenario['roles']['router']['image']=image
args.output=str(root)
with pytest.raises(deploy.DeployError,match='new absolute'):deploy.prepare_update(args)