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/CloudPublicIpPoolReplacemen...

50 lines
1.8 KiB
PHP

<?php
declare(strict_types=1);
$root = dirname(__DIR__);
$routes = file_get_contents($root . '/config/routes_cloud.php');
$controller = file_get_contents(
$root . '/app/Controllers/CloudAdminPublicIpPoolReplacementController.php'
);
$service = file_get_contents(
$root . '/app/Services/Cloud/CloudPublicIpPoolReplacementBatchService.php'
);
$assert = static function (bool $condition, string $message): void {
if (!$condition) {
throw new RuntimeException($message);
}
};
$assert(is_string($routes) && str_contains(
$routes,
'/network-pools/{pool_key:[0-9a-f]{32}}/replacement-batches'
), 'Public-pool replacement collection route is missing.');
$assert(str_contains(
$routes,
'/replacement-batches/{batch_key:[0-9a-f]{32}}'
), 'Public-pool replacement detail route is missing.');
$assert(is_string($controller)
&& str_contains($controller, "'confirm_replacement'")
&& str_contains($controller, "'expected_source_revision'")
&& str_contains($controller, "'expected_target_revision'")
&& str_contains($controller, '], 202)')
&& str_contains($controller, "'status_url'"),
'Replacement controller lost its strict input or 202 task receipt.');
$assert(is_string($service)
&& str_contains($service, "'target_pool_key'")
&& !str_contains($controller, "'instance_ids'")
&& !str_contains($controller, "'target_public_ip_id'"),
'The browser boundary can select instances or target IPs directly.');
$assert(str_contains(
$service,
'beginPoolReplacementBatch('
) && str_contains(
$service,
'new CloudPublicNetworkTransitionBatchPlan('
) && str_contains($service, "'active_claim', 1")
&& str_contains($service, "'network_change_effect_unknown'"),
'Replacement service lost durable child jobs or unknown-effect fencing.');
echo "Public-pool replacement HTTP contract passed.\n";