Skip to content

Commit 5280596

Browse files
authored
PYTHON-4890 Use shrub.py for storage engine tests (mongodb#1955)
1 parent 60109e6 commit 5280596

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
@@ -2260,19 +2260,6 @@ axes:
22602260
variables:
22612261
NO_EXT: ""
22622262

2263-
# Choice of MongoDB storage engine
2264-
- id: storage-engine
2265-
display_name: Storage
2266-
values:
2267-
- id: mmapv1
2268-
display_name: MMAPv1
2269-
variables:
2270-
STORAGE_ENGINE: "mmapv1"
2271-
- id: inmemory
2272-
display_name: InMemory
2273-
variables:
2274-
STORAGE_ENGINE: "inmemory"
2275-
22762263
# Run with test commands disabled on server?
22772264
- id: disableTestCommands
22782265
display_name: Disable test commands
@@ -3331,6 +3318,34 @@ buildvariants:
33313318
SSL: ssl
33323319
PYTHON_BINARY: /opt/python/pypy3.10/bin/python3
33333320

3321+
# Storage Engine tests.
3322+
- name: storage-inmemory-rhel8-py3.9
3323+
tasks:
3324+
- name: .standalone .4.0
3325+
- name: .standalone .4.4
3326+
- name: .standalone .5.0
3327+
- name: .standalone .6.0
3328+
- name: .standalone .7.0
3329+
- name: .standalone .8.0
3330+
- name: .standalone .rapid
3331+
- name: .standalone .latest
3332+
display_name: Storage InMemory RHEL8 py3.9
3333+
run_on:
3334+
- rhel87-small
3335+
expansions:
3336+
STORAGE_ENGINE: inmemory
3337+
PYTHON_BINARY: /opt/python/3.9/bin/python3
3338+
- name: storage-mmapv1-rhel8-py3.9
3339+
tasks:
3340+
- name: .standalone .4.0
3341+
- name: .replica_set .4.0
3342+
display_name: Storage MMAPv1 RHEL8 py3.9
3343+
run_on:
3344+
- rhel87-small
3345+
expansions:
3346+
STORAGE_ENGINE: mmapv1
3347+
PYTHON_BINARY: /opt/python/3.9/bin/python3
3348+
33343349
# Versioned API tests.
33353350
- name: versioned-api-require-v1-rhel8-py3.9-auth
33363351
tasks:
@@ -3503,38 +3518,6 @@ buildvariants:
35033518
tasks:
35043519
- ".5.0"
35053520

3506-
# Storage engine tests on RHEL 8.4 (x86_64) with Python 3.9.
3507-
- matrix_name: "tests-storage-engines"
3508-
matrix_spec:
3509-
platform: rhel8
3510-
storage-engine: "*"
3511-
python-version: "3.9"
3512-
display_name: "Storage ${storage-engine} ${python-version} ${platform}"
3513-
rules:
3514-
- if:
3515-
platform: rhel8
3516-
storage-engine: ["inmemory"]
3517-
python-version: "*"
3518-
then:
3519-
add_tasks:
3520-
- "test-latest-standalone"
3521-
- "test-8.0-standalone"
3522-
- "test-7.0-standalone"
3523-
- "test-6.0-standalone"
3524-
- "test-5.0-standalone"
3525-
- "test-4.4-standalone"
3526-
- "test-4.2-standalone"
3527-
- "test-4.0-standalone"
3528-
- if:
3529-
# MongoDB 4.2 drops support for MMAPv1
3530-
platform: rhel8
3531-
storage-engine: ["mmapv1"]
3532-
python-version: "*"
3533-
then:
3534-
add_tasks:
3535-
- "test-4.0-standalone"
3536-
- "test-4.0-replica_set"
3537-
35383521
# enableTestCommands=0 tests on RHEL 8.4 (x86_64) with Python 3.9.
35393522
- matrix_name: "test-disableTestCommands"
35403523
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)