From f6695826c87fa074b825996589034e777f7eba54 Mon Sep 17 00:00:00 2001 From: Iris Date: Mon, 21 Sep 2026 13:05:09 -0700 Subject: [PATCH] remove mod wsgi from evergreen --- .evergreen/generated_configs/tasks.yml | 74 ------------------ .evergreen/generated_configs/variants.yml | 10 --- .evergreen/scripts/generate_config.py | 33 -------- .evergreen/scripts/mod_wsgi_tester.py | 93 ----------------------- .evergreen/scripts/run_tests.py | 7 -- .evergreen/scripts/setup_tests.py | 5 -- .evergreen/scripts/teardown_tests.py | 6 -- .evergreen/scripts/utils.py | 3 +- CONTRIBUTING.md | 11 --- 9 files changed, 1 insertion(+), 241 deletions(-) delete mode 100644 .evergreen/scripts/mod_wsgi_tester.py diff --git a/.evergreen/generated_configs/tasks.yml b/.evergreen/generated_configs/tasks.yml index 942967bbec..e2677e7399 100644 --- a/.evergreen/generated_configs/tasks.yml +++ b/.evergreen/generated_configs/tasks.yml @@ -316,80 +316,6 @@ tasks: TOPOLOGY: sharded_cluster tags: [test-min-support] - # Mod wsgi tests - - name: mod-wsgi-replica-set-python3.10 - commands: - - func: run server - vars: - TOPOLOGY: replica_set - TOOLCHAIN_VERSION: "3.10" - - func: run tests - vars: - TEST_NAME: mod_wsgi - SUB_TEST_NAME: standalone - TOOLCHAIN_VERSION: "3.10" - tags: [mod_wsgi, pr] - - name: mod-wsgi-embedded-mode-replica-set-python3.11 - commands: - - func: run server - vars: - TOPOLOGY: replica_set - TOOLCHAIN_VERSION: "3.11" - - func: run tests - vars: - TEST_NAME: mod_wsgi - SUB_TEST_NAME: embedded - TOOLCHAIN_VERSION: "3.11" - tags: [mod_wsgi, pr] - - name: mod-wsgi-replica-set-python3.12 - commands: - - func: run server - vars: - TOPOLOGY: replica_set - TOOLCHAIN_VERSION: "3.12" - - func: run tests - vars: - TEST_NAME: mod_wsgi - SUB_TEST_NAME: standalone - TOOLCHAIN_VERSION: "3.12" - tags: [mod_wsgi, pr] - - name: mod-wsgi-embedded-mode-replica-set-python3.13 - commands: - - func: run server - vars: - TOPOLOGY: replica_set - TOOLCHAIN_VERSION: "3.13" - - func: run tests - vars: - TEST_NAME: mod_wsgi - SUB_TEST_NAME: embedded - TOOLCHAIN_VERSION: "3.13" - tags: [mod_wsgi, pr] - - name: mod-wsgi-embedded-mode-replica-set-python3.14 - commands: - - func: run server - vars: - TOPOLOGY: replica_set - TOOLCHAIN_VERSION: "3.14" - - func: run tests - vars: - TEST_NAME: mod_wsgi - SUB_TEST_NAME: embedded - TOOLCHAIN_VERSION: "3.14" - tags: [mod_wsgi, pr] - - name: mod-wsgi-embedded-mode-replica-set-python3.15 - commands: - - func: run server - vars: - TOPOLOGY: replica_set - TOOLCHAIN_VERSION: "3.15" - - func: run tests - vars: - TEST_NAME: mod_wsgi - SUB_TEST_NAME: embedded - TOOLCHAIN_VERSION: "3.15" - tags: [mod_wsgi, pr] - # No orchestration tests - name: test-no-orchestration-python3.10-min-deps commands: diff --git a/.evergreen/generated_configs/variants.yml b/.evergreen/generated_configs/variants.yml index de2ce0e5ce..26027888fe 100644 --- a/.evergreen/generated_configs/variants.yml +++ b/.evergreen/generated_configs/variants.yml @@ -384,16 +384,6 @@ buildvariants: TEST_NAME: mockupdb tags: [pr] - # Mod wsgi tests - - name: mod_wsgi-ubuntu-22 - tasks: - - name: .mod_wsgi - display_name: Mod_WSGI Ubuntu-22 - run_on: - - ubuntu2204-small - expansions: - MOD_WSGI_VERSION: "4" - # No c ext tests - name: no-c-ext-rhel8 tasks: diff --git a/.evergreen/scripts/generate_config.py b/.evergreen/scripts/generate_config.py index f8f8be140a..97fd9b0176 100644 --- a/.evergreen/scripts/generate_config.py +++ b/.evergreen/scripts/generate_config.py @@ -400,14 +400,6 @@ def create_no_c_ext_variants(): return [create_variant(tasks, display_name, host=host, expansions=expansions)] -def create_mod_wsgi_variants(): - host = HOSTS["ubuntu22"] - tasks = [".mod_wsgi"] - expansions = dict(MOD_WSGI_VERSION="4") - display_name = get_variant_name("Mod_WSGI", host) - return [create_variant(tasks, display_name, host=host, expansions=expansions)] - - def create_disable_test_commands_variants(): host = DEFAULT_HOST expansions = dict(AUTH="auth", SSL="ssl", DISABLE_TEST_COMMANDS="1") @@ -1012,31 +1004,6 @@ def create_oidc_tasks(): return tasks -def create_mod_wsgi_tasks(): - tasks = [] - for (test, topology), python in zip_cycle( - product(["standalone", "embedded-mode"], ["standalone", "replica_set"]), CPYTHONS - ): - if "t" in python: - continue - if test == "standalone": - task_name = "mod-wsgi-" - else: - task_name = "mod-wsgi-embedded-mode-" - task_name += topology.replace("_", "-") - task_name = get_task_name(task_name, python=python) - server_vars = dict(TOPOLOGY=topology, TOOLCHAIN_VERSION=python) - server_func = FunctionCall(func="run server", vars=server_vars) - vars = dict( - TEST_NAME="mod_wsgi", SUB_TEST_NAME=test.split("-")[0], TOOLCHAIN_VERSION=python - ) - test_func = FunctionCall(func="run tests", vars=vars) - tags = ["mod_wsgi", "pr"] - commands = [server_func, test_func] - tasks.append(EvgTask(name=task_name, tags=tags, commands=commands)) - return tasks - - def _create_ocsp_tasks(algo, variant, server_type, base_task_name): tasks = [] file_name = f"{algo}-basic-tls-ocsp-{variant}.json" diff --git a/.evergreen/scripts/mod_wsgi_tester.py b/.evergreen/scripts/mod_wsgi_tester.py deleted file mode 100644 index 5968849068..0000000000 --- a/.evergreen/scripts/mod_wsgi_tester.py +++ /dev/null @@ -1,93 +0,0 @@ -from __future__ import annotations - -import os -import sys -import time -import urllib.error -import urllib.request -from pathlib import Path -from shutil import which - -from utils import LOGGER, ROOT, run_command, write_env - - -def make_request(url, timeout=10): - for _ in range(int(timeout)): - try: - urllib.request.urlopen(url) # noqa: S310 - return - except urllib.error.HTTPError: - pass - time.sleep(1) - raise TimeoutError(f"Failed to access {url}") - - -def setup_mod_wsgi(sub_test_name: str) -> None: - env = os.environ.copy() - if sub_test_name == "embedded": - env["MOD_WSGI_CONF"] = "mod_wsgi_test_embedded.conf" - elif sub_test_name == "standalone": - env["MOD_WSGI_CONF"] = "mod_wsgi_test.conf" - else: - raise ValueError("mod_wsgi sub test must be either 'standalone' or 'embedded'") - write_env("MOD_WSGI_CONF", env["MOD_WSGI_CONF"]) - apache = which("apache2") - if not apache and Path("/usr/lib/apache2/mpm-prefork/apache2").exists(): - apache = "/usr/lib/apache2/mpm-prefork/apache2" - if apache: - apache_config = "apache24ubuntu161404.conf" - else: - apache = which("httpd") - if not apache: - raise ValueError("Could not find apache2 or httpd") - apache_config = "apache22amazon.conf" - python_version = ".".join(str(val) for val in sys.version_info[:2]) - mod_wsgi_version = 4 - so_file = f"/opt/python/mod_wsgi/python_version/{python_version}/mod_wsgi_version/{mod_wsgi_version}/mod_wsgi.so" - write_env("MOD_WSGI_SO", so_file) - env["MOD_WSGI_SO"] = so_file - env["PYTHONHOME"] = f"/opt/python/{python_version}" - env["PROJECT_DIRECTORY"] = project_directory = str(ROOT) - write_env("APACHE_BINARY", apache) - write_env("APACHE_CONFIG", apache_config) - uri1 = f"http://localhost:8080/interpreter1{project_directory}" - write_env("TEST_URI1", uri1) - uri2 = f"http://localhost:8080/interpreter2{project_directory}" - write_env("TEST_URI2", uri2) - run_command(f"{apache} -k start -f {ROOT}/test/mod_wsgi_test/{apache_config}", env=env) - - # Wait for the endpoints to be available. - try: - make_request(uri1, 10) - make_request(uri2, 10) - except Exception as e: - LOGGER.error(Path("error_log").read_text()) - raise e - - -def test_mod_wsgi() -> None: - sys.path.insert(0, ROOT) - from test.mod_wsgi_test.test_client import main, parse_args - - uri1 = os.environ["TEST_URI1"] - uri2 = os.environ["TEST_URI2"] - args = f"-n 25000 -t 100 parallel {uri1} {uri2}" - try: - main(*parse_args(args.split())) - - args = f"-n 25000 serial {uri1} {uri2}" - main(*parse_args(args.split())) - except Exception as e: - LOGGER.error(Path("error_log").read_text()) - raise e - - -def teardown_mod_wsgi() -> None: - apache = os.environ["APACHE_BINARY"] - apache_config = os.environ["APACHE_CONFIG"] - - run_command(f"{apache} -k stop -f {ROOT}/test/mod_wsgi_test/{apache_config}") - - -if __name__ == "__main__": - setup_mod_wsgi() diff --git a/.evergreen/scripts/run_tests.py b/.evergreen/scripts/run_tests.py index b9198cadf4..7193cd9146 100644 --- a/.evergreen/scripts/run_tests.py +++ b/.evergreen/scripts/run_tests.py @@ -158,13 +158,6 @@ def run() -> None: if TEST_PERF: start_time = datetime.now() - # Run mod_wsgi tests using the helper. - if TEST_NAME == "mod_wsgi": - from mod_wsgi_tester import test_mod_wsgi - - test_mod_wsgi() - return - # Send kms tests to run remotely. if TEST_NAME == "kms" and SUB_TEST_NAME in ["azure", "gcp"]: from kms_tester import test_kms_send_to_remote diff --git a/.evergreen/scripts/setup_tests.py b/.evergreen/scripts/setup_tests.py index a8839533c1..5a3f441f58 100644 --- a/.evergreen/scripts/setup_tests.py +++ b/.evergreen/scripts/setup_tests.py @@ -332,11 +332,6 @@ def handle_test_env() -> None: cmd = f'bash "{DRIVERS_TOOLS}/.evergreen/run-load-balancer.sh" start' run_command(cmd) - if test_name == "mod_wsgi": - from mod_wsgi_tester import setup_mod_wsgi - - setup_mod_wsgi(sub_test_name) - if test_name == "ocsp": if sub_test_name: os.environ["OCSP_SERVER_TYPE"] = sub_test_name diff --git a/.evergreen/scripts/teardown_tests.py b/.evergreen/scripts/teardown_tests.py index 7da0b60815..09f2925ef5 100644 --- a/.evergreen/scripts/teardown_tests.py +++ b/.evergreen/scripts/teardown_tests.py @@ -51,12 +51,6 @@ shutil.rmtree(ROOT / "specifications", ignore_errors=True) Path(os.environ["OUTPUT_FILE"]).unlink(missing_ok=True) -# Tear down mog_wsgi if applicable. -elif TEST_NAME == "mod_wsgi": - from mod_wsgi_tester import teardown_mod_wsgi - - teardown_mod_wsgi() - # Tear down coverage if applicable. if os.environ.get("COVERAGE"): shutil.rmtree(".pytest_cache", ignore_errors=True) diff --git a/.evergreen/scripts/utils.py b/.evergreen/scripts/utils.py index aeff490962..a7decdfaa8 100644 --- a/.evergreen/scripts/utils.py +++ b/.evergreen/scripts/utils.py @@ -63,7 +63,6 @@ class Distro: "ecs-remote", ], "kms": ["azure", "azure-remote", "azure-fail", "gcp", "gcp-remote", "gcp-fail"], - "mod_wsgi": ["standalone", "embedded"], "perf": ["sync", "async"], "auth_oidc": [ "default", @@ -80,7 +79,7 @@ class Distro: ], } -EXTRA_TESTS = ["mod_wsgi", "aws_lambda", "doctest"] +EXTRA_TESTS = ["aws_lambda", "doctest"] # Tests that do not use run-mongodb directly. NO_RUN_ORCHESTRATION = [ diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 2ef90224c2..146a0adb3c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -349,17 +349,6 @@ You will need to set up access to the `drivers-test-secrets-role`, see the [Wiki - Run `just setup-tests aws_lambda`. - Run `just run-tests`. -### mod_wsgi tests - -Note: these tests can only be run from an Evergreen Linux host that has the Python toolchain. - -- Run `just run-server`. -- Run `just setup-tests mod_wsgi `. -- Run `just run-tests`. - -The `mode` can be `standalone` or `embedded`. For the `replica_set` version of the tests, use -`TOPOLOGY=replica_set just run-server`. - ### OCSP tests - Export the orchestration file, e.g. `export ORCHESTRATION_FILE=rsa-basic-tls-ocsp-disableStapling.json`.