r024: compact Docker inspect output

This commit is contained in:
Mikei386
2026-08-25 16:02:02 +02:00
parent 6876e495d6
commit 8977ced7cf
10 changed files with 84 additions and 31 deletions
+18
View File
@@ -68,6 +68,24 @@ try {
check('container_runtime_summary() funktioniert', false, $e->getMessage());
}
// ── 3b. Kompakte Inspect-Ausgabe ─────────────────────────────────────────
$fixture = json_encode([[
'Id' => str_repeat('a', 64),
'Name' => '/test',
'State' => ['Status' => 'running', 'Running' => true, 'Pid' => 42, 'ExitCode' => 0],
'Config' => ['Image' => 'example:latest', 'Env' => ['SECRET=value']],
'HostConfig' => ['NetworkMode' => 'bridge'],
'NetworkSettings' => ['Ports' => []],
'Mounts' => [['Type' => 'bind', 'Source' => '/secret', 'Destination' => '/data']],
'RestartCount' => 0,
'Created' => 'now',
]]);
$summaryInspect = json_decode(compact_container_inspect($fixture), true);
$fullInspect = json_decode(compact_container_inspect($fixture, 'full'), true);
check('Inspect summary laesst Env aus', !isset($summaryInspect['Env']) && !isset($summaryInspect['Mounts']));
check('Inspect full enthaelt Env und Mounts', isset($fullInspect['Env']) && isset($fullInspect['Mounts']));
check('Inspect full maskiert Secrets', ($fullInspect['Env'][0] ?? '') === 'SECRET=<redacted>');
// ── 4. Netzwerk-Inventur ─────────────────────────────────────────────────
echo "\n[4] Netzwerk-Inventur\n";
try {