You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
virt/web/tests/CloudInstanceRuntimeSyncAge...

38 lines
1.9 KiB
PHP

<?php
// Static migration contract for the lifecycle runtime poller. The scheduler
// must use one typed, explicitly addressed Agent observation per VM; a batch
// inventory response or the retired Python/SSH transport would reintroduce a
// host-wide authority boundary and cannot preserve per-row CAS fencing.
$root = dirname(__DIR__);
$assert = static function ($condition, string $message): void {
if (!$condition) {
throw new RuntimeException($message);
}
};
$service = file_get_contents($root . '/app/Services/Cloud/CloudInstanceRuntimeSyncService.php');
$observation = file_get_contents($root . '/app/Services/Cloud/CloudAgentObservationService.php');
$assert(is_string($service) && is_string($observation), 'Runtime sync sources are unreadable.');
$assert(str_contains($service, 'CloudAgentObservationService')
&& str_contains($service, 'CloudAgentHostClientResolverFactory::fromConfig()')
&& str_contains($service, '->observe($hostId, $uuid, $actor)')
&& str_contains($service, 'CloudInstanceRuntimeService::beginObservation(')
&& str_contains($service, 'CloudInstanceRuntimeService::markObserved(')
&& str_contains($service, 'CloudInstanceRuntimeService::markUnavailable(')
&& str_contains($service, 'hash_equals($uuid, $candidateUuid)')
&& !str_contains($service, 'CloudEngineClient')
&& !str_contains($service, 'vm-states')
&& !str_contains($service, 'shell_exec')
&& !str_contains($service, 'ssh'),
'Runtime sync must use typed Agent observations and no Python/SSH or host-wide vm-states fallback.');
$assert(str_contains($observation, 'resolveReadOnly($hostId)')
&& str_contains($observation, "'domain_observe'")
&& str_contains($observation, 'markUncertain')
&& str_contains($observation, 'observeMany'),
'Agent observation service must keep read-only resolver, typed operation and uncertain journal semantics.');
echo "Cloud Agent runtime sync contract passed.\n";