Skip to content

PYTHON-5313 Create Evergreen tests that do not run orchestration #2284

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 17 commits into from
Apr 18, 2025
Merged
55 changes: 20 additions & 35 deletions .evergreen/generated_configs/tasks.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,4 @@
tasks:
# Atlas connect tests
- name: test-atlas-connect
commands:
- func: assume ec2 role
- func: run tests
vars:
TEST_NAME: atlas_connect
tags: [atlas_connect]

# Atlas data lake tests
- name: test-atlas-data-lake-without_ext
commands:
- func: run tests
vars:
TEST_NAME: data_lake
NO_EXT: "1"
tags: [atlas_data_lake]
- name: test-atlas-data-lake-with_ext
commands:
- func: run tests
vars:
TEST_NAME: data_lake
tags: [atlas_data_lake]

# Aws lambda tests
- name: test-aws-lambda-deployed
commands:
Expand Down Expand Up @@ -1068,14 +1044,6 @@ tasks:
TEST_NAME: load_balancer
tags: [load-balancer, noauth, nossl]

# Mockupdb tests
- name: test-mockupdb
commands:
- func: run tests
vars:
TEST_NAME: mockupdb
tags: [mockupdb]

# Mod wsgi tests
- name: mod-wsgi-standalone
commands:
Expand Down Expand Up @@ -1118,11 +1086,28 @@ tasks:
SUB_TEST_NAME: embedded
tags: [mod_wsgi]

# No server tests
- name: test-no-server
# No orchestration tests
- name: test-no-orchestration-python3.9
commands:
- func: assume ec2 role
- func: run tests
vars:
PYTHON_VERSION: "3.9"
tags: [no-orchestration, python-3.9]
- name: test-no-orchestration-python3.13
commands:
- func: assume ec2 role
- func: run tests
vars:
PYTHON_VERSION: "3.13"
tags: [no-orchestration, python-3.13]
- name: test-no-orchestration-pypy3.10
commands:
- func: assume ec2 role
- func: run tests
tags: [no-server]
vars:
PYTHON_VERSION: pypy3.10
tags: [no-orchestration, python-pypy3.10]

# Ocsp tests
- name: test-ocsp-ecdsa-valid-cert-server-does-not-staple-v4.4-python3.9
Expand Down
46 changes: 14 additions & 32 deletions .evergreen/generated_configs/variants.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,40 +64,22 @@ buildvariants:
NO_EXT: "1"

# Atlas connect tests
- name: atlas-connect-rhel8-python3.9
- name: atlas-connect-rhel8
tasks:
- name: .atlas_connect
display_name: Atlas connect RHEL8 Python3.9
- name: .no-orchestration
display_name: Atlas connect RHEL8
run_on:
- rhel87-small
expansions:
PYTHON_BINARY: /opt/python/3.9/bin/python3
- name: atlas-connect-rhel8-python3.13
tasks:
- name: .atlas_connect
display_name: Atlas connect RHEL8 Python3.13
run_on:
- rhel87-small
expansions:
PYTHON_BINARY: /opt/python/3.13/bin/python3

# Atlas data lake tests
- name: atlas-data-lake-ubuntu-22-python3.9
- name: atlas-data-lake-ubuntu-22
tasks:
- name: .atlas_data_lake
display_name: Atlas Data Lake Ubuntu-22 Python3.9
- name: .no-orchestration
display_name: Atlas Data Lake Ubuntu-22
run_on:
- ubuntu2204-small
expansions:
PYTHON_BINARY: /opt/python/3.9/bin/python3
- name: atlas-data-lake-ubuntu-22-python3.13
tasks:
- name: .atlas_data_lake
display_name: Atlas Data Lake Ubuntu-22 Python3.13
run_on:
- ubuntu2204-small
expansions:
PYTHON_BINARY: /opt/python/3.13/bin/python3
TEST_NAME: data_lake

# Aws auth tests
- name: auth-aws-ubuntu-20-python3.9
Expand Down Expand Up @@ -579,14 +561,14 @@ buildvariants:
batchtime: 10080

# Mockupdb tests
- name: mockupdb-rhel8-python3.9
- name: mockupdb-rhel8
tasks:
- name: .mockupdb
display_name: MockupDB RHEL8 Python3.9
- name: .no-orchestration
display_name: MockupDB RHEL8
run_on:
- rhel87-small
expansions:
PYTHON_BINARY: /opt/python/3.9/bin/python3
TEST_NAME: mockupdb

# Mod wsgi tests
- name: mod_wsgi-ubuntu-22-python3.9
Expand Down Expand Up @@ -617,10 +599,10 @@ buildvariants:
- rhel87-small

# No server tests
- name: no-server
- name: no-server-rhel8
tasks:
- name: .no-server
display_name: No server
- name: .no-orchestration
display_name: No server RHEL8
run_on:
- rhel87-small

Expand Down
81 changes: 29 additions & 52 deletions .evergreen/scripts/generate_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -366,14 +366,11 @@ def create_no_c_ext_variants():


def create_atlas_data_lake_variants():
variants = []
host = HOSTS["ubuntu22"]
for python in MIN_MAX_PYTHON:
tasks = [".atlas_data_lake"]
display_name = get_variant_name("Atlas Data Lake", host, python=python)
variant = create_variant(tasks, display_name, host=host, python=python)
variants.append(variant)
return variants
tasks = [".no-orchestration"]
expansions = dict(TEST_NAME="data_lake")
display_name = get_variant_name("Atlas Data Lake", host)
return [create_variant(tasks, display_name, host=host, expansions=expansions)]


def create_mod_wsgi_variants():
Expand Down Expand Up @@ -450,13 +447,13 @@ def create_search_index_variants():

def create_mockupdb_variants():
host = DEFAULT_HOST
python = CPYTHONS[0]
expansions = dict(TEST_NAME="mockupdb")
return [
create_variant(
[".mockupdb"],
get_variant_name("MockupDB", host, python=python),
python=python,
[".no-orchestration"],
get_variant_name("MockupDB", host),
host=host,
expansions=expansions,
)
]

Expand All @@ -478,12 +475,10 @@ def create_atlas_connect_variants():
host = DEFAULT_HOST
return [
create_variant(
[".atlas_connect"],
get_variant_name("Atlas connect", host, python=python),
python=python,
host=host,
[".no-orchestration"],
get_variant_name("Atlas connect", host),
host=DEFAULT_HOST,
)
for python in MIN_MAX_PYTHON
]


Expand Down Expand Up @@ -539,7 +534,8 @@ def create_aws_auth_variants():

def create_no_server_variants():
host = HOSTS["rhel8"]
return [create_variant([".no-server"], "No server", host=host)]
name = get_variant_name("No server", host=host)
return [create_variant([".no-orchestration"], name, host=host)]


def create_alternative_hosts_variants():
Expand Down Expand Up @@ -705,6 +701,22 @@ def create_server_tasks():
return tasks


def create_no_orchestration_tasks():
tasks = []
for python in [*MIN_MAX_PYTHON, PYPYS[-1]]:
tags = [
"no-orchestration",
f"python-{python}",
]
name = get_task_name("test-no-orchestration", python=python)
assume_func = FunctionCall(func="assume ec2 role")
test_vars = dict(PYTHON_VERSION=python)
test_func = FunctionCall(func="run tests", vars=test_vars)
commands = [assume_func, test_func]
tasks.append(EvgTask(name=name, tags=tags, commands=commands))
return tasks


def create_load_balancer_tasks():
tasks = []
for (auth, ssl), version in product(AUTH_SSLS, get_versions_from("6.0")):
Expand Down Expand Up @@ -863,15 +875,6 @@ def create_search_index_tasks():
return [EvgTask(name=task_name, tags=tags, commands=commands)]


def create_atlas_connect_tasks():
vars = dict(TEST_NAME="atlas_connect")
assume_func = FunctionCall(func="assume ec2 role")
test_func = FunctionCall(func="run tests", vars=vars)
task_name = "test-atlas-connect"
tags = ["atlas_connect"]
return [EvgTask(name=task_name, tags=tags, commands=[assume_func, test_func])]


def create_enterprise_auth_tasks():
tasks = []
for python in [*MIN_MAX_PYTHON, PYPYS[-1]]:
Expand Down Expand Up @@ -909,18 +912,6 @@ def create_perf_tasks():
return tasks


def create_atlas_data_lake_tasks():
tags = ["atlas_data_lake"]
tasks = []
for c_ext in C_EXTS:
vars = dict(TEST_NAME="data_lake")
handle_c_ext(c_ext, vars)
test_func = FunctionCall(func="run tests", vars=vars)
task_name = f"test-atlas-data-lake-{c_ext}"
tasks.append(EvgTask(name=task_name, tags=tags, commands=[test_func]))
return tasks


def create_getdata_tasks():
# Wildcard task. Do you need to find out what tools are available and where?
# Throw it here, and execute this task on all buildvariants
Expand Down Expand Up @@ -1000,20 +991,6 @@ def create_ocsp_tasks():
return tasks


def create_mockupdb_tasks():
test_func = FunctionCall(func="run tests", vars=dict(TEST_NAME="mockupdb"))
task_name = "test-mockupdb"
tags = ["mockupdb"]
return [EvgTask(name=task_name, tags=tags, commands=[test_func])]


def create_no_server_tasks():
test_func = FunctionCall(func="run tests")
task_name = "test-no-server"
tags = ["no-server"]
return [EvgTask(name=task_name, tags=tags, commands=[test_func])]


def create_free_threading_tasks():
vars = dict(VERSION="8.0", TOPOLOGY="replica_set")
server_func = FunctionCall(func="run server", vars=vars)
Expand Down
1 change: 1 addition & 0 deletions test/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ def _init_client(self):
if os.environ.get("TEST_DATA_LAKE"):
self.is_data_lake = True
self.auth_enabled = True
self.client.close()
self.client = self._connect(host, port, username=db_user, password=db_pwd)
self.connected = True
return
Expand Down
1 change: 1 addition & 0 deletions test/asynchronous/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ async def _init_client(self):
if os.environ.get("TEST_DATA_LAKE"):
self.is_data_lake = True
self.auth_enabled = True
await self.client.close()
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was a bug that was caught when running on pypy, it raised an error during teardown.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So we get an existing connection, close it and then establish a new connection?
Is this because the GC isn't calling close properly?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The GC is working as intended, it just raises a warning that close() wasn't called. Yeah, we need a new client with new options.

self.client = await self._connect(host, port, username=db_user, password=db_pwd)
self.connected = True
return
Expand Down
Loading