summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSiran Wang <siran.wang@mongodb.com>2021-06-07 16:39:33 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-06-10 15:56:54 +0000
commit75f9277a30e82c8db2b84e545cfd549968ec45ff (patch)
treed943b632ce37235fdafec838cd8f67081762f3a0
parentf2643946a9253a2accc8f3b0b8a95ee2fd84f22c (diff)
downloadmongo-75f9277a30e82c8db2b84e545cfd549968ec45ff.tar.gz
SERVER-55296 support enhanced multiversion api
-rw-r--r--buildscripts/resmokelib/config.py18
-rw-r--r--buildscripts/resmokelib/configure_resmoke.py2
-rw-r--r--buildscripts/resmokelib/run/__init__.py5
-rw-r--r--buildscripts/resmokelib/testing/fixtures/_builder.py36
-rw-r--r--buildscripts/resmokelib/testing/fixtures/interface.py4
-rw-r--r--buildscripts/resmokelib/testing/fixtures/replicaset.py1
6 files changed, 52 insertions, 14 deletions
diff --git a/buildscripts/resmokelib/config.py b/buildscripts/resmokelib/config.py
index acc4036eab2..f3759f7949a 100644
--- a/buildscripts/resmokelib/config.py
+++ b/buildscripts/resmokelib/config.py
@@ -103,6 +103,7 @@ DEFAULTS = {
"transport_layer": None,
"user_friendly_output": None,
"mixed_bin_versions": None,
+ "multiversion_bin_version": "last_lts",
"linear_chain": None,
"num_replset_nodes": None,
"num_shards": None,
@@ -239,6 +240,20 @@ class SuiteOptions(_SuiteOptions):
SuiteOptions.ALL_INHERITED = SuiteOptions( # type: ignore
**dict(list(zip(SuiteOptions._fields, itertools.repeat(SuiteOptions.INHERIT)))))
+
+class MultiversionOptions(object):
+ """Represent the multiversion version choices."""
+
+ LAST_LTS = "last_lts"
+ LAST_CONTINOUS = "last_continous"
+
+ @classmethod
+ def all_options(cls):
+ """Return available version options for multiversion."""
+
+ return [cls.LAST_LTS, cls.LAST_CONTINOUS]
+
+
##
# Variables that are set by the user at the command line or with --options.
##
@@ -448,6 +463,9 @@ MAJORITY_READ_CONCERN = None
# Specifies the binary versions of each node we should run for a replica set.
MIXED_BIN_VERSIONS = None
+# Specifies the binary version of last-lts or last-continous when multiversion enabled
+MULTIVERSION_BIN_VERSION = None
+
# Specifies the number of replica set members in a ReplicaSetFixture.
NUM_REPLSET_NODES = None
diff --git a/buildscripts/resmokelib/configure_resmoke.py b/buildscripts/resmokelib/configure_resmoke.py
index f5e3394b13f..a0e9e00da96 100644
--- a/buildscripts/resmokelib/configure_resmoke.py
+++ b/buildscripts/resmokelib/configure_resmoke.py
@@ -208,6 +208,8 @@ def _update_config_vars(values): # pylint: disable=too-many-statements,too-many
if _config.MIXED_BIN_VERSIONS is not None:
_config.MIXED_BIN_VERSIONS = _config.MIXED_BIN_VERSIONS.split("-")
+ _config.MULTIVERSION_BIN_VERSION = config.pop("multiversion_bin_version")
+
_config.INSTALL_DIR = config.pop("install_dir")
if _config.INSTALL_DIR is not None:
# Normalize the path so that on Windows dist-test/bin
diff --git a/buildscripts/resmokelib/run/__init__.py b/buildscripts/resmokelib/run/__init__.py
index 7453aa6a4cd..f50c57b564e 100644
--- a/buildscripts/resmokelib/run/__init__.py
+++ b/buildscripts/resmokelib/run/__init__.py
@@ -765,6 +765,11 @@ class RunPlugin(PluginInterface):
" with two shards and two replica set nodes each, specify 'old-new-old-new'.")
parser.add_argument(
+ "--multiversionBinVersion", type=str, dest="multiversion_bin_version",
+ choices=config.MultiversionOptions.all_options(),
+ help="Chose the multiverion binary version as last-lts or last-continous.")
+
+ parser.add_argument(
"--linearChain", action="store", dest="linear_chain", choices=("on", "off"),
metavar="ON|OFF", help="Enable or disable linear chaining for tests using "
"ReplicaSetFixture.")
diff --git a/buildscripts/resmokelib/testing/fixtures/_builder.py b/buildscripts/resmokelib/testing/fixtures/_builder.py
index 685791a84ca..5e969e1cc1c 100644
--- a/buildscripts/resmokelib/testing/fixtures/_builder.py
+++ b/buildscripts/resmokelib/testing/fixtures/_builder.py
@@ -63,6 +63,8 @@ class ReplSetBuilder(FixtureBuilder):
"""Build a replica set."""
# We hijack the mixed_bin_versions passed to the fixture.
mixed_bin_versions = kwargs.pop("mixed_bin_versions", config.MIXED_BIN_VERSIONS)
+ multiversion_bin_version = kwargs.pop("multiversion_bin_version",
+ config.MULTIVERSION_BIN_VERSION)
if USE_LEGACY_MULTIVERSION:
# We mark the use of the legacy multiversion system by allowing
# access to mixed_bin_versions.
@@ -86,7 +88,20 @@ class ReplSetBuilder(FixtureBuilder):
classes = []
fcv = None
- lts_class_suffix = "_last_lts"
+ multiversion_class_suffix = "_" + multiversion_bin_version
+ shell_version = {
+ config.MultiversionOptions.LAST_LTS:
+ multiversionconstants.LAST_LTS_MONGO_BINARY,
+ config.MultiversionOptions.LAST_CONTINOUS:
+ multiversionconstants.LAST_CONTINUOUS_MONGO_BINARY
+ }[multiversion_bin_version]
+
+ mongod_version = {
+ config.MultiversionOptions.LAST_LTS:
+ multiversionconstants.LAST_LTS_MONGOD_BINARY,
+ config.MultiversionOptions.LAST_CONTINOUS:
+ multiversionconstants.LAST_CONTINUOUS_MONGOD_BINARY
+ }[multiversion_bin_version]
if mixed_bin_versions is None:
executables = [latest_mongod for x in range(num_nodes)]
@@ -102,17 +117,17 @@ class ReplSetBuilder(FixtureBuilder):
]
classes = [latest_class for x in range(num_nodes)]
else:
- load_version(version_path_suffix=lts_class_suffix,
- shell_path=multiversionconstants.LAST_LTS_MONGO_BINARY)
+ load_version(version_path_suffix=multiversion_class_suffix,
+ shell_path=shell_version)
if not is_config_svr:
executables = [
- latest_mongod if
- (x == "new") else multiversionconstants.LAST_LTS_MONGOD_BINARY
+ latest_mongod if (x == "new") else mongod_version
for x in mixed_bin_versions
]
classes = [
- latest_class if (x == "new") else f"{latest_class}{lts_class_suffix}"
+ latest_class if
+ (x == "new") else f"{latest_class}{multiversion_class_suffix}"
for x in mixed_bin_versions
]
if is_config_svr:
@@ -122,7 +137,10 @@ class ReplSetBuilder(FixtureBuilder):
classes = [latest_class, latest_class]
num_versions = len(mixed_bin_versions)
- fcv = multiversionconstants.LAST_LTS_FCV
+ fcv = {
+ config.MultiversionOptions.LAST_LTS: multiversionconstants.LAST_LTS_FCV,
+ config.MultiversionOptions.LAST_CONTINOUS: multiversionconstants.LAST_CONTINUOUS_FCV
+ }[multiversion_bin_version]
if num_versions != num_nodes and not is_config_svr:
msg = (("The number of binary versions specified: {} do not match the number of"\
@@ -146,7 +164,7 @@ class ReplSetBuilder(FixtureBuilder):
return replset
@classmethod
- def _new_mongod(cls, replset, index, executable, mongod_class): # TODO Not a class method
+ def _new_mongod(cls, replset, index, executable, mongod_class):
"""Return a standalone.MongoDFixture configured to be used as replica-set member."""
mongod_logger = replset.get_logger_for_mongod(index)
mongod_options = replset.get_options_for_mongod(index)
@@ -157,7 +175,7 @@ class ReplSetBuilder(FixtureBuilder):
def load_version(version_path_suffix=None, shell_path=None):
- """Load the last_lts fixtures."""
+ """Load the last_lts/last_continous fixtures."""
with RETRIEVE_LOCK, registry.suffix(version_path_suffix):
# Only one thread needs to retrieve the fixtures.
retrieve_dir = os.path.relpath(os.path.join(RETRIEVE_DIR, version_path_suffix))
diff --git a/buildscripts/resmokelib/testing/fixtures/interface.py b/buildscripts/resmokelib/testing/fixtures/interface.py
index 86def51322a..8f11a9976a4 100644
--- a/buildscripts/resmokelib/testing/fixtures/interface.py
+++ b/buildscripts/resmokelib/testing/fixtures/interface.py
@@ -76,10 +76,6 @@ class Fixture(object, metaclass=registry.make_registry_metaclass(_FIXTURES)): #
# is defined for all subclasses of Fixture.
REGISTERED_NAME = "Fixture"
- _LAST_LTS_FCV = multiversion.LAST_LTS_FCV
- _LATEST_FCV = multiversion.LATEST_FCV
- _LAST_LTS_BIN_VERSION = multiversion.LAST_LTS_BIN_VERSION
-
AWAIT_READY_TIMEOUT_SECS = 300
def __init__(self, logger, job_num, fixturelib, dbpath_prefix=None):
diff --git a/buildscripts/resmokelib/testing/fixtures/replicaset.py b/buildscripts/resmokelib/testing/fixtures/replicaset.py
index 7c8ac94bc6b..5dd35620212 100644
--- a/buildscripts/resmokelib/testing/fixtures/replicaset.py
+++ b/buildscripts/resmokelib/testing/fixtures/replicaset.py
@@ -129,7 +129,6 @@ class ReplicaSetFixture(interface.ReplFixture): # pylint: disable=too-many-inst
self.initial_sync_node.await_ready()
# Legacy multiversion line
- # TODO (SERVER-57255): Don't delete steady state constraint options when backporting to 5.0.
if self.mixed_bin_versions:
for i in range(self.num_nodes):
print("node[i] version: " + self.nodes[i].mongod_executable +