summaryrefslogtreecommitdiff
path: root/buildscripts/resmokelib/testing/fixtures/standalone.py
diff options
context:
space:
mode:
authorCarl Worley <carl.worley@mongodb.com>2019-12-09 19:58:39 +0000
committerevergreen <evergreen@mongodb.com>2019-12-09 19:58:39 +0000
commitb60b1c28fb6fb8a2c71a6b7798e3fbf4813ce043 (patch)
tree893b6611afc32df6f8804ee67f9eb44af19785bd /buildscripts/resmokelib/testing/fixtures/standalone.py
parent6b013542da50c6f6258f13c135ca03fa1a7c2b38 (diff)
downloadmongo-b60b1c28fb6fb8a2c71a6b7798e3fbf4813ce043.tar.gz
SERVER-44831 Create a fixture sigkill test case
Diffstat (limited to 'buildscripts/resmokelib/testing/fixtures/standalone.py')
-rw-r--r--buildscripts/resmokelib/testing/fixtures/standalone.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/buildscripts/resmokelib/testing/fixtures/standalone.py b/buildscripts/resmokelib/testing/fixtures/standalone.py
index 686d360fb36..3c54f41f689 100644
--- a/buildscripts/resmokelib/testing/fixtures/standalone.py
+++ b/buildscripts/resmokelib/testing/fixtures/standalone.py
@@ -111,7 +111,7 @@ class MongoDFixture(interface.Fixture):
self.logger.info("Successfully contacted the mongod on port %d.", self.port)
- def _do_teardown(self):
+ def _do_teardown(self, kill=False):
if self.mongod is None:
self.logger.warning("The mongod fixture has not been set up yet.")
return # Still a success even if nothing is running.
@@ -124,10 +124,12 @@ class MongoDFixture(interface.Fixture):
self.logger.warning(msg)
raise errors.ServerFailure(msg)
- self.mongod.stop()
+ self.mongod.stop(kill)
exit_code = self.mongod.wait()
- if exit_code == 0:
+ # SIGKILL has an exit code of 9 and Python's subprocess module returns
+ # negative versions of system calls.
+ if exit_code == 0 or (exit_code == -9 and kill):
self.logger.info("Successfully stopped the mongod on port {:d}.".format(self.port))
else:
self.logger.warning("Stopped the mongod on port {:d}. "