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.
83 lines
3.3 KiB
PHP
83 lines
3.3 KiB
PHP
<?php
|
|
|
|
$root = dirname(__DIR__);
|
|
$coordinator = file_get_contents(
|
|
$root . '/app/Services/Cloud/CloudTemplateReplicaCoordinator.php'
|
|
);
|
|
$catalog = file_get_contents(
|
|
$root . '/app/Services/Cloud/CloudTemplateCatalogService.php'
|
|
);
|
|
$controller = file_get_contents(
|
|
$root . '/app/Controllers/CloudAdminController.php'
|
|
);
|
|
$routes = file_get_contents($root . '/config/routes_cloud.php');
|
|
$identity = file_get_contents(
|
|
$root . '/app/Services/Cloud/CloudOperationRecoveryIdentity.php'
|
|
);
|
|
$automatic = file_get_contents(
|
|
$root . '/app/Services/Cloud/CloudAutomaticOperationRecoveryService.php'
|
|
);
|
|
$agent = file_get_contents(
|
|
dirname($root) . '/agent/hypervisor/libvirt_catalog_features.go'
|
|
);
|
|
if (!is_string($coordinator) || !is_string($catalog)
|
|
|| !is_string($controller) || !is_string($routes)
|
|
|| !is_string($identity) || !is_string($automatic)
|
|
|| !is_string($agent)) {
|
|
throw new RuntimeException('Cannot read template replica sources.');
|
|
}
|
|
$assert = static function (bool $condition, string $message): void {
|
|
if (!$condition) {
|
|
throw new RuntimeException($message);
|
|
}
|
|
};
|
|
|
|
$assert(str_contains($coordinator,
|
|
'CloudTemplateArtifactManager::downloadSource($snapshot)')
|
|
&& str_contains($coordinator,
|
|
"'template_import_replica',")
|
|
&& str_contains($coordinator,
|
|
"'replica_sync' => true")
|
|
&& str_contains($coordinator,
|
|
'public static function syncMetadataHost(')
|
|
&& str_contains($coordinator,
|
|
"'template_metadata_replica',")
|
|
&& str_contains($coordinator,
|
|
'assertObservedMetadataStale(')
|
|
&& str_contains($coordinator,
|
|
'public static function repairPlan(')
|
|
&& str_contains($coordinator,
|
|
'public static function repairHost(')
|
|
&& str_contains($coordinator,
|
|
"=== 'template_observed_divergent'")
|
|
&& str_contains($coordinator,
|
|
"\$job->effect_resolution !== 'not_applied'")
|
|
&& str_contains($coordinator,
|
|
'CloudTemplateStateMachine::availability(')
|
|
&& str_contains($catalog,
|
|
'CloudTemplateReplicaCoordinator::settleStandaloneLocked('),
|
|
'Standalone replica synchronization is not bound to immutable artifacts, observations and safe retry evidence.');
|
|
|
|
$assert(str_contains($controller,
|
|
'CloudTemplateReplicaCoordinator::repairHost(')
|
|
&& str_contains($controller, 'CloudInput::only($body, []);')
|
|
&& !str_contains($controller, "'repair_action'")
|
|
&& str_contains($routes,
|
|
'/admin/cloud-templates/{id}/replicas/{host_id:[1-9][0-9]*}/repair'),
|
|
'The administrator matrix accepts a client-selected repair or lacks its guarded route.');
|
|
|
|
$assert(str_contains($identity,
|
|
'$standaloneImport = (string) $job->kind')
|
|
&& str_contains($identity,
|
|
"&& (\$payload['replica_sync'] ?? null) === true")
|
|
&& str_contains($identity,
|
|
'? (int) $job->id : (int) $parent->id)'),
|
|
'Recovery identity cannot distinguish a standalone replica sync from a damaged aggregate child.');
|
|
|
|
$assert(str_contains($automatic,
|
|
"&& (string) \$job->execution_mode === 'aggregate'")
|
|
&& !str_contains($agent, '"template_name_exists"'),
|
|
'Standalone repair is misclassified as aggregate damage or template versions still conflict by display name.');
|
|
|
|
echo "Template standalone replica coordinator contract passed.\n";
|