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.
35 lines
1.6 KiB
PHP
35 lines
1.6 KiB
PHP
<?php
|
|
|
|
// Dependency-free contract for the administrator health cutover. The runtime
|
|
// PHP test suite exercises the real registry, mTLS and database adapters; this
|
|
// source guard runs in the lightweight audit shell where PHP/Composer may be
|
|
// unavailable.
|
|
$root = dirname(__DIR__);
|
|
$runtime = file_get_contents($root . '/app/Services/Cloud/CloudRuntimeHealthService.php');
|
|
$registry = file_get_contents($root . '/app/Services/Cloud/CloudAgentRegistryHealthService.php');
|
|
$javascript = file_get_contents($root . '/public/cloud/admin-operations.js');
|
|
$assert = static function (bool $condition, string $message): void {
|
|
if (!$condition) {
|
|
throw new RuntimeException($message);
|
|
}
|
|
};
|
|
|
|
$assert(is_string($runtime)
|
|
&& str_contains($runtime, 'CloudAgentRegistryHealthService::fromConfig()')
|
|
&& str_contains($runtime, "\$this->check('engine', 'Go Agent'")
|
|
&& !str_contains($runtime, 'CloudEngineClient')
|
|
&& !str_contains($runtime, 'shell_exec')
|
|
&& !str_contains($runtime, 'ssh'),
|
|
'Runtime health still depends on the legacy Engine/SSH transport.');
|
|
$assert(is_string($registry)
|
|
&& str_contains($registry, 'fromConfig()')
|
|
&& str_contains($registry, 'client_certificate_fingerprint')
|
|
&& str_contains($registry, '$fingerprint'),
|
|
'Agent health registry lost fresh configuration or certificate pinning.');
|
|
$assert(is_string($javascript)
|
|
&& str_contains($javascript, 'Agent liveness')
|
|
&& !str_contains($javascript, '引擎连通不代表'),
|
|
'Administrator health UI still describes the retired Engine probe.');
|
|
|
|
fwrite(STDOUT, "Cloud Agent runtime health contract passed.\n");
|