PYTHON-4890 Use shrub.py for storage engine tests (#1955)

This commit is contained in:
Steven Silvester 2024-10-21 08:16:12 -05:00 committed by GitHub
parent 60109e660c
commit 5280596141
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 66 additions and 50 deletions

View File

@ -2260,19 +2260,6 @@ axes:
variables:
NO_EXT: ""
# Choice of MongoDB storage engine
- id: storage-engine
display_name: Storage
values:
- id: mmapv1
display_name: MMAPv1
variables:
STORAGE_ENGINE: "mmapv1"
- id: inmemory
display_name: InMemory
variables:
STORAGE_ENGINE: "inmemory"
# Run with test commands disabled on server?
- id: disableTestCommands
display_name: Disable test commands
@ -3331,6 +3318,34 @@ buildvariants:
SSL: ssl
PYTHON_BINARY: /opt/python/pypy3.10/bin/python3
# Storage Engine tests.
- name: storage-inmemory-rhel8-py3.9
tasks:
- name: .standalone .4.0
- name: .standalone .4.4
- name: .standalone .5.0
- name: .standalone .6.0
- name: .standalone .7.0
- name: .standalone .8.0
- name: .standalone .rapid
- name: .standalone .latest
display_name: Storage InMemory RHEL8 py3.9
run_on:
- rhel87-small
expansions:
STORAGE_ENGINE: inmemory
PYTHON_BINARY: /opt/python/3.9/bin/python3
- name: storage-mmapv1-rhel8-py3.9
tasks:
- name: .standalone .4.0
- name: .replica_set .4.0
display_name: Storage MMAPv1 RHEL8 py3.9
run_on:
- rhel87-small
expansions:
STORAGE_ENGINE: mmapv1
PYTHON_BINARY: /opt/python/3.9/bin/python3
# Versioned API tests.
- name: versioned-api-require-v1-rhel8-py3.9-auth
tasks:
@ -3503,38 +3518,6 @@ buildvariants:
tasks:
- ".5.0"
# Storage engine tests on RHEL 8.4 (x86_64) with Python 3.9.
- matrix_name: "tests-storage-engines"
matrix_spec:
platform: rhel8
storage-engine: "*"
python-version: "3.9"
display_name: "Storage ${storage-engine} ${python-version} ${platform}"
rules:
- if:
platform: rhel8
storage-engine: ["inmemory"]
python-version: "*"
then:
add_tasks:
- "test-latest-standalone"
- "test-8.0-standalone"
- "test-7.0-standalone"
- "test-6.0-standalone"
- "test-5.0-standalone"
- "test-4.4-standalone"
- "test-4.2-standalone"
- "test-4.0-standalone"
- if:
# MongoDB 4.2 drops support for MMAPv1
platform: rhel8
storage-engine: ["mmapv1"]
python-version: "*"
then:
add_tasks:
- "test-4.0-standalone"
- "test-4.0-replica_set"
# enableTestCommands=0 tests on RHEL 8.4 (x86_64) with Python 3.9.
- matrix_name: "test-disableTestCommands"
matrix_spec:

View File

@ -111,14 +111,24 @@ def get_python_binary(python: str, host: str) -> str:
raise ValueError(f"no match found for python {python} on {host}")
def get_pythons_from(min_version: str) -> list[str]:
"""Get all pythons starting from a minimum version."""
def get_versions_from(min_version: str) -> list[str]:
"""Get all server versions starting from a minimum version."""
min_version_float = float(min_version)
rapid_latest = ["rapid", "latest"]
versions = [v for v in ALL_VERSIONS if v not in rapid_latest]
return [v for v in versions if float(v) >= min_version_float] + rapid_latest
def get_versions_until(max_version: str) -> list[str]:
"""Get all server version up to a max version."""
max_version_float = float(max_version)
versions = [v for v in ALL_VERSIONS if v not in ["rapid", "latest"]]
versions = [v for v in versions if float(v) <= max_version_float]
if not len(versions):
raise ValueError(f"No server versions found less <= {max_version}")
return versions
def get_display_name(base: str, host: str, **kwargs) -> str:
"""Get the display name of a variant."""
display_name = f"{base} {HOSTS[host].display_name}"
@ -250,7 +260,7 @@ def create_server_variants() -> list[BuildVariant]:
tasks = [f".{topology}"]
# MacOS arm64 only works on server versions 6.0+
if host == "macos-arm64":
tasks = [f".{topology} .{version}" for version in get_pythons_from("6.0")]
tasks = [f".{topology} .{version}" for version in get_versions_from("6.0")]
expansions = dict(AUTH=auth, SSL=ssl, TEST_SUITES=test_suite, SKIP_CSOT_TESTS="true")
display_name = get_display_name("Test", host, python=python, **expansions)
variant = create_variant(
@ -337,7 +347,7 @@ def create_load_balancer_variants():
task_names = ["load-balancer-test"]
batchtime = BATCHTIME_WEEK
expansions_base = dict(test_loadbalancer="true")
versions = get_pythons_from("6.0")
versions = get_versions_from("6.0")
variants = []
pythons = CPYTHONS + PYPYS
for ind, (version, (auth, ssl)) in enumerate(product(versions, AUTH_SSLS)):
@ -449,10 +459,33 @@ def create_pyopenssl_variants():
return variants
def create_storage_engine_tests():
host = "rhel8"
engines = ["InMemory", "MMAPv1"]
variants = []
for engine in engines:
python = CPYTHONS[0]
expansions = dict(STORAGE_ENGINE=engine.lower())
if engine == engines[0]:
tasks = [f".standalone .{v}" for v in ALL_VERSIONS]
else:
# MongoDB 4.2 drops support for MMAPv1
versions = get_versions_until("4.0")
tasks = [f".standalone .{v}" for v in versions] + [
f".replica_set .{v}" for v in versions
]
display_name = get_display_name(f"Storage {engine}", host, python=python)
variant = create_variant(
tasks, display_name, host=host, python=python, expansions=expansions
)
variants.append(variant)
return variants
def create_versioned_api_tests():
host = "rhel8"
tags = ["versionedApi_tag"]
tasks = [f".standalone .{v}" for v in get_pythons_from("5.0")]
tasks = [f".standalone .{v}" for v in get_versions_from("5.0")]
variants = []
types = ["require v1", "accept v2"]