Skip to content

Commit 4c37a7b

Browse files
committed
ACQE-5871: Add ability to increase default MFTF MagentoCLI timeout
1 parent 721f17c commit 4c37a7b

File tree

4 files changed

+15
-3
lines changed

4 files changed

+15
-3
lines changed

etc/config/.env.example

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@ MODULE_ALLOWLIST=Magento_Framework,ConfigurableProductWishlist,ConfigurableProdu
6161
#*** Default timeout for wait actions
6262
WAIT_TIMEOUT=60
6363

64+
#*** Default timeout for 'magentoCLI' and 'magentoCLISecret' command
65+
MAGENTO_CLI_WAIT_TIMEOUT=60
66+
6467
#*** Uncomment and set to enable all tests, regardless of passing status, to have all their Allure artifacts.
6568
#VERBOSE_ARTIFACTS=true
6669

etc/config/command.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
$tokenPassedIn = urldecode($_POST['token'] ?? '');
1515
$command = urldecode($_POST['command'] ?? '');
1616
$arguments = urldecode($_POST['arguments'] ?? '');
17-
$timeout = floatval(urldecode($_POST['timeout'] ?? 60));
17+
$timeout = floatval(urldecode($_POST['timeout'] ?? getenv('MAGENTO_CLI_WAIT_TIMEOUT')));
1818

1919
// Token returned will be null if the token we passed in is invalid
2020
$tokenFromMagento = $tokenModel->loadByToken($tokenPassedIn)->getToken();

src/Magento/FunctionalTestingFramework/Test/Objects/ActionObject.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ class ActionObject
7272
const ACTION_ATTRIBUTE_VARIABLE_REGEX_PARAMETER = '/\(.+\)/';
7373
const ACTION_ATTRIBUTE_VARIABLE_REGEX_PATTERN = '/({{[\w]+\.[\w\[\]]+}})|({{[\w]+\.[\w]+\((?(?!}}).)+\)}})/';
7474
const STRING_PARAMETER_REGEX = "/'[^']+'/";
75-
const DEFAULT_COMMAND_WAIT_TIMEOUT = 60;
7675
const ACTION_ATTRIBUTE_USERINPUT = 'userInput';
7776
const ACTION_TYPE_COMMENT = 'comment';
7877
const ACTION_TYPE_HELPER = 'helper';
@@ -184,6 +183,16 @@ public static function getDefaultWaitTimeout()
184183
return getenv('WAIT_TIMEOUT');
185184
}
186185

186+
/**
187+
* Retrieve default timeout for 'magentoCLI' or 'magentoCLISecret' in seconds
188+
*
189+
* @return integer
190+
*/
191+
public static function getDefaultMagentoCLIWaitTimeout()
192+
{
193+
return getenv('MAGENTO_CLI_WAIT_TIMEOUT');
194+
}
195+
187196
/**
188197
* This function returns the string property stepKey.
189198
*

src/Magento/FunctionalTestingFramework/Util/TestGenerator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -842,7 +842,7 @@ public function generateStepsPhp($actionObjects, $generationScope = TestGenerato
842842
}
843843

844844
if (in_array($actionObject->getType(), ActionObject::COMMAND_ACTION_ATTRIBUTES)) {
845-
$time = $time ?? ActionObject::DEFAULT_COMMAND_WAIT_TIMEOUT;
845+
$time = $time ?? ActionObject::getDefaultMagentoCLIWaitTimeout();
846846
} else {
847847
$time = $time ?? ActionObject::getDefaultWaitTimeout();
848848
}

0 commit comments

Comments
 (0)