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 17:56:14 +0000
commit82daedc0abbea3acdd22e99ba0c2639a297bc9bb (patch)
tree7db472d254da1e9542374d251cdfbb850ec01f2e
parentf8006ee277be3e553f145529b648ac57d65f7b6c (diff)
downloadmongo-82daedc0abbea3acdd22e99ba0c2639a297bc9bb.tar.gz
SERVER-43973 Use a unique test name for each thread in ParallelTester
(cherry picked from commit 66cc9d9c2e7db216881afc605669028c55042e5e) (cherry picked from commit 1679ee2b3a5247b104752c489b0d029c30d576af)
-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 78c22377c33..87e8fa65a28 100644
--- a/jstests/libs/parallelTester.js
+++ b/jstests/libs/parallelTester.js
@@ -396,11 +396,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);
}