Skip to content

Commit 32f36fa

Browse files
authored
Merge branch 'develop' into MQE-1428
2 parents 9e180fe + 7044b70 commit 32f36fa

File tree

5 files changed

+31
-10
lines changed

5 files changed

+31
-10
lines changed

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
Magento Functional Testing Framework Changelog
22
================================================
33

4+
2.3.14
5+
-----
6+
### Enhancements
7+
* Maintainability
8+
* `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.
9+
410
2.3.13
511
-----
612
### Enhancements

bin/mftf

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ try {
2929
try {
3030
$application = new Symfony\Component\Console\Application();
3131
$application->setName('Magento Functional Testing Framework CLI');
32-
$application->setVersion('2.3.13');
32+
$application->setVersion('2.3.14');
3333
/** @var \Magento\FunctionalTestingFramework\Console\CommandListInterface $commandList */
3434
$commandList = new \Magento\FunctionalTestingFramework\Console\CommandList;
3535
foreach ($commandList->getCommands() as $command) {

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "magento/magento2-functional-testing-framework",
33
"description": "Magento2 Functional Testing Framework",
44
"type": "library",
5-
"version": "2.3.13",
5+
"version": "2.3.14",
66
"license": "AGPL-3.0",
77
"keywords": ["magento", "automation", "functional", "testing"],
88
"config": {

composer.lock

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

etc/config/command.php

+22-7
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,32 @@
2222
$magentoBinary = $php . ' -f ../../../../bin/magento';
2323
$valid = validateCommand($magentoBinary, $command);
2424
if ($valid) {
25-
exec(
26-
escapeCommand($magentoBinary . " $command" . " $arguments") . " 2>&1",
27-
$output,
28-
$exitCode
29-
);
30-
if ($exitCode == 0) {
25+
$process = new Symfony\Component\Process\Process($magentoBinary . " $command" . " $arguments");
26+
$process->setIdleTimeout(60);
27+
$process->setTimeout(0);
28+
$idleTimeout = false;
29+
try {
30+
$process->run();
31+
$output = $process->getOutput();
32+
if (!$process->isSuccessful()) {
33+
$output = $process->getErrorOutput();
34+
}
35+
if (empty($output)) {
36+
$output = "CLI did not return output.";
37+
}
38+
39+
} catch (Symfony\Component\Process\Exception\ProcessTimedOutException $exception) {
40+
$output = "CLI command timed out, no output available.";
41+
$idleTimeout = true;
42+
}
43+
$exitCode = $process->getExitCode();
44+
45+
if ($exitCode == 0 || $idleTimeout) {
3146
http_response_code(202);
3247
} else {
3348
http_response_code(500);
3449
}
35-
echo implode("\n", $output);
50+
echo $output;
3651
} else {
3752
http_response_code(403);
3853
echo "Given command not found valid in Magento CLI Command list.";

0 commit comments

Comments
 (0)