Issue #2193521 by sun, alexpott: Simpletest suffixes are not guaranteed to be unique.
parent
6c70c01359
commit
e7fae35ed5
|
@ -884,9 +884,14 @@ abstract class TestBase {
|
||||||
* @see drupal_valid_test_ua()
|
* @see drupal_valid_test_ua()
|
||||||
*/
|
*/
|
||||||
private function prepareDatabasePrefix() {
|
private function prepareDatabasePrefix() {
|
||||||
$suffix = mt_rand(1000, 1000000);
|
// Ensure that the generated test site directory does not exist already,
|
||||||
|
// which may happen with a large amount of concurrent threads and
|
||||||
|
// long-running tests.
|
||||||
|
do {
|
||||||
|
$suffix = mt_rand(100000, 999999);
|
||||||
$this->siteDirectory = 'sites/simpletest/' . $suffix;
|
$this->siteDirectory = 'sites/simpletest/' . $suffix;
|
||||||
$this->databasePrefix = 'simpletest' . $suffix;
|
$this->databasePrefix = 'simpletest' . $suffix;
|
||||||
|
} while (is_dir(DRUPAL_ROOT . '/' . $this->siteDirectory));
|
||||||
|
|
||||||
// As soon as the database prefix is set, the test might start to execute.
|
// As soon as the database prefix is set, the test might start to execute.
|
||||||
// All assertions as well as the SimpleTest batch operations are associated
|
// All assertions as well as the SimpleTest batch operations are associated
|
||||||
|
|
Loading…
Reference in New Issue