Skip to content

Commit 495d9a4

Browse files
committed
PYTHON-4890 Use shrub.py for storage engine tests
1 parent 849ed79 commit 495d9a4

File tree

2 files changed

+66
-50
lines changed

2 files changed

+66
-50
lines changed

.evergreen/config.yml

Lines changed: 28 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -2273,19 +2273,6 @@ axes:
22732273
variables:
22742274
NO_EXT: ""
22752275

2276-
# Choice of MongoDB storage engine
2277-
- id: storage-engine
2278-
display_name: Storage
2279-
values:
2280-
- id: mmapv1
2281-
display_name: MMAPv1
2282-
variables:
2283-
STORAGE_ENGINE: "mmapv1"
2284-
- id: inmemory
2285-
display_name: InMemory
2286-
variables:
2287-
STORAGE_ENGINE: "inmemory"
2288-
22892276
# Run with test commands disabled on server?
22902277
- id: disableTestCommands
22912278
display_name: Disable test commands
@@ -3344,6 +3331,34 @@ buildvariants:
33443331
SSL: ssl
33453332
PYTHON_BINARY: /opt/python/pypy3.10/bin/python3
33463333

3334+
# Storage Engine tests.
3335+
- name: storage-inmemory-rhel8-py3.9
3336+
tasks:
3337+
- name: .standalone .4.0
3338+
- name: .standalone .4.4
3339+
- name: .standalone .5.0
3340+
- name: .standalone .6.0
3341+
- name: .standalone .7.0
3342+
- name: .standalone .8.0
3343+
- name: .standalone .rapid
3344+
- name: .standalone .latest
3345+
display_name: Storage InMemory RHEL8 py3.9
3346+
run_on:
3347+
- rhel87-small
3348+
expansions:
3349+
STORAGE_ENGINE: inmemory
3350+
PYTHON_BINARY: /opt/python/3.9/bin/python3
3351+
- name: storage-mmapv1-rhel8-py3.9
3352+
tasks:
3353+
- name: .standalone .4.0
3354+
- name: .replica_set .4.0
3355+
display_name: Storage MMAPv1 RHEL8 py3.9
3356+
run_on:
3357+
- rhel87-small
3358+
expansions:
3359+
STORAGE_ENGINE: mmapv1
3360+
PYTHON_BINARY: /opt/python/3.9/bin/python3
3361+
33473362
# Versioned API tests.
33483363
- name: versioned-api-require-v1-rhel8-py3.9-auth
33493364
tasks:
@@ -3485,38 +3500,6 @@ buildvariants:
34853500
tasks:
34863501
- ".5.0"
34873502

3488-
# Storage engine tests on RHEL 8.4 (x86_64) with Python 3.9.
3489-
- matrix_name: "tests-storage-engines"
3490-
matrix_spec:
3491-
platform: rhel8
3492-
storage-engine: "*"
3493-
python-version: "3.9"
3494-
display_name: "Storage ${storage-engine} ${python-version} ${platform}"
3495-
rules:
3496-
- if:
3497-
platform: rhel8
3498-
storage-engine: ["inmemory"]
3499-
python-version: "*"
3500-
then:
3501-
add_tasks:
3502-
- "test-latest-standalone"
3503-
- "test-8.0-standalone"
3504-
- "test-7.0-standalone"
3505-
- "test-6.0-standalone"
3506-
- "test-5.0-standalone"
3507-
- "test-4.4-standalone"
3508-
- "test-4.2-standalone"
3509-
- "test-4.0-standalone"
3510-
- if:
3511-
# MongoDB 4.2 drops support for MMAPv1
3512-
platform: rhel8
3513-
storage-engine: ["mmapv1"]
3514-
python-version: "*"
3515-
then:
3516-
add_tasks:
3517-
- "test-4.0-standalone"
3518-
- "test-4.0-replica_set"
3519-
35203503
# enableTestCommands=0 tests on RHEL 8.4 (x86_64) with Python 3.9.
35213504
- matrix_name: "test-disableTestCommands"
35223505
matrix_spec:

.evergreen/scripts/generate_config.py

Lines changed: 38 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -111,14 +111,24 @@ def get_python_binary(python: str, host: str) -> str:
111111
raise ValueError(f"no match found for python {python} on {host}")
112112

113113

114-
def get_pythons_from(min_version: str) -> list[str]:
115-
"""Get all pythons starting from a minimum version."""
114+
def get_versions_from(min_version: str) -> list[str]:
115+
"""Get all server versions starting from a minimum version."""
116116
min_version_float = float(min_version)
117117
rapid_latest = ["rapid", "latest"]
118118
versions = [v for v in ALL_VERSIONS if v not in rapid_latest]
119119
return [v for v in versions if float(v) >= min_version_float] + rapid_latest
120120

121121

122+
def get_versions_until(max_version: str) -> list[str]:
123+
"""Get all server version up to a max version."""
124+
max_version_float = float(max_version)
125+
versions = [v for v in ALL_VERSIONS if v not in ["rapid", "latest"]]
126+
versions = [v for v in versions if float(v) <= max_version_float]
127+
if not len(versions):
128+
raise ValueError(f"No server versions found less <= {max_version}")
129+
return versions
130+
131+
122132
def get_display_name(base: str, host: str, **kwargs) -> str:
123133
"""Get the display name of a variant."""
124134
display_name = f"{base} {HOSTS[host].display_name}"
@@ -250,7 +260,7 @@ def create_server_variants() -> list[BuildVariant]:
250260
tasks = [f".{topology}"]
251261
# MacOS arm64 only works on server versions 6.0+
252262
if host == "macos-arm64":
253-
tasks = [f".{topology} .{version}" for version in get_pythons_from("6.0")]
263+
tasks = [f".{topology} .{version}" for version in get_versions_from("6.0")]
254264
expansions = dict(AUTH=auth, SSL=ssl, TEST_SUITES=test_suite, SKIP_CSOT_TESTS="true")
255265
display_name = get_display_name("Test", host, python=python, **expansions)
256266
variant = create_variant(
@@ -337,7 +347,7 @@ def create_load_balancer_variants():
337347
task_names = ["load-balancer-test"]
338348
batchtime = BATCHTIME_WEEK
339349
expansions_base = dict(test_loadbalancer="true")
340-
versions = get_pythons_from("6.0")
350+
versions = get_versions_from("6.0")
341351
variants = []
342352
pythons = CPYTHONS + PYPYS
343353
for ind, (version, (auth, ssl)) in enumerate(product(versions, AUTH_SSLS)):
@@ -449,10 +459,33 @@ def create_pyopenssl_variants():
449459
return variants
450460

451461

462+
def create_storage_engine_tests():
463+
host = "rhel8"
464+
engines = ["InMemory", "MMAPv1"]
465+
variants = []
466+
for engine in engines:
467+
python = CPYTHONS[0]
468+
expansions = dict(STORAGE_ENGINE=engine.lower())
469+
if engine == engines[0]:
470+
tasks = [f".standalone .{v}" for v in ALL_VERSIONS]
471+
else:
472+
# MongoDB 4.2 drops support for MMAPv1
473+
versions = get_versions_until("4.0")
474+
tasks = [f".standalone .{v}" for v in versions] + [
475+
f".replica_set .{v}" for v in versions
476+
]
477+
display_name = get_display_name(f"Storage {engine}", host, python=python)
478+
variant = create_variant(
479+
tasks, display_name, host=host, python=python, expansions=expansions
480+
)
481+
variants.append(variant)
482+
return variants
483+
484+
452485
def create_versioned_api_tests():
453486
host = "rhel8"
454487
tags = ["versionedApi_tag"]
455-
tasks = [f".standalone .{v}" for v in get_pythons_from("5.0")]
488+
tasks = [f".standalone .{v}" for v in get_versions_from("5.0")]
456489
variants = []
457490
types = ["require v1", "accept v2"]
458491

0 commit comments

Comments
 (0)