MDL-54628 behat: Set behat dir for each run under behat_dataroot

Before this patch behat_dataroot for parallel runs
were created at same level as ->behat_dataroot
After this patch, it will be created 1 level under
->behat_dataroot with BEHAT_PARALLEL_SITE_NAME
prefix and run number as suffix. This will allow
common files as test enabled and parallel run info
to be saved in parent directory and access it easily.
This commit is contained in:
Rajesh Taneja
2017-01-30 09:23:58 +08:00
parent a669c6b21e
commit 4f5a6ca40e
10 changed files with 286 additions and 191 deletions
+4 -2
View File
@@ -84,7 +84,8 @@ if (defined('BEHAT_SITE_RUNNING')) {
// Update config variables for parallel behat runs.
behat_update_vars_for_process();
if (behat_is_test_site()) {
// If behat is being installed for parallel run, then we modify params for parallel run only.
if (behat_is_test_site() && !(defined('BEHAT_PARALLEL_UTIL') && empty($CFG->behatrunprocess))) {
clearstatcache();
// Checking the integrity of the provided $CFG->behat_* vars and the
@@ -116,7 +117,8 @@ if (defined('BEHAT_SITE_RUNNING')) {
if (!defined('BEHAT_UTIL') and !defined('BEHAT_TEST')) {
// Somebody tries to access test site directly, tell them if not enabled.
if (!file_exists($CFG->behat_dataroot . '/behat/test_environment_enabled.txt')) {
$behatdir = preg_replace("#[/|\\\]" . BEHAT_PARALLEL_SITE_NAME . "\d{0,}$#", '', $CFG->behat_dataroot);
if (!file_exists($behatdir . '/test_environment_enabled.txt')) {
behat_error(BEHAT_EXITCODE_CONFIG, 'Behat is configured but not enabled on this test site.');
}
}