test: accept bounded cloud logs and equal UI HTTP MCP evidence
Rust development slice / linux (push) Failing after 6s
Rust development slice / linux (push) Failing after 6s
This commit is contained in:
@@ -34,7 +34,8 @@ def main():
|
||||
m.require(observed['sync_ready'] and not observed['restore_blocked'],'signed sync required')
|
||||
device=backend.call('inventory.get_device',dict(tenant_id=cloud.TENANT,asset_id=identity['asset_id']))
|
||||
m.require(device['presence']=='online' and device['agent_id']==identity['agent_id'],'online cloud VM required')
|
||||
peers=cloud.bootstrap.rpc('linux-vm.conf',cloud_root_evidence.inspect_helpers,{k:settings[k] for k in ('tenant_id','asset_id','agent_id')})
|
||||
peers=cloud.bootstrap.rpc('linux-vm.conf',cloud_root_evidence.inspect_helpers,dict(
|
||||
{k:settings[k] for k in ('tenant_id','asset_id','agent_id')},general_only=name=='query_logs'))
|
||||
m.require(peers['ledger']['integrity']=='ok' and peers['ledger']['faults']==0,'healthy shared helper ledger required')
|
||||
if name in adapters.APT_CASES:
|
||||
apt_peer=peers['apt'];recipe=adapters.RECIPES[name]
|
||||
@@ -42,6 +43,16 @@ def main():
|
||||
else recipe in apt_peer['accepted_recipes'],'actual native bootstrap/acceptance gate required')
|
||||
planning=adapters.planning_from_device(device) if name in adapters.APT_CASES else None
|
||||
request=m.case_input(name,settings,planning=planning)
|
||||
if name=='query_logs':
|
||||
import datetime as dt
|
||||
# Query only the already approved harmless unit's stored start/stop
|
||||
# interval. No extra service mutation is needed to manufacture logs.
|
||||
prior=m.protected_json(cloud.ROOT/'devstate/cloud-root/cases/service_stop/checkpoint.json')
|
||||
prior_payload=prior['job']['payload']
|
||||
m.require(prior['verified'] and prior_payload['agent_id']==identity['agent_id'],'same VM test-unit history')
|
||||
moment=m.timestamp(prior_payload['not_before'])
|
||||
request['parameters'].update(execution_identity='root',since=(moment-dt.timedelta(minutes=1)).isoformat(),
|
||||
until=(moment+dt.timedelta(minutes=4)).isoformat())
|
||||
m.require({'rmm.sync.v1','helper.root.v1','root:'+request['action'],request['action']}<=set(device['capabilities']),'native root capability required')
|
||||
folder=cloud.ROOT/'devstate/cloud-root/cases'/name
|
||||
if not args.resume_prepared:folder.mkdir(mode=0o700,parents=True,exist_ok=False)
|
||||
@@ -83,6 +94,13 @@ def main():
|
||||
m.require(result['state']=='succeeded' and result['result']['evidence']['postconditions_passed'],'native success/postcondition required; no retry')
|
||||
if name=='service_setup':
|
||||
m.require(result['result']['exit_code']==0 and bytes(result['result']['stdout'])==b'RMM test unit prepared\n','exact root script result')
|
||||
if name=='query_logs':
|
||||
observation=json.loads(bytes(result['result']['stdout']))
|
||||
checkpoint['log_observation']=observation;save()
|
||||
m.require(observation['quality']=='valid' and observation['source_id']=='/usr/bin/journalctl' and
|
||||
isinstance(observation.get('data',{}).get('json_lines'),list) and
|
||||
0<len(observation['data']['json_lines'])<=50,'bounded actual test-unit journal observation')
|
||||
m.require(len(bytes(result['result']['stdout']))<=65536,'bounded serialized log output')
|
||||
if name in adapters.APT_CASES:
|
||||
apt=result['result']['evidence']['apt'];manifest=request['parameters']['apt_manifest']
|
||||
package=manifest['resolved_apt_transaction']['packages'][0]
|
||||
|
||||
Reference in New Issue
Block a user