|
23 | 23 | ##############
|
24 | 24 |
|
25 | 25 | ALL_VERSIONS = ["4.0", "4.4", "5.0", "6.0", "7.0", "8.0", "rapid", "latest"]
|
26 |
| -VERSIONS_6_0_PLUS = ["6.0", "7.0", "8.0", "rapid", "latest"] |
27 | 26 | CPYTHONS = ["3.9", "3.10", "3.11", "3.12", "3.13"]
|
28 | 27 | PYPYS = ["pypy3.9", "pypy3.10"]
|
29 | 28 | ALL_PYTHONS = CPYTHONS + PYPYS
|
@@ -112,6 +111,14 @@ def get_python_binary(python: str, host: str) -> str:
|
112 | 111 | raise ValueError(f"no match found for python {python} on {host}")
|
113 | 112 |
|
114 | 113 |
|
| 114 | +def get_pythons_from(min_version: str) -> list[str]: |
| 115 | + """Get all pythons starting from a minimum version.""" |
| 116 | + min_version_float = float(min_version) |
| 117 | + rapid_latest = ["rapid", "latest"] |
| 118 | + versions = [v for v in ALL_VERSIONS if v not in rapid_latest] |
| 119 | + return [v for v in versions if float(v) >= min_version_float] + rapid_latest |
| 120 | + |
| 121 | + |
115 | 122 | def get_display_name(base: str, host: str, **kwargs) -> str:
|
116 | 123 | """Get the display name of a variant."""
|
117 | 124 | display_name = f"{base} {HOSTS[host].display_name}"
|
@@ -243,7 +250,7 @@ def create_server_variants() -> list[BuildVariant]:
|
243 | 250 | tasks = [f".{topology}"]
|
244 | 251 | # MacOS arm64 only works on server versions 6.0+
|
245 | 252 | if host == "macos-arm64":
|
246 |
| - tasks = [f".{topology} .{version}" for version in VERSIONS_6_0_PLUS] |
| 253 | + tasks = [f".{topology} .{version}" for version in get_pythons_from("6.0")] |
247 | 254 | expansions = dict(AUTH=auth, SSL=ssl, TEST_SUITES=test_suite, SKIP_CSOT_TESTS="true")
|
248 | 255 | display_name = get_display_name("Test", host, python=python, **expansions)
|
249 | 256 | variant = create_variant(
|
@@ -330,7 +337,7 @@ def create_load_balancer_variants():
|
330 | 337 | task_names = ["load-balancer-test"]
|
331 | 338 | batchtime = BATCHTIME_WEEK
|
332 | 339 | expansions_base = dict(test_loadbalancer="true")
|
333 |
| - versions = ["6.0", "7.0", "8.0", "latest", "rapid"] |
| 340 | + versions = get_pythons_from("6.0") |
334 | 341 | variants = []
|
335 | 342 | pythons = CPYTHONS + PYPYS
|
336 | 343 | for ind, (version, (auth, ssl)) in enumerate(product(versions, AUTH_SSLS)):
|
@@ -442,10 +449,42 @@ def create_pyopenssl_variants():
|
442 | 449 | return variants
|
443 | 450 |
|
444 | 451 |
|
| 452 | +def create_versioned_api_tests(): |
| 453 | + host = "rhel8" |
| 454 | + tags = ["versionedApi_tag"] |
| 455 | + tasks = [f".standalone .{v}" for v in get_pythons_from("5.0")] |
| 456 | + variants = [] |
| 457 | + types = ["require v1", "accept v2"] |
| 458 | + |
| 459 | + # All python versions across platforms. |
| 460 | + for python, test_type in product(MIN_MAX_PYTHON, types): |
| 461 | + expansions = dict(AUTH="auth") |
| 462 | + # Test against a cluster with requireApiVersion=1. |
| 463 | + if test_type == types[0]: |
| 464 | + # REQUIRE_API_VERSION is set to make drivers-evergreen-tools |
| 465 | + # start a cluster with the requireApiVersion parameter. |
| 466 | + expansions["REQUIRE_API_VERSION"] = "1" |
| 467 | + # MONGODB_API_VERSION is the apiVersion to use in the test suite. |
| 468 | + expansions["MONGODB_API_VERSION"] = "1" |
| 469 | + else: |
| 470 | + # Test against a cluster with acceptApiVersion2 but without |
| 471 | + # requireApiVersion, and don't automatically add apiVersion to |
| 472 | + # clients created in the test suite. |
| 473 | + expansions["ORCHESTRATION_FILE"] = "versioned-api-testing.json" |
| 474 | + base_display_name = f"Versioned API {test_type}" |
| 475 | + display_name = get_display_name(base_display_name, host, python=python, **expansions) |
| 476 | + variant = create_variant( |
| 477 | + tasks, display_name, host=host, python=python, tags=tags, expansions=expansions |
| 478 | + ) |
| 479 | + variants.append(variant) |
| 480 | + |
| 481 | + return variants |
| 482 | + |
| 483 | + |
445 | 484 | ##################
|
446 | 485 | # Generate Config
|
447 | 486 | ##################
|
448 | 487 |
|
449 |
| -variants = create_pyopenssl_variants() |
| 488 | +variants = create_versioned_api_tests() |
450 | 489 | # print(len(variants))
|
451 | 490 | generate_yaml(variants=variants)
|
0 commit comments