summaryrefslogtreecommitdiff
path: root/buildscripts
diff options
context:
space:
mode:
authorCharlie Swanson <charlie.swanson@mongodb.com>2017-04-17 14:53:40 -0400
committerMax Hirschhorn <max.hirschhorn@mongodb.com>2017-04-17 14:53:40 -0400
commita40bbce796ecff9dd8dd4ddb79bb1ec1bd259965 (patch)
treee0ad9f518accd64b75827505a1b3f1ed8295caba /buildscripts
parent67e49117a9d8a6b1ba408bfdea4108487877e65a (diff)
downloadmongo-a40bbce796ecff9dd8dd4ddb79bb1ec1bd259965.tar.gz
SERVER-22200 Correct logic to mark a test as a failure.
(cherry picked from commit 4d835254c61fc5984a2583bb9815ac5de0785991)
Diffstat (limited to 'buildscripts')
-rw-r--r--buildscripts/resmokelib/testing/fixtures/shardedcluster.py5
-rw-r--r--buildscripts/resmokelib/testing/fixtures/standalone.py5
-rw-r--r--buildscripts/resmokelib/testing/job.py16
-rw-r--r--buildscripts/resmokelib/testing/report.py2
4 files changed, 15 insertions, 13 deletions
diff --git a/buildscripts/resmokelib/testing/fixtures/shardedcluster.py b/buildscripts/resmokelib/testing/fixtures/shardedcluster.py
index e6523449636..282319a235c 100644
--- a/buildscripts/resmokelib/testing/fixtures/shardedcluster.py
+++ b/buildscripts/resmokelib/testing/fixtures/shardedcluster.py
@@ -301,9 +301,10 @@ class _MongoSFixture(interface.Fixture):
# be established.
while True:
# Check whether the mongos exited for some reason.
- if self.mongos.poll() is not None:
+ exit_code = self.mongos.poll()
+ if exit_code is not None:
raise errors.ServerFailure("Could not connect to mongos on port %d, process ended"
- " unexpectedly." % (self.port))
+ " unexpectedly with code %d." % (self.port, exit_code))
try:
# Use a shorter connection timeout to more closely satisfy the requested deadline.
diff --git a/buildscripts/resmokelib/testing/fixtures/standalone.py b/buildscripts/resmokelib/testing/fixtures/standalone.py
index 87e661e2fab..edb38177fa2 100644
--- a/buildscripts/resmokelib/testing/fixtures/standalone.py
+++ b/buildscripts/resmokelib/testing/fixtures/standalone.py
@@ -127,9 +127,10 @@ class MongoDFixture(interface.Fixture):
# be established.
while True:
# Check whether the mongod exited for some reason.
- if self.mongod.poll() is not None:
+ exit_code = self.mongod.poll()
+ if exit_code is not None:
raise errors.ServerFailure("Could not connect to mongod on port %d, process ended"
- " unexpectedly." % (self.port))
+ " unexpectedly with code %d." % (self.port, exit_code))
try:
# Use a shorter connection timeout to more closely satisfy the requested deadline.
diff --git a/buildscripts/resmokelib/testing/job.py b/buildscripts/resmokelib/testing/job.py
index 4ad35542982..d1856551fd1 100644
--- a/buildscripts/resmokelib/testing/job.py
+++ b/buildscripts/resmokelib/testing/job.py
@@ -113,14 +113,14 @@ class Job(object):
raise
except errors.ServerFailure:
- self.logger.error("%s marked as a failure by a hook's before_test.",
- test.shortDescription())
+ self.logger.exception("%s marked as a failure by a hook's before_test.",
+ test.shortDescription())
self._fail_test(test, sys.exc_info(), return_code=2)
raise errors.StopExecution("A hook's before_test failed")
except errors.TestFailure:
- self.logger.error("%s marked as a failure by a hook's before_test.",
- test.shortDescription())
+ self.logger.exception("%s marked as a failure by a hook's before_test.",
+ test.shortDescription())
self._fail_test(test, sys.exc_info(), return_code=1)
if config.FAIL_FAST:
raise errors.StopExecution("A hook's before_test failed")
@@ -147,14 +147,14 @@ class Job(object):
raise
except errors.ServerFailure:
- self.logger.error("%s marked as a failure by a hook's after_test.",
- test.shortDescription())
+ self.logger.exception("%s marked as a failure by a hook's after_test.",
+ test.shortDescription())
self.report.setFailure(test, return_code=2)
raise errors.StopExecution("A hook's after_test failed")
except errors.TestFailure:
- self.logger.error("%s marked as a failure by a hook's after_test.",
- test.shortDescription())
+ self.logger.exception("%s marked as a failure by a hook's after_test.",
+ test.shortDescription())
self.report.setFailure(test, return_code=1)
if config.FAIL_FAST:
raise errors.StopExecution("A hook's after_test failed")
diff --git a/buildscripts/resmokelib/testing/report.py b/buildscripts/resmokelib/testing/report.py
index a5dc8744ddb..2ef1883f623 100644
--- a/buildscripts/resmokelib/testing/report.py
+++ b/buildscripts/resmokelib/testing/report.py
@@ -201,7 +201,7 @@ class TestReport(unittest.TestResult):
if test_info.end_time is None:
raise ValueError("stopTest was not called on %s" % (test.basename()))
- test_info.status = "error"
+ test_info.status = "fail"
test_info.return_code = return_code
# Recompute number of success, failures, and errors.