diff --git a/CHANGELOG.md b/CHANGELOG.md index 2dc01e00a..27ec8a380 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,12 @@ Magento Functional Testing Framework Changelog ================================================ +2.3.14 +----- +### Enhancements +* Maintainability + * `command.php` is now configured with an `idleTimeout` of `60` seconds, which will allow tests to continue execution if a CLI command is hanging indefinitely. + 2.3.13 ----- ### Enhancements diff --git a/bin/mftf b/bin/mftf index 9aba5cbd0..801cdf54f 100755 --- a/bin/mftf +++ b/bin/mftf @@ -29,7 +29,7 @@ try { try { $application = new Symfony\Component\Console\Application(); $application->setName('Magento Functional Testing Framework CLI'); - $application->setVersion('2.3.13'); + $application->setVersion('2.3.14'); /** @var \Magento\FunctionalTestingFramework\Console\CommandListInterface $commandList */ $commandList = new \Magento\FunctionalTestingFramework\Console\CommandList; foreach ($commandList->getCommands() as $command) { diff --git a/composer.json b/composer.json index f1e67abcf..dc6981da8 100755 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "name": "magento/magento2-functional-testing-framework", "description": "Magento2 Functional Testing Framework", "type": "library", - "version": "2.3.13", + "version": "2.3.14", "license": "AGPL-3.0", "keywords": ["magento", "automation", "functional", "testing"], "config": { diff --git a/composer.lock b/composer.lock index ce20aec87..e55da9399 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "e8978028c326adbd983d1a6ef7294ae0", + "content-hash": "e77971c8706a56d00fba57995a9b747d", "packages": [ { "name": "allure-framework/allure-codeception", diff --git a/etc/config/command.php b/etc/config/command.php index 600025cf4..bc8688c21 100644 --- a/etc/config/command.php +++ b/etc/config/command.php @@ -27,17 +27,32 @@ $magentoBinary = $php . ' -f ../../../../bin/magento'; $valid = validateCommand($magentoBinary, $command); if ($valid) { - exec( - escapeCommand($magentoBinary . " $command" . " $arguments") . " 2>&1", - $output, - $exitCode - ); - if ($exitCode == 0) { + $process = new Symfony\Component\Process\Process($magentoBinary . " $command" . " $arguments"); + $process->setIdleTimeout(60); + $process->setTimeout(0); + $idleTimeout = false; + try { + $process->run(); + $output = $process->getOutput(); + if (!$process->isSuccessful()) { + $output = $process->getErrorOutput(); + } + if (empty($output)) { + $output = "CLI did not return output."; + } + + } catch (Symfony\Component\Process\Exception\ProcessTimedOutException $exception) { + $output = "CLI command timed out, no output available."; + $idleTimeout = true; + } + $exitCode = $process->getExitCode(); + + if ($exitCode == 0 || $idleTimeout) { http_response_code(202); } else { http_response_code(500); } - echo implode("\n", $output); + echo $output; } else { http_response_code(403); echo "Given command not found valid in Magento CLI Command list.";