test: prove native automatic WSS to HTTPS fallback without new jobs
Rust development slice / linux (push) Failing after 6s

This commit is contained in:
2026-11-13 19:46:40 +01:00
parent c512bd6fb2
commit e6adc258b6
4 changed files with 99 additions and 11 deletions
+9 -3
View File
@@ -45,8 +45,10 @@ def auto_mode(payload):
backup.mkdir(mode=0o700)
os.rename(selected,backup/'previous-transport.conf')
subprocess.run(['systemctl','daemon-reload'],capture_output=True,check=True,timeout=10)
restarted = changed or payload.get('restart') is True
if restarted:
subprocess.run(['systemctl','restart','rmm-agent-remote.service'],capture_output=True,check=True,timeout=20)
return dict(mode='auto',preserved_identity=True,removed_test_override=changed)
return dict(mode='auto',preserved_identity=True,removed_test_override=changed,restarted=restarted)
def configure_server(payload):
@@ -136,7 +138,7 @@ def main():
before = gate();require(before['unresolved'] == 0,'earlier effects must be closed')
ident = str(uuid.uuid4());folder = STATE/ident;folder.mkdir(mode=0o700,parents=True)
evidence_scope = dict(scope,fault_id=ident)
auto = cloud.bootstrap.rpc('linux-vm.conf',auto_mode,dict(id=ident,agent_id=identity['agent_id'],agent_sha256=args.expected_agent_sha256))
auto = cloud.bootstrap.rpc('linux-vm.conf',auto_mode,dict(id=ident,agent_id=identity['agent_id'],agent_sha256=args.expected_agent_sha256,restart=True))
checkpoint = dict(profile='dev/test',testsimulation=True,case='actual_auto_fallback',id=ident,identity=identity,preapproval_counts=before,auto_mode=auto,no_jobs_created=True)
path = folder/'checkpoint.json'
def save():path.write_text(json.dumps(checkpoint,indent=2));path.chmod(0o600)
@@ -166,7 +168,8 @@ def main():
and all(r['data']['status'] == 503 and r['data']['agent_id'] == identity['agent_id'] and r['data']['tenant_id'] == cloud.TENANT
and r['data']['config_sha256'] == hashlib.sha256(raw).hexdigest() and r['data']['certificate_sha256'] == device['certificate_sha256']
and r['data']['testsimulation'] is True for r in receipts),'actual exact peer fault receipts')
require(all(device[k] == identity[k] for k in ('agent_id','asset_id','enrollment_generation','assignment_version')),'permanent identity unchanged')
require(all(device[k] == checkpoint['initial_wss']['device'][k] for k in ('agent_id','asset_id','enrollment_generation','assignment_version'))
and all(device[k] == identity[k] for k in ('agent_id','asset_id')),'permanent identity and actual initial versions unchanged')
checkpoint['https']=observed;save();complete=True
finally:
if attempted:
@@ -176,6 +179,9 @@ def main():
flags=cloud.bootstrap.rpc('server.conf',runtime_flags,{})
require(len(flags) == 2 and all(v.get('RMM_DEV_TRANSPORT_FAULTS') in (None,'false') and 'RMM_DEV_TRANSPORT_FAULT_FILE' not in v for v in flags.values()),'both real roles disabled')
checkpoint['disabled_runtime']=flags;save()
# Auto chooses transport at connect time. An existing HTTPS actor
# need not switch itself back after the WSS denial is removed.
checkpoint['restoring_auto']=cloud.bootstrap.rpc('linux-vm.conf',auto_mode,dict(id=str(uuid.uuid4()),agent_id=identity['agent_id'],agent_sha256=args.expected_agent_sha256,restart=True));save()
checkpoint['restored_wss']=wait_transport('wss',cloud.contract.now());save()
require(complete,'fallback not proven')
after=gate();require(after == before,'passive fallback must leave job/outbox/grant counts unchanged')