Skip to content

Commit 6ed3533

Browse files
authored
PYTHON-5313 Create Evergreen tests that do not run orchestration (#2284)
1 parent 0f37bfd commit 6ed3533

File tree

5 files changed

+65
-119
lines changed

5 files changed

+65
-119
lines changed

.evergreen/generated_configs/tasks.yml

+20-35
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,4 @@
11
tasks:
2-
# Atlas connect tests
3-
- name: test-atlas-connect
4-
commands:
5-
- func: assume ec2 role
6-
- func: run tests
7-
vars:
8-
TEST_NAME: atlas_connect
9-
tags: [atlas_connect]
10-
11-
# Atlas data lake tests
12-
- name: test-atlas-data-lake-without_ext
13-
commands:
14-
- func: run tests
15-
vars:
16-
TEST_NAME: data_lake
17-
NO_EXT: "1"
18-
tags: [atlas_data_lake]
19-
- name: test-atlas-data-lake-with_ext
20-
commands:
21-
- func: run tests
22-
vars:
23-
TEST_NAME: data_lake
24-
tags: [atlas_data_lake]
25-
262
# Aws lambda tests
273
- name: test-aws-lambda-deployed
284
commands:
@@ -494,14 +470,6 @@ tasks:
494470
TEST_NAME: load_balancer
495471
tags: [load-balancer, noauth, nossl]
496472

497-
# Mockupdb tests
498-
- name: test-mockupdb
499-
commands:
500-
- func: run tests
501-
vars:
502-
TEST_NAME: mockupdb
503-
tags: [mockupdb]
504-
505473
# Mod wsgi tests
506474
- name: mod-wsgi-replica-set-python3.9
507475
commands:
@@ -564,11 +532,28 @@ tasks:
564532
PYTHON_VERSION: "3.13"
565533
tags: [mod_wsgi]
566534

567-
# No server tests
568-
- name: test-no-server
535+
# No orchestration tests
536+
- name: test-no-orchestration-python3.9
537+
commands:
538+
- func: assume ec2 role
539+
- func: run tests
540+
vars:
541+
PYTHON_VERSION: "3.9"
542+
tags: [no-orchestration, python-3.9]
543+
- name: test-no-orchestration-python3.13
544+
commands:
545+
- func: assume ec2 role
546+
- func: run tests
547+
vars:
548+
PYTHON_VERSION: "3.13"
549+
tags: [no-orchestration, python-3.13]
550+
- name: test-no-orchestration-pypy3.10
569551
commands:
552+
- func: assume ec2 role
570553
- func: run tests
571-
tags: [no-server]
554+
vars:
555+
PYTHON_VERSION: pypy3.10
556+
tags: [no-orchestration, python-pypy3.10]
572557

573558
# Ocsp tests
574559
- name: test-ocsp-ecdsa-valid-cert-server-does-not-staple-v4.4-python3.9

.evergreen/generated_configs/variants.yml

+14-32
Original file line numberDiff line numberDiff line change
@@ -64,40 +64,22 @@ buildvariants:
6464
NO_EXT: "1"
6565

6666
# Atlas connect tests
67-
- name: atlas-connect-rhel8-python3.9
67+
- name: atlas-connect-rhel8
6868
tasks:
69-
- name: .atlas_connect
70-
display_name: Atlas connect RHEL8 Python3.9
69+
- name: .no-orchestration
70+
display_name: Atlas connect RHEL8
7171
run_on:
7272
- rhel87-small
73-
expansions:
74-
PYTHON_BINARY: /opt/python/3.9/bin/python3
75-
- name: atlas-connect-rhel8-python3.13
76-
tasks:
77-
- name: .atlas_connect
78-
display_name: Atlas connect RHEL8 Python3.13
79-
run_on:
80-
- rhel87-small
81-
expansions:
82-
PYTHON_BINARY: /opt/python/3.13/bin/python3
8373

8474
# Atlas data lake tests
85-
- name: atlas-data-lake-ubuntu-22-python3.9
75+
- name: atlas-data-lake-ubuntu-22
8676
tasks:
87-
- name: .atlas_data_lake
88-
display_name: Atlas Data Lake Ubuntu-22 Python3.9
77+
- name: .no-orchestration
78+
display_name: Atlas Data Lake Ubuntu-22
8979
run_on:
9080
- ubuntu2204-small
9181
expansions:
92-
PYTHON_BINARY: /opt/python/3.9/bin/python3
93-
- name: atlas-data-lake-ubuntu-22-python3.13
94-
tasks:
95-
- name: .atlas_data_lake
96-
display_name: Atlas Data Lake Ubuntu-22 Python3.13
97-
run_on:
98-
- ubuntu2204-small
99-
expansions:
100-
PYTHON_BINARY: /opt/python/3.13/bin/python3
82+
TEST_NAME: data_lake
10183

10284
# Aws auth tests
10385
- name: auth-aws-ubuntu-20
@@ -536,14 +518,14 @@ buildvariants:
536518
batchtime: 10080
537519

538520
# Mockupdb tests
539-
- name: mockupdb-rhel8-python3.9
521+
- name: mockupdb-rhel8
540522
tasks:
541-
- name: .mockupdb
542-
display_name: MockupDB RHEL8 Python3.9
523+
- name: .no-orchestration
524+
display_name: MockupDB RHEL8
543525
run_on:
544526
- rhel87-small
545527
expansions:
546-
PYTHON_BINARY: /opt/python/3.9/bin/python3
528+
TEST_NAME: mockupdb
547529

548530
# Mod wsgi tests
549531
- name: mod_wsgi-ubuntu-22
@@ -564,10 +546,10 @@ buildvariants:
564546
- rhel87-small
565547

566548
# No server tests
567-
- name: no-server
549+
- name: no-server-rhel8
568550
tasks:
569-
- name: .no-server
570-
display_name: No server
551+
- name: .no-orchestration
552+
display_name: No server RHEL8
571553
run_on:
572554
- rhel87-small
573555

.evergreen/scripts/generate_config.py

+29-52
Original file line numberDiff line numberDiff line change
@@ -359,14 +359,11 @@ def create_no_c_ext_variants():
359359

360360

361361
def create_atlas_data_lake_variants():
362-
variants = []
363362
host = HOSTS["ubuntu22"]
364-
for python in MIN_MAX_PYTHON:
365-
tasks = [".atlas_data_lake"]
366-
display_name = get_variant_name("Atlas Data Lake", host, python=python)
367-
variant = create_variant(tasks, display_name, host=host, python=python)
368-
variants.append(variant)
369-
return variants
363+
tasks = [".no-orchestration"]
364+
expansions = dict(TEST_NAME="data_lake")
365+
display_name = get_variant_name("Atlas Data Lake", host)
366+
return [create_variant(tasks, display_name, host=host, expansions=expansions)]
370367

371368

372369
def create_mod_wsgi_variants():
@@ -437,13 +434,13 @@ def create_search_index_variants():
437434

438435
def create_mockupdb_variants():
439436
host = DEFAULT_HOST
440-
python = CPYTHONS[0]
437+
expansions = dict(TEST_NAME="mockupdb")
441438
return [
442439
create_variant(
443-
[".mockupdb"],
444-
get_variant_name("MockupDB", host, python=python),
445-
python=python,
440+
[".no-orchestration"],
441+
get_variant_name("MockupDB", host),
446442
host=host,
443+
expansions=expansions,
447444
)
448445
]
449446

@@ -465,12 +462,10 @@ def create_atlas_connect_variants():
465462
host = DEFAULT_HOST
466463
return [
467464
create_variant(
468-
[".atlas_connect"],
469-
get_variant_name("Atlas connect", host, python=python),
470-
python=python,
471-
host=host,
465+
[".no-orchestration"],
466+
get_variant_name("Atlas connect", host),
467+
host=DEFAULT_HOST,
472468
)
473-
for python in MIN_MAX_PYTHON
474469
]
475470

476471

@@ -525,7 +520,8 @@ def create_aws_auth_variants():
525520

526521
def create_no_server_variants():
527522
host = HOSTS["rhel8"]
528-
return [create_variant([".no-server"], "No server", host=host)]
523+
name = get_variant_name("No server", host=host)
524+
return [create_variant([".no-orchestration"], name, host=host)]
529525

530526

531527
def create_alternative_hosts_variants():
@@ -691,6 +687,22 @@ def create_server_tasks():
691687
return tasks
692688

693689

690+
def create_no_orchestration_tasks():
691+
tasks = []
692+
for python in [*MIN_MAX_PYTHON, PYPYS[-1]]:
693+
tags = [
694+
"no-orchestration",
695+
f"python-{python}",
696+
]
697+
name = get_task_name("test-no-orchestration", python=python)
698+
assume_func = FunctionCall(func="assume ec2 role")
699+
test_vars = dict(PYTHON_VERSION=python)
700+
test_func = FunctionCall(func="run tests", vars=test_vars)
701+
commands = [assume_func, test_func]
702+
tasks.append(EvgTask(name=name, tags=tags, commands=commands))
703+
return tasks
704+
705+
694706
def create_load_balancer_tasks():
695707
tasks = []
696708
for (auth, ssl), version in product(AUTH_SSLS, get_versions_from("6.0")):
@@ -855,15 +867,6 @@ def create_search_index_tasks():
855867
return [EvgTask(name=task_name, tags=tags, commands=commands)]
856868

857869

858-
def create_atlas_connect_tasks():
859-
vars = dict(TEST_NAME="atlas_connect")
860-
assume_func = FunctionCall(func="assume ec2 role")
861-
test_func = FunctionCall(func="run tests", vars=vars)
862-
task_name = "test-atlas-connect"
863-
tags = ["atlas_connect"]
864-
return [EvgTask(name=task_name, tags=tags, commands=[assume_func, test_func])]
865-
866-
867870
def create_enterprise_auth_tasks():
868871
tasks = []
869872
for python in [*MIN_MAX_PYTHON, PYPYS[-1]]:
@@ -901,18 +904,6 @@ def create_perf_tasks():
901904
return tasks
902905

903906

904-
def create_atlas_data_lake_tasks():
905-
tags = ["atlas_data_lake"]
906-
tasks = []
907-
for c_ext in C_EXTS:
908-
vars = dict(TEST_NAME="data_lake")
909-
handle_c_ext(c_ext, vars)
910-
test_func = FunctionCall(func="run tests", vars=vars)
911-
task_name = f"test-atlas-data-lake-{c_ext}"
912-
tasks.append(EvgTask(name=task_name, tags=tags, commands=[test_func]))
913-
return tasks
914-
915-
916907
def create_getdata_tasks():
917908
# Wildcard task. Do you need to find out what tools are available and where?
918909
# Throw it here, and execute this task on all buildvariants
@@ -992,20 +983,6 @@ def create_ocsp_tasks():
992983
return tasks
993984

994985

995-
def create_mockupdb_tasks():
996-
test_func = FunctionCall(func="run tests", vars=dict(TEST_NAME="mockupdb"))
997-
task_name = "test-mockupdb"
998-
tags = ["mockupdb"]
999-
return [EvgTask(name=task_name, tags=tags, commands=[test_func])]
1000-
1001-
1002-
def create_no_server_tasks():
1003-
test_func = FunctionCall(func="run tests")
1004-
task_name = "test-no-server"
1005-
tags = ["no-server"]
1006-
return [EvgTask(name=task_name, tags=tags, commands=[test_func])]
1007-
1008-
1009986
def create_free_threading_tasks():
1010987
vars = dict(VERSION="8.0", TOPOLOGY="replica_set")
1011988
server_func = FunctionCall(func="run server", vars=vars)

test/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@ def _init_client(self):
206206
if os.environ.get("TEST_DATA_LAKE"):
207207
self.is_data_lake = True
208208
self.auth_enabled = True
209+
self.client.close()
209210
self.client = self._connect(host, port, username=db_user, password=db_pwd)
210211
self.connected = True
211212
return

test/asynchronous/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@ async def _init_client(self):
206206
if os.environ.get("TEST_DATA_LAKE"):
207207
self.is_data_lake = True
208208
self.auth_enabled = True
209+
await self.client.close()
209210
self.client = await self._connect(host, port, username=db_user, password=db_pwd)
210211
self.connected = True
211212
return

0 commit comments

Comments
 (0)