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

37 lines
1.3 KiB
PHTML

<?php
$source = file_get_contents(dirname(__DIR__)
. '/app/Services/Cloud/CloudPublicNetworkAllocationService.php');
if (!is_string($source)) {
throw new RuntimeException('Unable to read public-network allocator.');
}
foreach ([
'assertPoolLedger(object $pool,' => 'pool-ledger contract parameter',
'CloudPublicIpPoolContract $contract, array $rows' =>
'shared parsed contract in ledger validation',
"lockReservableAddressCandidate(\n object \$pool,\n"
. ' CloudPublicIpPoolContract $contract,' =>
'shared parsed contract in candidate selection',
"'contracts' => \$contracts" => 'per-catalog contract cache',
"'contracts' => \$selectedContracts" =>
'per-selection contract propagation',
] as $needle => $label) {
if (!str_contains($source, $needle)) {
throw new RuntimeException('Missing ' . $label . '.');
}
}
$rawAllowed = strstr($source,
'private static function rawAddressAllowedByPool');
if (!is_string($rawAllowed)
|| !str_contains($rawAllowed, 'CloudPublicIpPoolContract $contract')
|| str_contains(substr($rawAllowed, 0, 1200),
'CloudPublicIpPoolContract::fromRow')) {
throw new RuntimeException(
'Hot address validation reconstructs the pool contract per row.'
);
}
echo "Public-network allocator pool-contract reuse checks passed.\n";