summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Hirschhorn <max.hirschhorn@mongodb.com>2018-03-23 18:58:19 -0400
committerMax Hirschhorn <max.hirschhorn@mongodb.com>2018-03-23 18:58:19 -0400
commit28602b519c026df57bf9137d1fb795e6043de5ed (patch)
tree9d21fa86c09d00f535b903ed55e68bd826d69308
parent73ad951060eb9557e7ac8768d84ce81a24f16240 (diff)
downloadmongo-28602b519c026df57bf9137d1fb795e6043de5ed.tar.gz
SERVER-34116 Switch to use NoOpFixture for fixture.NOOP_FIXTURE_CLASS.
The Fixture class raises a NotImplementedError exception for its get_driver_connection_url() method, so it can no longer be used as a no-op fixture. These changes were taken from a2f6a2294feb20a9a3a11dcdbfbfed05f4756c1b2.
-rw-r--r--buildscripts/resmokelib/testing/fixtures/__init__.py4
-rw-r--r--buildscripts/resmokelib/testing/fixtures/interface.py13
2 files changed, 15 insertions, 2 deletions
diff --git a/buildscripts/resmokelib/testing/fixtures/__init__.py b/buildscripts/resmokelib/testing/fixtures/__init__.py
index d68a66911d2..f4589f20615 100644
--- a/buildscripts/resmokelib/testing/fixtures/__init__.py
+++ b/buildscripts/resmokelib/testing/fixtures/__init__.py
@@ -4,7 +4,7 @@ Fixtures for executing JSTests against.
from __future__ import absolute_import
-from .interface import Fixture, ReplFixture
+from .interface import NoOpFixture, ReplFixture
from .standalone import MongoDFixture
from .replicaset import ReplicaSetFixture
from .masterslave import MasterSlaveFixture
@@ -14,7 +14,7 @@ from .shardedcluster import ShardedClusterFixture
NOOP_FIXTURE_CLASS = "Fixture"
_FIXTURES = {
- "Fixture": Fixture,
+ "Fixture": NoOpFixture,
"MongoDFixture": MongoDFixture,
"ReplicaSetFixture": ReplicaSetFixture,
"MasterSlaveFixture": MasterSlaveFixture,
diff --git a/buildscripts/resmokelib/testing/fixtures/interface.py b/buildscripts/resmokelib/testing/fixtures/interface.py
index 83418502ead..f2cb1b9c8b8 100644
--- a/buildscripts/resmokelib/testing/fixtures/interface.py
+++ b/buildscripts/resmokelib/testing/fixtures/interface.py
@@ -147,3 +147,16 @@ class ReplFixture(Fixture):
if remaining <= 0.0:
raise errors.ServerFailure("Failed to connect to the primary on port %d" %
self.port)
+
+class NoOpFixture(Fixture):
+ """A Fixture implementation that does not start any servers.
+
+ Used when the MongoDB deployment is started by the JavaScript test itself with MongoRunner,
+ ReplSetTest, or ShardingTest.
+ """
+
+ def get_internal_connection_string(self):
+ return None
+
+ def get_driver_connection_url(self):
+ return None