Skip to content

Commit 22a941a

Browse files
committed
MQE-2669: bin/mftf run:failed process used a lot of RAM during MTSv1 build
1 parent 6b27aae commit 22a941a

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

src/Magento/FunctionalTestingFramework/Console/RunTestFailedCommand.php

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,11 @@ protected function configure()
5454
*/
5555
protected function execute(InputInterface $input, OutputInterface $output): int
5656
{
57+
$returnCode = $this->executeGenerateFailed($input, $output);
58+
if ($returnCode !== 0) {
59+
return $returnCode;
60+
}
61+
5762
$this->testsFailedFile = $this->getTestsOutputDir() . self::FAILED_FILE;
5863
$this->testsReRunFile = $this->getTestsOutputDir() . "rerun_tests";
5964

@@ -85,6 +90,7 @@ function ($type, $buffer) use ($output) {
8590
}
8691
));
8792
$process->__destruct();
93+
unset($process);
8894
}
8995

9096
if (file_exists($this->testsFailedFile)) {
@@ -102,6 +108,35 @@ function ($type, $buffer) use ($output) {
102108
return $returnCode;
103109
}
104110

111+
/**
112+
* @param OutputInterface $output
113+
* @return mixed
114+
*/
115+
private function executeGenerateFailed(InputInterface $input, OutputInterface $output)
116+
{
117+
$returnCode = 0;
118+
$binMftf = PROJECT_ROOT . '/vendor/bin/mftf';
119+
if (file_exists($binMftf) === false) {
120+
$binMftf = PROJECT_ROOT . '/bin/mftf';
121+
}
122+
$forceGenerate = $input->getOption('force') ? ' -f' : '';
123+
$mftfCommand = realpath($binMftf) . ' generate:failed' . $forceGenerate;
124+
125+
$process = new Process($mftfCommand);
126+
$process->setWorkingDirectory(TESTS_BP);
127+
$process->setIdleTimeout(600);
128+
$process->setTimeout(0);
129+
$returnCode = max($returnCode, $process->run(
130+
function ($type, $buffer) use ($output) {
131+
$output->write($buffer);
132+
}
133+
));
134+
$process->__destruct();
135+
unset($process);
136+
137+
return $returnCode;
138+
}
139+
105140
/**
106141
* Returns an array of run commands read from the manifest file created post generation
107142
*

0 commit comments

Comments
 (0)