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.
54 lines
2.2 KiB
PHP
54 lines
2.2 KiB
PHP
<?php
|
|
|
|
$root = dirname(__DIR__);
|
|
$assert = static function (bool $condition, string $message): void {
|
|
if (!$condition) {
|
|
throw new RuntimeException($message);
|
|
}
|
|
};
|
|
|
|
$deletion = file_get_contents(
|
|
$root . '/app/Services/Cloud/CloudTemplateDeletionService.php'
|
|
);
|
|
$storageDeletion = file_get_contents(
|
|
$root . '/app/Services/Cloud/CloudStorageArtifactDeletionService.php'
|
|
);
|
|
|
|
$hostFinish = strpos($deletion, 'public static function finishReplicaLocked(');
|
|
$arm = strpos($deletion, 'public static function armLocked(');
|
|
$storageProcess = strpos($deletion,
|
|
'(new CloudStorageArtifactDeletionService($client))->process(');
|
|
$finish = strpos($deletion, 'private static function finishSuccess(');
|
|
|
|
$assert(is_int($hostFinish) && is_int($arm) && is_int($storageProcess)
|
|
&& is_int($finish)
|
|
&& $hostFinish < $arm
|
|
&& $arm < $storageProcess
|
|
&& $storageProcess < $finish
|
|
&& str_contains($deletion, "self::assertChildProjectionLocked(\n"
|
|
. " \$template,\n \$parent,\n"
|
|
. " 'applied'")
|
|
&& str_contains($deletion, 'storage_artifact_id')
|
|
&& str_contains($deletion,
|
|
"['template_import_intent_id' => (string) \$intent->id]")
|
|
&& str_contains($deletion, "(\$result['deleted'] ?? false) === true")
|
|
&& !str_contains($deletion,
|
|
'CloudTemplateArtifactManager::deleteExact(')
|
|
&& !str_contains($deletion,
|
|
'CloudTemplateArtifactManager::inspectDeletionTarget(')
|
|
&& !str_contains($deletion, 'recordStablePresence(')
|
|
&& !str_contains($deletion, 'claimDeleteGeneration(')
|
|
&& !str_contains($deletion, 'MAX_DELETE_GENERATIONS'),
|
|
'Template deletion no longer proves host cleanup before replica deletion.');
|
|
|
|
$assert(is_string($storageDeletion)
|
|
&& str_contains($storageDeletion,
|
|
'Deletes every provider replica behind one logical artifact')
|
|
&& str_contains($storageDeletion,
|
|
'effectMayHaveApplied')
|
|
&& str_contains($storageDeletion, '->deleteObject(')
|
|
&& str_contains($storageDeletion, 'STABLE_PROBES = 2'),
|
|
'Template deletion lost exact per-replica unknown-effect reconciliation.');
|
|
|
|
echo "Template replicated deletion ordering contract passed.\n";
|