From 85ba541ed5a940bd3a7b7d967fe7510aac48a23d Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Fri, 25 Oct 2024 07:43:28 -0500 Subject: [PATCH] PYTHON-4905 Use shrub.py to generate load balancer tasks (#1968) --- .evergreen/config.yml | 9 - .evergreen/generated_configs/tasks.yml | 47 +++++ .evergreen/generated_configs/variants.yml | 225 ++++------------------ .evergreen/scripts/generate_config.py | 34 ++-- 4 files changed, 110 insertions(+), 205 deletions(-) diff --git a/.evergreen/config.yml b/.evergreen/config.yml index a1587a281d..fda6864317 100644 --- a/.evergreen/config.yml +++ b/.evergreen/config.yml @@ -1542,15 +1542,6 @@ tasks: - func: "run aws auth test with aws web identity credentials" - func: "run aws ECS auth test" - - name: load-balancer-test - commands: - - func: "bootstrap mongo-orchestration" - vars: - TOPOLOGY: "sharded_cluster" - LOAD_BALANCER: true - - func: "run load-balancer" - - func: "run tests" - - name: "oidc-auth-test" commands: - func: "run oidc auth test with test credentials" diff --git a/.evergreen/generated_configs/tasks.yml b/.evergreen/generated_configs/tasks.yml index fb3da4bb24..0f416ab595 100644 --- a/.evergreen/generated_configs/tasks.yml +++ b/.evergreen/generated_configs/tasks.yml @@ -1,4 +1,51 @@ tasks: + # Load balancer tests + - name: test-load-balancer-auth-ssl + commands: + - func: bootstrap mongo-orchestration + vars: + TOPOLOGY: sharded_cluster + AUTH: auth + SSL: ssl + LOAD_BALANCER: "true" + - func: run load-balancer + - func: run tests + vars: + AUTH: auth + SSL: ssl + test_loadbalancer: "true" + tags: [load-balancer, auth, ssl] + - name: test-load-balancer-noauth-ssl + commands: + - func: bootstrap mongo-orchestration + vars: + TOPOLOGY: sharded_cluster + AUTH: noauth + SSL: ssl + LOAD_BALANCER: "true" + - func: run load-balancer + - func: run tests + vars: + AUTH: noauth + SSL: ssl + test_loadbalancer: "true" + tags: [load-balancer, noauth, ssl] + - name: test-load-balancer-noauth-nossl + commands: + - func: bootstrap mongo-orchestration + vars: + TOPOLOGY: sharded_cluster + AUTH: noauth + SSL: nossl + LOAD_BALANCER: "true" + - func: run load-balancer + - func: run tests + vars: + AUTH: noauth + SSL: nossl + test_loadbalancer: "true" + tags: [load-balancer, noauth, nossl] + # Server tests - name: test-4.0-standalone-auth-ssl-sync commands: diff --git a/.evergreen/generated_configs/variants.yml b/.evergreen/generated_configs/variants.yml index 327becc249..f9a452b224 100644 --- a/.evergreen/generated_configs/variants.yml +++ b/.evergreen/generated_configs/variants.yml @@ -671,201 +671,56 @@ buildvariants: PYTHON_BINARY: /opt/python/3.12/bin/python3 # Load balancer tests - - name: load-balancer-rhel8-v6.0-py3.9-auth-ssl + - name: load-balancer-rhel8-v6.0-py3.9 tasks: - - name: load-balancer-test - display_name: Load Balancer RHEL8 v6.0 py3.9 Auth SSL + - name: .load-balancer + display_name: Load Balancer RHEL8 v6.0 py3.9 run_on: - rhel87-small batchtime: 10080 expansions: - VERSION: "6.0" - AUTH: auth - SSL: ssl - test_loadbalancer: "true" PYTHON_BINARY: /opt/python/3.9/bin/python3 - - name: load-balancer-rhel8-v6.0-py3.10-noauth-ssl - tasks: - - name: load-balancer-test - display_name: Load Balancer RHEL8 v6.0 py3.10 NoAuth SSL - run_on: - - rhel87-small - batchtime: 10080 - expansions: - VERSION: "6.0" - AUTH: noauth - SSL: ssl - test_loadbalancer: "true" - PYTHON_BINARY: /opt/python/3.10/bin/python3 - - name: load-balancer-rhel8-v6.0-py3.11-noauth-nossl - tasks: - - name: load-balancer-test - display_name: Load Balancer RHEL8 v6.0 py3.11 NoAuth NoSSL - run_on: - - rhel87-small - batchtime: 10080 - expansions: VERSION: "6.0" - AUTH: noauth - SSL: nossl - test_loadbalancer: "true" - PYTHON_BINARY: /opt/python/3.11/bin/python3 - - name: load-balancer-rhel8-v7.0-py3.12-auth-ssl + - name: load-balancer-rhel8-v7.0-py3.9 tasks: - - name: load-balancer-test - display_name: Load Balancer RHEL8 v7.0 py3.12 Auth SSL - run_on: - - rhel87-small - batchtime: 10080 - expansions: - VERSION: "7.0" - AUTH: auth - SSL: ssl - test_loadbalancer: "true" - PYTHON_BINARY: /opt/python/3.12/bin/python3 - - name: load-balancer-rhel8-v7.0-py3.13-noauth-ssl - tasks: - - name: load-balancer-test - display_name: Load Balancer RHEL8 v7.0 py3.13 NoAuth SSL + - name: .load-balancer + display_name: Load Balancer RHEL8 v7.0 py3.9 run_on: - rhel87-small batchtime: 10080 expansions: + PYTHON_BINARY: /opt/python/3.9/bin/python3 VERSION: "7.0" - AUTH: noauth - SSL: ssl - test_loadbalancer: "true" - PYTHON_BINARY: /opt/python/3.13/bin/python3 - - name: load-balancer-rhel8-v7.0-pypy3.9-noauth-nossl + - name: load-balancer-rhel8-v8.0-py3.9 tasks: - - name: load-balancer-test - display_name: Load Balancer RHEL8 v7.0 pypy3.9 NoAuth NoSSL + - name: .load-balancer + display_name: Load Balancer RHEL8 v8.0 py3.9 run_on: - rhel87-small batchtime: 10080 expansions: - VERSION: "7.0" - AUTH: noauth - SSL: nossl - test_loadbalancer: "true" - PYTHON_BINARY: /opt/python/pypy3.9/bin/python3 - - name: load-balancer-rhel8-v8.0-pypy3.10-auth-ssl - tasks: - - name: load-balancer-test - display_name: Load Balancer RHEL8 v8.0 pypy3.10 Auth SSL - run_on: - - rhel87-small - batchtime: 10080 - expansions: - VERSION: "8.0" - AUTH: auth - SSL: ssl - test_loadbalancer: "true" - PYTHON_BINARY: /opt/python/pypy3.10/bin/python3 - - name: load-balancer-rhel8-v8.0-py3.9-noauth-ssl - tasks: - - name: load-balancer-test - display_name: Load Balancer RHEL8 v8.0 py3.9 NoAuth SSL - run_on: - - rhel87-small - batchtime: 10080 - expansions: - VERSION: "8.0" - AUTH: noauth - SSL: ssl - test_loadbalancer: "true" PYTHON_BINARY: /opt/python/3.9/bin/python3 - - name: load-balancer-rhel8-v8.0-py3.10-noauth-nossl - tasks: - - name: load-balancer-test - display_name: Load Balancer RHEL8 v8.0 py3.10 NoAuth NoSSL - run_on: - - rhel87-small - batchtime: 10080 - expansions: VERSION: "8.0" - AUTH: noauth - SSL: nossl - test_loadbalancer: "true" - PYTHON_BINARY: /opt/python/3.10/bin/python3 - - name: load-balancer-rhel8-rapid-py3.11-auth-ssl - tasks: - - name: load-balancer-test - display_name: Load Balancer RHEL8 rapid py3.11 Auth SSL - run_on: - - rhel87-small - batchtime: 10080 - expansions: - VERSION: rapid - AUTH: auth - SSL: ssl - test_loadbalancer: "true" - PYTHON_BINARY: /opt/python/3.11/bin/python3 - - name: load-balancer-rhel8-rapid-py3.12-noauth-ssl - tasks: - - name: load-balancer-test - display_name: Load Balancer RHEL8 rapid py3.12 NoAuth SSL - run_on: - - rhel87-small - batchtime: 10080 - expansions: - VERSION: rapid - AUTH: noauth - SSL: ssl - test_loadbalancer: "true" - PYTHON_BINARY: /opt/python/3.12/bin/python3 - - name: load-balancer-rhel8-rapid-py3.13-noauth-nossl + - name: load-balancer-rhel8-rapid-py3.9 tasks: - - name: load-balancer-test - display_name: Load Balancer RHEL8 rapid py3.13 NoAuth NoSSL + - name: .load-balancer + display_name: Load Balancer RHEL8 rapid py3.9 run_on: - rhel87-small batchtime: 10080 expansions: + PYTHON_BINARY: /opt/python/3.9/bin/python3 VERSION: rapid - AUTH: noauth - SSL: nossl - test_loadbalancer: "true" - PYTHON_BINARY: /opt/python/3.13/bin/python3 - - name: load-balancer-rhel8-latest-pypy3.9-auth-ssl - tasks: - - name: load-balancer-test - display_name: Load Balancer RHEL8 latest pypy3.9 Auth SSL - run_on: - - rhel87-small - batchtime: 10080 - expansions: - VERSION: latest - AUTH: auth - SSL: ssl - test_loadbalancer: "true" - PYTHON_BINARY: /opt/python/pypy3.9/bin/python3 - - name: load-balancer-rhel8-latest-pypy3.10-noauth-ssl + - name: load-balancer-rhel8-latest-py3.9 tasks: - - name: load-balancer-test - display_name: Load Balancer RHEL8 latest pypy3.10 NoAuth SSL + - name: .load-balancer + display_name: Load Balancer RHEL8 latest py3.9 run_on: - rhel87-small batchtime: 10080 expansions: - VERSION: latest - AUTH: noauth - SSL: ssl - test_loadbalancer: "true" - PYTHON_BINARY: /opt/python/pypy3.10/bin/python3 - - name: load-balancer-rhel8-latest-py3.9-noauth-nossl - tasks: - - name: load-balancer-test - display_name: Load Balancer RHEL8 latest py3.9 NoAuth NoSSL - run_on: - - rhel87-small - batchtime: 10080 - expansions: - VERSION: latest - AUTH: noauth - SSL: nossl - test_loadbalancer: "true" PYTHON_BINARY: /opt/python/3.9/bin/python3 + VERSION: latest # Mockupdb tests - name: mockupdb-tests-rhel8-py3.9 @@ -951,10 +806,10 @@ buildvariants: PYTHON_BINARY: /opt/python/3.13/bin/python3 # Ocsp tests - - name: ocsp-test-rhel8-py3.9 + - name: ocsp-test-rhel8-v4.4-py3.9 tasks: - name: .ocsp - display_name: OCSP test RHEL8 py3.9 + display_name: OCSP test RHEL8 v4.4 py3.9 run_on: - rhel87-small batchtime: 20160 @@ -964,10 +819,10 @@ buildvariants: TOPOLOGY: server PYTHON_BINARY: /opt/python/3.9/bin/python3 VERSION: "4.4" - - name: ocsp-test-rhel8-py3.10 + - name: ocsp-test-rhel8-v5.0-py3.10 tasks: - name: .ocsp - display_name: OCSP test RHEL8 py3.10 + display_name: OCSP test RHEL8 v5.0 py3.10 run_on: - rhel87-small batchtime: 20160 @@ -977,10 +832,10 @@ buildvariants: TOPOLOGY: server PYTHON_BINARY: /opt/python/3.10/bin/python3 VERSION: "5.0" - - name: ocsp-test-rhel8-py3.11 + - name: ocsp-test-rhel8-v6.0-py3.11 tasks: - name: .ocsp - display_name: OCSP test RHEL8 py3.11 + display_name: OCSP test RHEL8 v6.0 py3.11 run_on: - rhel87-small batchtime: 20160 @@ -990,10 +845,10 @@ buildvariants: TOPOLOGY: server PYTHON_BINARY: /opt/python/3.11/bin/python3 VERSION: "6.0" - - name: ocsp-test-rhel8-py3.12 + - name: ocsp-test-rhel8-v7.0-py3.12 tasks: - name: .ocsp - display_name: OCSP test RHEL8 py3.12 + display_name: OCSP test RHEL8 v7.0 py3.12 run_on: - rhel87-small batchtime: 20160 @@ -1003,10 +858,10 @@ buildvariants: TOPOLOGY: server PYTHON_BINARY: /opt/python/3.12/bin/python3 VERSION: "7.0" - - name: ocsp-test-rhel8-py3.13 + - name: ocsp-test-rhel8-v8.0-py3.13 tasks: - name: .ocsp - display_name: OCSP test RHEL8 py3.13 + display_name: OCSP test RHEL8 v8.0 py3.13 run_on: - rhel87-small batchtime: 20160 @@ -1016,10 +871,10 @@ buildvariants: TOPOLOGY: server PYTHON_BINARY: /opt/python/3.13/bin/python3 VERSION: "8.0" - - name: ocsp-test-rhel8-pypy3.9 + - name: ocsp-test-rhel8-rapid-pypy3.9 tasks: - name: .ocsp - display_name: OCSP test RHEL8 pypy3.9 + display_name: OCSP test RHEL8 rapid pypy3.9 run_on: - rhel87-small batchtime: 20160 @@ -1029,10 +884,10 @@ buildvariants: TOPOLOGY: server PYTHON_BINARY: /opt/python/pypy3.9/bin/python3 VERSION: rapid - - name: ocsp-test-rhel8-pypy3.10 + - name: ocsp-test-rhel8-latest-pypy3.10 tasks: - name: .ocsp - display_name: OCSP test RHEL8 pypy3.10 + display_name: OCSP test RHEL8 latest pypy3.10 run_on: - rhel87-small batchtime: 20160 @@ -1042,10 +897,10 @@ buildvariants: TOPOLOGY: server PYTHON_BINARY: /opt/python/pypy3.10/bin/python3 VERSION: latest - - name: ocsp-test-win64-py3.9 + - name: ocsp-test-win64-v4.4-py3.9 tasks: - name: .ocsp-rsa !.ocsp-staple - display_name: OCSP test Win64 py3.9 + display_name: OCSP test Win64 v4.4 py3.9 run_on: - windows-64-vsMulti-small batchtime: 20160 @@ -1055,10 +910,10 @@ buildvariants: TOPOLOGY: server PYTHON_BINARY: C:/python/Python39/python.exe VERSION: "4.4" - - name: ocsp-test-win64-py3.13 + - name: ocsp-test-win64-v8.0-py3.13 tasks: - name: .ocsp-rsa !.ocsp-staple - display_name: OCSP test Win64 py3.13 + display_name: OCSP test Win64 v8.0 py3.13 run_on: - windows-64-vsMulti-small batchtime: 20160 @@ -1068,10 +923,10 @@ buildvariants: TOPOLOGY: server PYTHON_BINARY: C:/python/Python313/python.exe VERSION: "8.0" - - name: ocsp-test-macos-py3.9 + - name: ocsp-test-macos-v4.4-py3.9 tasks: - name: .ocsp-rsa !.ocsp-staple - display_name: OCSP test macOS py3.9 + display_name: OCSP test macOS v4.4 py3.9 run_on: - macos-14 batchtime: 20160 @@ -1081,10 +936,10 @@ buildvariants: TOPOLOGY: server PYTHON_BINARY: /Library/Frameworks/Python.Framework/Versions/3.9/bin/python3 VERSION: "4.4" - - name: ocsp-test-macos-py3.13 + - name: ocsp-test-macos-v8.0-py3.13 tasks: - name: .ocsp-rsa !.ocsp-staple - display_name: OCSP test macOS py3.13 + display_name: OCSP test macOS v8.0 py3.13 run_on: - macos-14 batchtime: 20160 diff --git a/.evergreen/scripts/generate_config.py b/.evergreen/scripts/generate_config.py index b8b8fa367c..eefd04b040 100644 --- a/.evergreen/scripts/generate_config.py +++ b/.evergreen/scripts/generate_config.py @@ -152,6 +152,7 @@ def get_display_name(base: str, host: str | None = None, **kwargs) -> str: if host is not None: display_name += f" {HOSTS[host].display_name}" version = kwargs.pop("VERSION", None) + version = version or kwargs.pop("version", None) if version: if version not in ["rapid", "latest"]: version = f"v{version}" @@ -354,25 +355,20 @@ def get_encryption_expansions(encryption): def create_load_balancer_variants(): - # Load balancer tests - run all supported versions for all combinations of auth and ssl and system python. + # Load balancer tests - run all supported server versions using the lowest supported python. host = "rhel8" - task_names = ["load-balancer-test"] batchtime = BATCHTIME_WEEK - expansions_base = dict(test_loadbalancer="true") versions = get_versions_from("6.0") variants = [] - pythons = CPYTHONS + PYPYS - for ind, (version, (auth, ssl)) in enumerate(product(versions, AUTH_SSLS)): - expansions = dict(VERSION=version, AUTH=auth, SSL=ssl) - expansions.update(expansions_base) - python = pythons[ind % len(pythons)] - display_name = get_display_name("Load Balancer", host, python=python, **expansions) + for version in versions: + python = CPYTHONS[0] + display_name = get_display_name("Load Balancer", host, python=python, version=version) variant = create_variant( - task_names, + [".load-balancer"], display_name, python=python, host=host, - expansions=expansions, + version=version, batchtime=batchtime, ) variants.append(variant) @@ -773,6 +769,22 @@ def create_server_tasks(): return tasks +def create_load_balancer_tasks(): + tasks = [] + for auth, ssl in AUTH_SSLS: + name = f"test-load-balancer-{auth}-{ssl}".lower() + tags = ["load-balancer", auth, ssl] + bootstrap_vars = dict(TOPOLOGY="sharded_cluster", AUTH=auth, SSL=ssl, LOAD_BALANCER="true") + bootstrap_func = FunctionCall(func="bootstrap mongo-orchestration", vars=bootstrap_vars) + balancer_func = FunctionCall(func="run load-balancer") + test_vars = dict(AUTH=auth, SSL=ssl, test_loadbalancer="true") + test_func = FunctionCall(func="run tests", vars=test_vars) + tasks.append( + EvgTask(name=name, tags=tags, commands=[bootstrap_func, balancer_func, test_func]) + ) + return tasks + + ################## # Generate Config ##################