Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
stnguyen90 committed Mar 12, 2024
1 parent 412a982 commit fa29780
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
20 changes: 20 additions & 0 deletions src/Orchestration/Adapter/DockerCLI.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,12 @@ public function getStats(string $container = null, array $filters = []): array
if ($result !== 0) {
throw new Orchestration("Docker Error: {$output}");
}
$dump = function($value) {
$p = var_export($value, true);
$b = debug_backtrace();
print($b[0]['file'] . ':' . $b[0]['line'] . ' - ' . $p . "\n");
};
$dump($output);

$lines = \explode("\n", $output);

Expand Down Expand Up @@ -344,6 +350,13 @@ public function run(string $image,

$vars = $parsedVariables;

$dump = function($value) {
$p = var_export($value, true);
$b = debug_backtrace();
print($b[0]['file'] . ':' . $b[0]['line'] . ' - ' . $p . "\n");
};
$dump(implode(' ', $command));

$time = time();

$result = Console::execute('docker run'.
Expand Down Expand Up @@ -401,6 +414,13 @@ public function execute(

$vars = $parsedVariables;

$dump = function($value) {
$p = var_export($value, true);
$b = debug_backtrace();
print($b[0]['file'] . ':' . $b[0]['line'] . ' - ' . $p . "\n");
};
$dump(implode(' ', $command));

$result = Console::execute('docker exec '.\implode(' ', $vars)." {$name} ".implode(' ', $command), '', $output, $timeout);

if ($result !== 0) {
Expand Down
4 changes: 2 additions & 2 deletions tests/Orchestration/Base.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 10'], $output); // Run in screen so it's background task
static::getOrchestration()->execute($containerId2, ['screen', '-d', '-m', 'stress --cpu 1 --timeout 10'], $output);

// Set CPU stress-test start
\sleep(1);
Expand Down

0 comments on commit fa29780

Please sign in to comment.