summaryrefslogtreecommitdiff
path: root/buildscripts
diff options
context:
space:
mode:
authorApollon Oikonomopoulos <apoikos@debian.org>2018-12-03 20:45:58 +0200
committerApollon Oikonomopoulos <apoikos@debian.org>2018-12-03 20:45:58 +0200
commit239aabeb53a8dcd45eac7d069e0cb0180b4bc412 (patch)
treec1642d9d026783a026d41a2ae3e1920fa31edb71 /buildscripts
parent3896a4a134ae19f25de14727862898cee19aa2e3 (diff)
New upstream version 3.4.18upstream/3.4.18
Diffstat (limited to 'buildscripts')
-rw-r--r--buildscripts/resmokelib/core/programs.py3
-rw-r--r--buildscripts/resmokelib/testing/hooks.py2
-rw-r--r--buildscripts/resmokelib/testing/job.py1
-rw-r--r--buildscripts/resmokelib/testing/testcases.py26
4 files changed, 20 insertions, 12 deletions
diff --git a/buildscripts/resmokelib/core/programs.py b/buildscripts/resmokelib/core/programs.py
index d94cd438ee0..63e2b12de87 100644
--- a/buildscripts/resmokelib/core/programs.py
+++ b/buildscripts/resmokelib/core/programs.py
@@ -116,7 +116,7 @@ def mongos_program(logger, executable=None, process_kwargs=None, **kwargs):
def mongo_shell_program(logger, executable=None, connection_string=None, filename=None,
- process_kwargs=None, isMainTest=True, **kwargs):
+ process_kwargs=None, **kwargs):
"""
Returns a Process instance that starts a mongo shell with arguments
constructed from 'kwargs'.
@@ -148,7 +148,6 @@ def mongo_shell_program(logger, executable=None, connection_string=None, filenam
# Only use 'opt_default' if the property wasn't set in the YAML configuration.
test_data[opt_name] = opt_default
- test_data["isMainTest"] = isMainTest
global_vars["TestData"] = test_data
# Pass setParameters for mongos and mongod through TestData. The setParameter parsing in
diff --git a/buildscripts/resmokelib/testing/hooks.py b/buildscripts/resmokelib/testing/hooks.py
index f6773c1d682..05a24117232 100644
--- a/buildscripts/resmokelib/testing/hooks.py
+++ b/buildscripts/resmokelib/testing/hooks.py
@@ -172,7 +172,7 @@ class JsCustomBehavior(CustomBehavior):
test_report.addFailure(self.hook_test_case, sys.exc_info())
raise errors.StopExecution(err.args[0])
except self.hook_test_case.failureException as err:
- self.hook_test_case.logger.exception("{0} failed".format(description))
+ self.hook_test_case.logger.error("{0} failed".format(description))
test_report.addFailure(self.hook_test_case, sys.exc_info())
raise errors.StopExecution(err.args[0])
else:
diff --git a/buildscripts/resmokelib/testing/job.py b/buildscripts/resmokelib/testing/job.py
index c8be906dd3a..ad324bd0d1d 100644
--- a/buildscripts/resmokelib/testing/job.py
+++ b/buildscripts/resmokelib/testing/job.py
@@ -115,7 +115,6 @@ class Job(object):
finally:
success = self.report.find_test_info(test).status == "pass"
- self.archival.archive(self.logger, test, success)
if self.archival:
self.archival.archive(self.logger, test, success)
diff --git a/buildscripts/resmokelib/testing/testcases.py b/buildscripts/resmokelib/testing/testcases.py
index 78110ff680d..44bb0d767ea 100644
--- a/buildscripts/resmokelib/testing/testcases.py
+++ b/buildscripts/resmokelib/testing/testcases.py
@@ -344,9 +344,6 @@ class JSTestCase(TestCase):
test_data = global_vars.get("TestData", {}).copy()
test_data["minPort"] = core.network.PortAllocator.min_test_port(fixture.job_num)
test_data["maxPort"] = core.network.PortAllocator.max_test_port(fixture.job_num)
- # Marks the main test when multiple test clients are run concurrently, to notify the test
- # of any code that should only be run once. If there is only one client, it is the main one.
- test_data["isMainTest"] = True
global_vars["TestData"] = test_data
self.shell_options["global_vars"] = global_vars
@@ -419,19 +416,32 @@ class JSTestCase(TestCase):
raise t._get_exception()
def _make_process(self, logger=None, thread_id=0):
+ # Since _make_process() is called by each thread, we make a shallow copy of the mongo shell
+ # options to avoid modifying the shared options for the JSTestCase.
+ shell_options = self.shell_options.copy()
+ global_vars = shell_options["global_vars"].copy()
+ test_data = global_vars["TestData"].copy()
+
+ # We set a property on TestData to mark the main test when multiple clients are going to run
+ # concurrently in case there is logic within the test that must execute only once. We also
+ # set a property on TestData to indicate how many clients are going to run the test so they
+ # can avoid executing certain logic when there may be other operations running concurrently.
+ is_main_test = thread_id == 0
+ test_data["isMainTest"] = is_main_test
+ test_data["numTestClients"] = self.num_clients
+
+ global_vars["TestData"] = test_data
+ shell_options["global_vars"] = global_vars
+
# If logger is none, it means that it's not running in a thread and thus logger should be
# set to self.logger.
logger = utils.default_if_none(logger, self.logger)
- is_main_test = True
- if thread_id > 0:
- is_main_test = False
return core.programs.mongo_shell_program(
logger,
executable=self.shell_executable,
filename=self.js_filename,
connection_string=self.fixture.get_driver_connection_url(),
- isMainTest=is_main_test,
- **self.shell_options)
+ **shell_options)
def _run_test_in_thread(self, thread_id):
# Make a logger for each thread.