From 848eff50f93c3903afc64434c1873eaf085b6686 Mon Sep 17 00:00:00 2001 From: Steven Nguyen Date: Tue, 12 Mar 2024 22:14:30 +0100 Subject: [PATCH] Fix tests --- src/Orchestration/Adapter/DockerCLI.php | 7 ++++++- tests/Orchestration/Base.php | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/Orchestration/Adapter/DockerCLI.php b/src/Orchestration/Adapter/DockerCLI.php index cfdadc9..76a4ff8 100644 --- a/src/Orchestration/Adapter/DockerCLI.php +++ b/src/Orchestration/Adapter/DockerCLI.php @@ -112,7 +112,12 @@ public function getStats(string $container = null, array $filters = []): array } $result = Console::execute('docker stats --no-trunc --format "id={{.ID}}&name={{.Name}}&cpu={{.CPUPerc}}&memory={{.MemPerc}}&diskIO={{.BlockIO}}&memoryIO={{.MemUsage}}&networkIO={{.NetIO}}" --no-stream'.$containersString, '', $output); - + $dump = function($value) { + $p = var_export($value, true); + $b = debug_backtrace(); + print($b[0]['file'] . ':' . $b[0]['line'] . ' - ' . $p . "\n"); + }; + $dump($result); if ($result !== 0) { throw new Orchestration("Docker Error: {$output}"); } diff --git a/tests/Orchestration/Base.php b/tests/Orchestration/Base.php index 2f8e1dd..4bf1ed1 100644 --- a/tests/Orchestration/Base.php +++ b/tests/Orchestration/Base.php @@ -493,8 +493,8 @@ public function testUsageStats(): void // This allows CPU-heavy load check $output = ''; - static::getOrchestration()->execute($containerId1, ['screen', '-d', '-m', "'stress --cpu 1 --timeout 5'"], $output); // Run in screen so it's background task - static::getOrchestration()->execute($containerId2, ['screen', '-d', '-m', "'stress --cpu 1 --timeout 5'"], $output); + static::getOrchestration()->execute($containerId1, ['screen', '-d', '-m', 'stress --cpu 1 --timeout 5'], $output); // Run in screen so it's background task + static::getOrchestration()->execute($containerId2, ['screen', '-d', '-m', 'stress --cpu 1 --timeout 5'], $output); // Set CPU stress-test start \sleep(1);