def __init__(self, suite_name: str) -> None: """ Initialize the subcommand. :param suite_name: Suite to discover. """ _parser.set_run_options() self.suite_name = suite_name self.suite_config = suitesconfig
def __init__(self, proxy_config: ResmokeProxyConfig) -> None: """ Initialize the service. :param proxy_config: Configuration for the proxy. """ _parser.set_run_options() self.suitesconfig = suitesconfig self.resmoke_suite_dir = proxy_config.resmoke_suite_dir
def __init__(self, evergreen_api: EvergreenApi, config_options: ConfigOptions): """ Initialize the object. :param evergreen_api: Evergreen API client. :param config_options: Generation configuration options. """ self.evergreen_api = evergreen_api self.config_options = config_options self.test_list = [] # Populate config values for methods like list_tests() _parser.set_run_options()
def test_build_sharded_cluster_multiversion(self): parser.set_run_options() fixture_config = { "mongod_options": { SET_PARAMS: { "enableTestCommands": 1 } }, "configsvr_options": { "num_nodes": 2 }, "num_shards": 2, "num_rs_nodes_per_shard": 2, "mixed_bin_versions": "new_old_old_new", "old_bin_version": "last_lts", } sharded_cluster = under_test.make_fixture(self.fixture_class_name, self.mock_logger, self.job_num, **fixture_config) self.assertEqual(len(sharded_cluster.configsvr.nodes), 2) self.assertEqual(len(sharded_cluster.shards), 2) self.assertEqual(len(sharded_cluster.shards[0].nodes), 2) self.assertEqual(len(sharded_cluster.shards[1].nodes), 2) self.assertEqual(len(sharded_cluster.mongos), 1) from buildscripts.resmokelib import multiversionconstants # configsvr nodes are always latest self.assertEqual(sharded_cluster.configsvr.nodes[0].mongod_executable, config.DEFAULT_MONGOD_EXECUTABLE) self.assertEqual(sharded_cluster.configsvr.nodes[1].mongod_executable, config.DEFAULT_MONGOD_EXECUTABLE) # 1st repl set nodes are latest and last-lts (new_old) self.assertEqual(sharded_cluster.shards[0].nodes[0].mongod_executable, config.DEFAULT_MONGOD_EXECUTABLE) self.assertEqual(sharded_cluster.shards[0].nodes[1].mongod_executable, multiversionconstants.LAST_LTS_MONGOD_BINARY) self.assertEqual(sharded_cluster.shards[0].fcv, multiversionconstants.LAST_LTS_FCV) # 2st repl set nodes are last-lts and latest (old_new) self.assertEqual(sharded_cluster.shards[1].nodes[0].mongod_executable, multiversionconstants.LAST_LTS_MONGOD_BINARY) self.assertEqual(sharded_cluster.shards[1].nodes[1].mongod_executable, config.DEFAULT_MONGOD_EXECUTABLE) self.assertEqual(sharded_cluster.shards[0].fcv, multiversionconstants.LAST_LTS_FCV) # mongos is last-lts self.assertEqual(sharded_cluster.mongos[0].mongos_executable, multiversionconstants.LAST_LTS_MONGOS_BINARY)
def __init__(self, evergreen_api: EvergreenApi, config_options: ConfigOptions, generate_config: Optional[GenerationConfiguration] = None) -> None: """ Initialize the object. :param evergreen_api: Evergreen API client. :param config_options: Generation configuration options. :param generate_config: Configuration for how generate tasks. """ self.evergreen_api = evergreen_api self.config_options = config_options self.generate_options = GenerationConfiguration.default_config() if generate_config: self.generate_options = generate_config self.test_list = [] # Populate config values for methods like list_tests() _parser.set_run_options()
def test_build_sharded_cluster_simple(self): parser.set_run_options() fixture_config = { "mongod_options": { SET_PARAMS: { "enableTestCommands": 1 } } } sharded_cluster = under_test.make_fixture(self.fixture_class_name, self.mock_logger, self.job_num, **fixture_config) self.assertEqual(len(sharded_cluster.configsvr.nodes), 1) self.assertEqual(len(sharded_cluster.shards), 1) self.assertEqual(len(sharded_cluster.shards[0].nodes), 1) self.assertEqual(len(sharded_cluster.mongos), 1) from buildscripts.resmokelib import multiversionconstants self.assertEqual(sharded_cluster.shards[0].fcv, multiversionconstants.LATEST_FCV)
def test_build_sharded_cluster_with_feature_flags(self): ff_name = "featureFlagDummy" parser.set_run_options(f"--additionalFeatureFlags={ff_name}") fixture_config = { "mongod_options": { SET_PARAMS: { "enableTestCommands": 1 } } } sharded_cluster = under_test.make_fixture(self.fixture_class_name, self.mock_logger, self.job_num, **fixture_config) self.assertEqual(len(sharded_cluster.configsvr.nodes), 1) self.assertEqual(len(sharded_cluster.shards), 1) self.assertEqual(len(sharded_cluster.shards[0].nodes), 1) self.assertEqual(len(sharded_cluster.mongos), 1) from buildscripts.resmokelib import multiversionconstants self.assertEqual(sharded_cluster.shards[0].fcv, multiversionconstants.LATEST_FCV) # feature flags are set self.assertIn( ff_name, sharded_cluster.configsvr.nodes[0].mongod_options[SET_PARAMS]) self.assertTrue( sharded_cluster.configsvr.nodes[0].mongod_options[SET_PARAMS] [ff_name]) self.assertIn( ff_name, sharded_cluster.shards[0].nodes[0].mongod_options[SET_PARAMS]) self.assertTrue( sharded_cluster.shards[0].nodes[0].mongod_options[SET_PARAMS] [ff_name]) self.assertIn(ff_name, sharded_cluster.mongos[0].mongos_options[SET_PARAMS]) self.assertTrue( sharded_cluster.mongos[0].mongos_options[SET_PARAMS][ff_name])
def __init__(self, run_options="") -> None: """Initialize the service.""" _parser.set_run_options(run_options) self._suite_config = _suiteconfig
def tearDown(self): _parser.set_run_options()
import sys import unittest from datetime import datetime, timedelta from math import ceil import requests from mock import patch, MagicMock from shrub.v2 import BuildVariant, ShrubProject import buildscripts.evergreen_burn_in_tests as under_test from buildscripts.ciconfig.evergreen import parse_evergreen_file import buildscripts.resmokelib.parser as _parser import buildscripts.resmokelib.config as _config import buildscripts.util.teststats as teststats_utils _parser.set_run_options() # pylint: disable=missing-docstring,invalid-name,unused-argument,no-self-use,protected-access NS = "buildscripts.evergreen_burn_in_tests" def ns(relative_name): # pylint: disable=invalid-name """Return a full name from a name relative to the test module"s name space.""" return NS + "." + relative_name def mock_a_file(filename): change = MagicMock(a_path=filename) return change
def test_build_sharded_cluster_multiversion_with_feature_flags(self): ff_name = "featureFlagDummy" parser.set_run_options(f"--additionalFeatureFlags={ff_name}") fixture_config = { "mongod_options": { SET_PARAMS: { "enableTestCommands": 1 } }, "configsvr_options": { "num_nodes": 2 }, "num_shards": 2, "num_rs_nodes_per_shard": 2, "mixed_bin_versions": "new_old_old_new", "old_bin_version": "last_lts", } sharded_cluster = under_test.make_fixture(self.fixture_class_name, self.mock_logger, self.job_num, **fixture_config) self.assertEqual(len(sharded_cluster.configsvr.nodes), 2) self.assertEqual(len(sharded_cluster.shards), 2) self.assertEqual(len(sharded_cluster.shards[0].nodes), 2) self.assertEqual(len(sharded_cluster.shards[1].nodes), 2) self.assertEqual(len(sharded_cluster.mongos), 1) # feature flags are set on new versions self.assertIn( ff_name, sharded_cluster.configsvr.nodes[0].mongod_options[SET_PARAMS]) self.assertTrue( sharded_cluster.configsvr.nodes[0].mongod_options[SET_PARAMS] [ff_name]) self.assertIn( ff_name, sharded_cluster.configsvr.nodes[1].mongod_options[SET_PARAMS]) self.assertTrue( sharded_cluster.configsvr.nodes[1].mongod_options[SET_PARAMS] [ff_name]) self.assertIn( ff_name, sharded_cluster.shards[0].nodes[0].mongod_options[SET_PARAMS]) self.assertTrue( sharded_cluster.shards[0].nodes[0].mongod_options[SET_PARAMS] [ff_name]) self.assertIn( ff_name, sharded_cluster.shards[1].nodes[1].mongod_options[SET_PARAMS]) self.assertTrue( sharded_cluster.shards[1].nodes[1].mongod_options[SET_PARAMS] [ff_name]) # feature flags are NOT set on old versions self.assertNotIn( ff_name, sharded_cluster.shards[0].nodes[1].mongod_options[SET_PARAMS]) self.assertNotIn( ff_name, sharded_cluster.shards[1].nodes[0].mongod_options[SET_PARAMS]) self.assertNotIn(ff_name, sharded_cluster.mongos[0].mongos_options[SET_PARAMS])