summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Guo <robert.guo@mongodb.com>2019-10-17 21:17:16 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-09-24 18:39:26 +0000
commitb7959ce61aaea65ae9538cefb3617bbd8051ed08 (patch)
tree82f3390082d50ed0bf162b06a6e21a807b72bb22
parent88276238fa97b47c0ef14362b343c5317ecbd739 (diff)
downloadmongo-b7959ce61aaea65ae9538cefb3617bbd8051ed08.tar.gz
SERVER-43973 Use a unique test name for each thread in ParallelTester
(cherry picked from commit 66cc9d9c2e7db216881afc605669028c55042e5e)
-rw-r--r--jstests/libs/parallelTester.js12
1 files changed, 10 insertions, 2 deletions
diff --git a/jstests/libs/parallelTester.js b/jstests/libs/parallelTester.js
index a5b06b31bde..d13251c486f 100644
--- a/jstests/libs/parallelTester.js
+++ b/jstests/libs/parallelTester.js
@@ -376,11 +376,19 @@ if (typeof _threadInject != "undefined") {
for (var i in params) {
var param = params[i];
var test = param.shift();
+
+ // Make a shallow copy of TestData so we can override the test name to
+ // prevent tests on different threads that to use jsTestName() as the
+ // collection name from colliding.
+ const clonedTestData = Object.assign({}, TestData);
+ clonedTestData.testName = `ParallelTesterThread${i}`;
+
var t;
if (newScopes)
- t = new ScopedThread(wrapper, test, param, {TestData: TestData});
+ t = new ScopedThread(wrapper, test, param, {TestData: clonedTestData});
else
- t = new Thread(wrapper, test, param, {TestData: TestData});
+ t = new Thread(wrapper, test, param, {TestData: clonedTestData});
+
runners.push(t);
}