Skip to content

Commit 3815c7d

Browse files
committed
MQE-1774: Review community PR #343
Fix for pipeline step failures on execution of bin/magento from WebDriver.
1 parent f101b0e commit 3815c7d

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

src/Magento/FunctionalTestingFramework/Module/MagentoWebDriver.php

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -515,15 +515,19 @@ public function scrollToTopOfPage()
515515
* @return string
516516
* @throws TestFrameworkException
517517
*/
518-
public function magentoCLI($command, $arguments = null)
518+
public function magentoCLI($command, $timeout = null, $arguments = null)
519519
{
520-
try {
520+
//TODO: shellExecMagentoCLI is causing pipeline steps to fail, needs investigation
521+
return $this->curlExecMagentoCLI($command, $timeout, $arguments, $timeout);
522+
/* try {
521523
return $this->shellExecMagentoCLI($command, $arguments);
522524
} catch (\Exception $exception) {
523525
return $this->curlExecMagentoCLI($command, $arguments);
524-
}
526+
}
527+
*/
525528
}
526529

530+
527531
/**
528532
* Runs DELETE request to delete a Magento entity against the url given.
529533
*
@@ -834,17 +838,18 @@ public function makeScreenshot($name = null)
834838
*
835839
* @param string $command
836840
* @param string $arguments
841+
* @param string $timeout
837842
*
838843
* @throws \RuntimeException
839844
* @return string
840845
*/
841-
private function shellExecMagentoCLI($command, $arguments): string
846+
private function shellExecMagentoCLI($command, $timeout): string
842847
{
843848
$php = PHP_BINDIR ? PHP_BINDIR . DIRECTORY_SEPARATOR. 'php' : 'php';
844849
$binMagento = realpath(MAGENTO_BP . DIRECTORY_SEPARATOR . 'bin' . DIRECTORY_SEPARATOR . 'magento');
845-
$command = $php . ' -f ' . $binMagento . ' ' . $command . ' ' . $arguments;
850+
$command = $php . ' -f ' . $binMagento . ' ' . $command;
846851
$process = new Process(escapeshellcmd($command), MAGENTO_BP);
847-
$process->setIdleTimeout(60);
852+
$process->setIdleTimeout($timeout);
848853
$process->setTimeout(0);
849854
$exitCode = $process->run();
850855
if ($exitCode !== 0) {
@@ -859,10 +864,11 @@ private function shellExecMagentoCLI($command, $arguments): string
859864
*
860865
* @param string $command
861866
* @param string $arguments
867+
* @param string $timeout
862868
* @return string
863869
* @throws TestFrameworkException
864870
*/
865-
private function curlExecMagentoCLI($command, $arguments): string
871+
private function curlExecMagentoCLI($command, $timeout, $arguments): string
866872
{
867873
// Remove index.php if it's present in url
868874
$baseUrl = rtrim(
@@ -879,6 +885,7 @@ private function curlExecMagentoCLI($command, $arguments): string
879885
'token' => $restExecutor->getAuthToken(),
880886
getenv('MAGENTO_CLI_COMMAND_PARAMETER') => $command,
881887
'arguments' => $arguments,
888+
'timeout' => $timeout,
882889
],
883890
CurlInterface::POST,
884891
[]

0 commit comments

Comments
 (0)