From 611ded673bba02f262c858b41b7ed569bb589b1a Mon Sep 17 00:00:00 2001 From: Jeffrey 'Alex' Clark Date: Wed, 17 Jun 2026 13:14:03 -0400 Subject: [PATCH 1/6] PYTHON-5879 Skip coverage on macOS encryption tests --- .evergreen/generated_configs/tasks.yml | 3 +++ .evergreen/generated_configs/variants.yml | 8 ++++---- .evergreen/scripts/generate_config.py | 4 +++- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/.evergreen/generated_configs/tasks.yml b/.evergreen/generated_configs/tasks.yml index 6a460ce486..f5b2c58d25 100644 --- a/.evergreen/generated_configs/tasks.yml +++ b/.evergreen/generated_configs/tasks.yml @@ -4827,6 +4827,7 @@ tasks: - noauth - free-threaded - pr + - cov - name: test-non-standard-latest-pypy3.11-noauth-ssl-replica-set commands: - func: run server @@ -4873,6 +4874,7 @@ tasks: - sharded_cluster-auth-ssl - auth - pr + - cov - name: test-non-standard-latest-python3.13-noauth-nossl-standalone-cov commands: - func: run server @@ -4897,6 +4899,7 @@ tasks: - standalone-noauth-nossl - noauth - pr + - cov - name: test-non-standard-rapid-python3.11-noauth-ssl-replica-set commands: - func: run server diff --git a/.evergreen/generated_configs/variants.yml b/.evergreen/generated_configs/variants.yml index 4dd44b5048..fabadf7b9a 100644 --- a/.evergreen/generated_configs/variants.yml +++ b/.evergreen/generated_configs/variants.yml @@ -193,7 +193,7 @@ buildvariants: tags: [encryption_tag] - name: encryption-macos tasks: - - name: .test-non-standard !.pypy + - name: .test-non-standard !.pypy !.cov display_name: Encryption macOS run_on: - macos-14 @@ -203,7 +203,7 @@ buildvariants: tags: [encryption_tag] - name: encryption-win64 tasks: - - name: .test-non-standard !.pypy + - name: .test-non-standard !.pypy !.cov display_name: Encryption Win64 run_on: - windows-2022-latest-small @@ -224,7 +224,7 @@ buildvariants: tags: [encryption_tag] - name: encryption-crypt_shared-macos tasks: - - name: .test-non-standard !.pypy + - name: .test-non-standard !.pypy !.cov display_name: Encryption crypt_shared macOS run_on: - macos-14 @@ -235,7 +235,7 @@ buildvariants: tags: [encryption_tag] - name: encryption-crypt_shared-win64 tasks: - - name: .test-non-standard !.pypy + - name: .test-non-standard !.pypy !.cov display_name: Encryption crypt_shared Win64 run_on: - windows-2022-latest-small diff --git a/.evergreen/scripts/generate_config.py b/.evergreen/scripts/generate_config.py index 32b75a82a2..c0310112da 100644 --- a/.evergreen/scripts/generate_config.py +++ b/.evergreen/scripts/generate_config.py @@ -132,7 +132,8 @@ def get_encryption_expansions(encryption): display_name = get_variant_name(encryption, host, **expansions) tasks = [".test-non-standard"] if host != "rhel8": - tasks = [".test-non-standard !.pypy"] + # Exclude PyPy (not supported on non-linux) and coverage tasks (too slow on macOS/win64). + tasks = [".test-non-standard !.pypy !.cov"] variant = create_variant( tasks, display_name, @@ -670,6 +671,7 @@ def create_test_non_standard_tasks(): expansions["TEST_MIN_DEPS"] = "1" elif pr: expansions["COVERAGE"] = "1" + tags.append("cov") name = get_task_name("test-non-standard", python=python, **expansions) server_func = FunctionCall(func="run server", vars=expansions) test_vars = expansions.copy() From a3566f3429fabb49e14221a09ca7333cd320b59c Mon Sep 17 00:00:00 2001 From: Jeffrey 'Alex' Clark Date: Wed, 17 Jun 2026 15:22:08 -0400 Subject: [PATCH 2/6] Address PR feedback: clarify comment, PR title updated to mention Win64 --- .evergreen/scripts/generate_config.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.evergreen/scripts/generate_config.py b/.evergreen/scripts/generate_config.py index c0310112da..aafe51c64b 100644 --- a/.evergreen/scripts/generate_config.py +++ b/.evergreen/scripts/generate_config.py @@ -132,7 +132,8 @@ def get_encryption_expansions(encryption): display_name = get_variant_name(encryption, host, **expansions) tasks = [".test-non-standard"] if host != "rhel8": - # Exclude PyPy (not supported on non-linux) and coverage tasks (too slow on macOS/win64). + # Exclude PyPy (no Evergreen toolchain on macOS/win64) and coverage tasks + # (encryption suites exceed the 60-min timeout with coverage overhead on macOS/win64). tasks = [".test-non-standard !.pypy !.cov"] variant = create_variant( tasks, From e91a76552db758d508cc2945c1c50908457d58a3 Mon Sep 17 00:00:00 2001 From: Jeffrey 'Alex' Clark Date: Wed, 17 Jun 2026 19:23:54 -0400 Subject: [PATCH 3/6] PYTHON-5879 Generate non-coverage companion tasks for macOS/Win64 encryption variants The cycling algorithm assigns python 3.13/3.14t/3.14 to all three "latest" topology slots, so every "latest" test-non-standard task gets COVERAGE=1 and the "cov" tag. Filtering "!.cov" on macOS/Win64 therefore removed ALL latest tasks, leaving nothing to activate in patch builds. Fix: emit a non-coverage companion task alongside each coverage task. The companion has the same python/topology/version but no COVERAGE expansion and no "cov" tag, so it is selected by the ".test-non-standard !.pypy !.cov" filter used on macOS/Win64 encryption variants. --- .evergreen/generated_configs/tasks.yml | 67 ++++++++++++++++++++++++++ .evergreen/scripts/generate_config.py | 14 ++++++ 2 files changed, 81 insertions(+) diff --git a/.evergreen/generated_configs/tasks.yml b/.evergreen/generated_configs/tasks.yml index f5b2c58d25..4fb92b74ba 100644 --- a/.evergreen/generated_configs/tasks.yml +++ b/.evergreen/generated_configs/tasks.yml @@ -4828,6 +4828,29 @@ tasks: - free-threaded - pr - cov + - name: test-non-standard-latest-python3.14t-noauth-ssl-replica-set + commands: + - func: run server + vars: + AUTH: noauth + SSL: ssl + TOPOLOGY: replica_set + VERSION: latest + - func: run tests + vars: + AUTH: noauth + SSL: ssl + TOPOLOGY: replica_set + VERSION: latest + TOOLCHAIN_VERSION: 3.14t + tags: + - test-non-standard + - server-latest + - python-3.14t + - replica_set-noauth-ssl + - noauth + - free-threaded + - pr - name: test-non-standard-latest-pypy3.11-noauth-ssl-replica-set commands: - func: run server @@ -4875,6 +4898,28 @@ tasks: - auth - pr - cov + - name: test-non-standard-latest-python3.14-auth-ssl-sharded-cluster + commands: + - func: run server + vars: + AUTH: auth + SSL: ssl + TOPOLOGY: sharded_cluster + VERSION: latest + - func: run tests + vars: + AUTH: auth + SSL: ssl + TOPOLOGY: sharded_cluster + VERSION: latest + TOOLCHAIN_VERSION: "3.14" + tags: + - test-non-standard + - server-latest + - python-3.14 + - sharded_cluster-auth-ssl + - auth + - pr - name: test-non-standard-latest-python3.13-noauth-nossl-standalone-cov commands: - func: run server @@ -4900,6 +4945,28 @@ tasks: - noauth - pr - cov + - name: test-non-standard-latest-python3.13-noauth-nossl-standalone + commands: + - func: run server + vars: + AUTH: noauth + SSL: nossl + TOPOLOGY: standalone + VERSION: latest + - func: run tests + vars: + AUTH: noauth + SSL: nossl + TOPOLOGY: standalone + VERSION: latest + TOOLCHAIN_VERSION: "3.13" + tags: + - test-non-standard + - server-latest + - python-3.13 + - standalone-noauth-nossl + - noauth + - pr - name: test-non-standard-rapid-python3.11-noauth-ssl-replica-set commands: - func: run server diff --git a/.evergreen/scripts/generate_config.py b/.evergreen/scripts/generate_config.py index aafe51c64b..89225d1a43 100644 --- a/.evergreen/scripts/generate_config.py +++ b/.evergreen/scripts/generate_config.py @@ -679,6 +679,20 @@ def create_test_non_standard_tasks(): test_vars["TOOLCHAIN_VERSION"] = python test_func = FunctionCall(func="run tests", vars=test_vars) tasks.append(EvgTask(name=name, tags=tags, commands=[server_func, test_func])) + # For each coverage task, also emit a non-coverage companion so that + # macOS/Win64 encryption variants (which filter out .cov due to timeout + # constraints) still have a "latest" task to activate in patch builds. + if pr and "cov" in tags: + nc_expansions = {k: v for k, v in expansions.items() if k != "COVERAGE"} + nc_tags = [t for t in tags if t != "cov"] + nc_name = get_task_name("test-non-standard", python=python, **nc_expansions) + nc_server_func = FunctionCall(func="run server", vars=nc_expansions) + nc_test_vars = nc_expansions.copy() + nc_test_vars["TOOLCHAIN_VERSION"] = python + nc_test_func = FunctionCall(func="run tests", vars=nc_test_vars) + tasks.append( + EvgTask(name=nc_name, tags=nc_tags, commands=[nc_server_func, nc_test_func]) + ) return tasks From 06af4e4e8f2946142f7f67280a9f5d9c7556643c Mon Sep 17 00:00:00 2001 From: Jeffrey 'Alex' Clark Date: Wed, 17 Jun 2026 19:36:54 -0400 Subject: [PATCH 4/6] PYTHON-5879 Use distinct tag for non-coverage companion tasks to avoid selector leakage Companion tasks previously carried the "test-non-standard" tag, which caused selectors in other variants (load-balancer, PyOpenSSL, standalone-noauth-nossl) to accidentally match them and run duplicate tasks. Fix: companions now use "test-non-standard-no-cov" as their primary tag instead of "test-non-standard". The macOS/Win64 encryption variant selectors are updated to explicitly include ".test-non-standard-no-cov !.pypy" alongside the existing ".test-non-standard !.pypy !.cov" selector. --- .evergreen/generated_configs/tasks.yml | 6 +++--- .evergreen/generated_configs/variants.yml | 4 ++++ .evergreen/scripts/generate_config.py | 12 ++++++++++-- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/.evergreen/generated_configs/tasks.yml b/.evergreen/generated_configs/tasks.yml index 4fb92b74ba..f06f9b9456 100644 --- a/.evergreen/generated_configs/tasks.yml +++ b/.evergreen/generated_configs/tasks.yml @@ -4844,7 +4844,7 @@ tasks: VERSION: latest TOOLCHAIN_VERSION: 3.14t tags: - - test-non-standard + - test-non-standard-no-cov - server-latest - python-3.14t - replica_set-noauth-ssl @@ -4914,7 +4914,7 @@ tasks: VERSION: latest TOOLCHAIN_VERSION: "3.14" tags: - - test-non-standard + - test-non-standard-no-cov - server-latest - python-3.14 - sharded_cluster-auth-ssl @@ -4961,7 +4961,7 @@ tasks: VERSION: latest TOOLCHAIN_VERSION: "3.13" tags: - - test-non-standard + - test-non-standard-no-cov - server-latest - python-3.13 - standalone-noauth-nossl diff --git a/.evergreen/generated_configs/variants.yml b/.evergreen/generated_configs/variants.yml index fabadf7b9a..b167508539 100644 --- a/.evergreen/generated_configs/variants.yml +++ b/.evergreen/generated_configs/variants.yml @@ -194,6 +194,7 @@ buildvariants: - name: encryption-macos tasks: - name: .test-non-standard !.pypy !.cov + - name: .test-non-standard-no-cov !.pypy display_name: Encryption macOS run_on: - macos-14 @@ -204,6 +205,7 @@ buildvariants: - name: encryption-win64 tasks: - name: .test-non-standard !.pypy !.cov + - name: .test-non-standard-no-cov !.pypy display_name: Encryption Win64 run_on: - windows-2022-latest-small @@ -225,6 +227,7 @@ buildvariants: - name: encryption-crypt_shared-macos tasks: - name: .test-non-standard !.pypy !.cov + - name: .test-non-standard-no-cov !.pypy display_name: Encryption crypt_shared macOS run_on: - macos-14 @@ -236,6 +239,7 @@ buildvariants: - name: encryption-crypt_shared-win64 tasks: - name: .test-non-standard !.pypy !.cov + - name: .test-non-standard-no-cov !.pypy display_name: Encryption crypt_shared Win64 run_on: - windows-2022-latest-small diff --git a/.evergreen/scripts/generate_config.py b/.evergreen/scripts/generate_config.py index 89225d1a43..b4e71a2143 100644 --- a/.evergreen/scripts/generate_config.py +++ b/.evergreen/scripts/generate_config.py @@ -134,7 +134,9 @@ def get_encryption_expansions(encryption): if host != "rhel8": # Exclude PyPy (no Evergreen toolchain on macOS/win64) and coverage tasks # (encryption suites exceed the 60-min timeout with coverage overhead on macOS/win64). - tasks = [".test-non-standard !.pypy !.cov"] + # Also include the non-coverage companion tasks (test-non-standard-no-cov) which + # carry the "latest" server tasks without COVERAGE=1. + tasks = [".test-non-standard !.pypy !.cov", ".test-non-standard-no-cov !.pypy"] variant = create_variant( tasks, display_name, @@ -684,7 +686,13 @@ def create_test_non_standard_tasks(): # constraints) still have a "latest" task to activate in patch builds. if pr and "cov" in tags: nc_expansions = {k: v for k, v in expansions.items() if k != "COVERAGE"} - nc_tags = [t for t in tags if t != "cov"] + # Use a distinct primary tag so companions are not selected by existing + # ".test-non-standard" selectors (e.g. load-balancer, PyOpenSSL variants). + nc_tags = [ + "test-non-standard-no-cov" if t == "test-non-standard" else t + for t in tags + if t != "cov" + ] nc_name = get_task_name("test-non-standard", python=python, **nc_expansions) nc_server_func = FunctionCall(func="run server", vars=nc_expansions) nc_test_vars = nc_expansions.copy() From 32f7bb582cae0ec84a0d062ec17323f5c830f927 Mon Sep 17 00:00:00 2001 From: Jeffrey 'Alex' Clark Date: Thu, 18 Jun 2026 09:06:07 -0400 Subject: [PATCH 5/6] PYTHON-5879 Only run sharded_cluster non-standard tasks on PRs Previously all three topologies (standalone, replica_set, sharded_cluster) for version=latest were marked pr=True and activated in patch builds. Limiting to sharded_cluster cuts the patch build task count for non-standard variants from 3 topology tasks down to 1 (plus its non-coverage companion for macOS/Win64 encryption variants). Standalone and replica_set tasks for latest still exist for waterfall builds but no longer carry the pr tag. --- .evergreen/generated_configs/tasks.yml | 57 +------------------------- .evergreen/scripts/generate_config.py | 3 +- 2 files changed, 4 insertions(+), 56 deletions(-) diff --git a/.evergreen/generated_configs/tasks.yml b/.evergreen/generated_configs/tasks.yml index f06f9b9456..f2987d890f 100644 --- a/.evergreen/generated_configs/tasks.yml +++ b/.evergreen/generated_configs/tasks.yml @@ -4802,32 +4802,6 @@ tasks: - python-3.13 - standalone-noauth-nossl - noauth - - name: test-non-standard-latest-python3.14t-noauth-ssl-replica-set-cov - commands: - - func: run server - vars: - AUTH: noauth - SSL: ssl - TOPOLOGY: replica_set - VERSION: latest - COVERAGE: "1" - - func: run tests - vars: - AUTH: noauth - SSL: ssl - TOPOLOGY: replica_set - VERSION: latest - COVERAGE: "1" - TOOLCHAIN_VERSION: 3.14t - tags: - - test-non-standard - - server-latest - - python-3.14t - - replica_set-noauth-ssl - - noauth - - free-threaded - - pr - - cov - name: test-non-standard-latest-python3.14t-noauth-ssl-replica-set commands: - func: run server @@ -4844,13 +4818,12 @@ tasks: VERSION: latest TOOLCHAIN_VERSION: 3.14t tags: - - test-non-standard-no-cov + - test-non-standard - server-latest - python-3.14t - replica_set-noauth-ssl - noauth - free-threaded - - pr - name: test-non-standard-latest-pypy3.11-noauth-ssl-replica-set commands: - func: run server @@ -4920,31 +4893,6 @@ tasks: - sharded_cluster-auth-ssl - auth - pr - - name: test-non-standard-latest-python3.13-noauth-nossl-standalone-cov - commands: - - func: run server - vars: - AUTH: noauth - SSL: nossl - TOPOLOGY: standalone - VERSION: latest - COVERAGE: "1" - - func: run tests - vars: - AUTH: noauth - SSL: nossl - TOPOLOGY: standalone - VERSION: latest - COVERAGE: "1" - TOOLCHAIN_VERSION: "3.13" - tags: - - test-non-standard - - server-latest - - python-3.13 - - standalone-noauth-nossl - - noauth - - pr - - cov - name: test-non-standard-latest-python3.13-noauth-nossl-standalone commands: - func: run server @@ -4961,12 +4909,11 @@ tasks: VERSION: latest TOOLCHAIN_VERSION: "3.13" tags: - - test-non-standard-no-cov + - test-non-standard - server-latest - python-3.13 - standalone-noauth-nossl - noauth - - pr - name: test-non-standard-rapid-python3.11-noauth-ssl-replica-set commands: - func: run server diff --git a/.evergreen/scripts/generate_config.py b/.evergreen/scripts/generate_config.py index b4e71a2143..743103cad3 100644 --- a/.evergreen/scripts/generate_config.py +++ b/.evergreen/scripts/generate_config.py @@ -648,8 +648,9 @@ def create_test_non_standard_tasks(): tasks = [] task_combos = set() # For each version and topology, rotate through the CPythons. + # Only the sharded_cluster topology runs on PRs to keep patch build size manageable. for (version, topology), python in zip_cycle(list(product(ALL_VERSIONS, TOPOLOGIES)), CPYTHONS): - pr = version == "latest" + pr = version == "latest" and topology == "sharded_cluster" task_combos.add((version, topology, python, pr)) # For each PyPy and topology, rotate through the MongoDB versions. for (python, topology), version in zip_cycle(list(product(PYPYS, TOPOLOGIES)), ALL_VERSIONS): From aa49c3176154d53cecb256f8a33abb549582912c Mon Sep 17 00:00:00 2001 From: Jeffrey 'Alex' Clark Date: Thu, 18 Jun 2026 10:12:48 -0400 Subject: [PATCH 6/6] PYTHON-5879 Fix inaccurate comment about PyPy toolchain support --- .evergreen/scripts/generate_config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.evergreen/scripts/generate_config.py b/.evergreen/scripts/generate_config.py index 743103cad3..6dfa014a16 100644 --- a/.evergreen/scripts/generate_config.py +++ b/.evergreen/scripts/generate_config.py @@ -132,7 +132,7 @@ def get_encryption_expansions(encryption): display_name = get_variant_name(encryption, host, **expansions) tasks = [".test-non-standard"] if host != "rhel8": - # Exclude PyPy (no Evergreen toolchain on macOS/win64) and coverage tasks + # Exclude PyPy (not tested with encryption on macOS/win64) and coverage tasks # (encryption suites exceed the 60-min timeout with coverage overhead on macOS/win64). # Also include the non-coverage companion tasks (test-non-standard-no-cov) which # carry the "latest" server tasks without COVERAGE=1.