summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJudah Schvimer <judah@mongodb.com>2017-01-10 09:53:58 -0500
committerJudah Schvimer <judah@mongodb.com>2017-03-06 10:07:27 -0500
commit41b04b346a3c41facb814ebc7d6db570251a07d8 (patch)
tree31ecfe77d2baab36123231462f0c043b82c31f66
parent1d7d8cc6aa70526939b3050e542d48b68d87b797 (diff)
downloadmongo-41b04b346a3c41facb814ebc7d6db570251a07d8.tar.gz
SERVER-26522 Made CleanEveryN into a TestCase
(cherry picked from commit 585a8a9cb81be45a5f3264a9ac60636ea1609cbc)
-rw-r--r--buildscripts/resmokelib/testing/hooks.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/buildscripts/resmokelib/testing/hooks.py b/buildscripts/resmokelib/testing/hooks.py
index 8d319776041..3442c4d1ef8 100644
--- a/buildscripts/resmokelib/testing/hooks.py
+++ b/buildscripts/resmokelib/testing/hooks.py
@@ -106,6 +106,7 @@ class CleanEveryN(CustomBehavior):
def __init__(self, logger, fixture, n=DEFAULT_N):
description = "CleanEveryN (restarts the fixture after running `n` tests)"
CustomBehavior.__init__(self, logger, fixture, description)
+ self.hook_test_case = testcases.TestCase(logger, "Hook", "CleanEveryN")
# Try to isolate what test triggers the leak by restarting the fixture each time.
if "detect_leaks=1" in os.getenv("ASAN_OPTIONS", ""):
@@ -118,7 +119,12 @@ class CleanEveryN(CustomBehavior):
def after_test(self, test, test_report):
self.tests_run += 1
- if self.tests_run >= self.n:
+ if self.tests_run < self.n:
+ return
+
+ self.hook_test_case.test_name = test.short_name() + ":" + self.logger_name
+ CustomBehavior.start_dynamic_test(self.hook_test_case, test_report)
+ try:
self.logger.info("%d tests have been run against the fixture, stopping it...",
self.tests_run)
self.tests_run = 0
@@ -130,6 +136,11 @@ class CleanEveryN(CustomBehavior):
self.fixture.setup()
self.fixture.await_ready()
+ self.hook_test_case.return_code = 0
+ test_report.addSuccess(self.hook_test_case)
+ finally:
+ test_report.stopTest(self.hook_test_case)
+
class JsCustomBehavior(CustomBehavior):
def __init__(self, logger, fixture, js_filename, description, shell_options=None):