Skip to content

Commit afbce56

Browse files
committed
PYTHON-5206 Convert Atlas Connect and Enterprise Auth tests to use new test scripts
1 parent 189923f commit afbce56

File tree

8 files changed

+34
-70
lines changed

8 files changed

+34
-70
lines changed

.evergreen/config.yml

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -267,28 +267,6 @@ functions:
267267
binary: bash
268268
args: [.evergreen/just.sh, run-tests]
269269

270-
"run enterprise auth tests":
271-
- command: subprocess.exec
272-
type: test
273-
params:
274-
binary: bash
275-
working_dir: "src"
276-
include_expansions_in_env: ["AWS_ACCESS_KEY_ID", "AWS_SECRET_ACCESS_KEY", "AWS_SESSION_TOKEN", "PYTHON_BINARY"]
277-
args:
278-
- .evergreen/scripts/run-with-env.sh
279-
- .evergreen/scripts/run-enterprise-auth-tests.sh
280-
281-
"run atlas tests":
282-
- command: subprocess.exec
283-
type: test
284-
params:
285-
binary: bash
286-
include_expansions_in_env: ["AWS_ACCESS_KEY_ID", "AWS_SECRET_ACCESS_KEY", "AWS_SESSION_TOKEN", "PYTHON_BINARY"]
287-
working_dir: "src"
288-
args:
289-
- .evergreen/scripts/run-with-env.sh
290-
- .evergreen/scripts/run-atlas-tests.sh
291-
292270
"cleanup":
293271
- command: subprocess.exec
294272
params:
@@ -452,13 +430,6 @@ tasks:
452430
vars:
453431
TEST_NAME: serverless
454432

455-
- name: "test-enterprise-auth"
456-
tags: ["enterprise-auth"]
457-
commands:
458-
- func: "run server"
459-
- func: "assume ec2 role"
460-
- func: "run enterprise auth tests"
461-
462433
- name: "test-search-index-helpers"
463434
commands:
464435
- func: "run server"
@@ -518,12 +489,6 @@ tasks:
518489
TOPOLOGY: "replica_set"
519490
- func: "run tests"
520491

521-
- name: "atlas-connect"
522-
tags: ["atlas-connect"]
523-
commands:
524-
- func: "assume ec2 role"
525-
- func: "run atlas tests"
526-
527492
- name: atlas-data-lake-tests
528493
commands:
529494
- func: "bootstrap data lake"

.evergreen/scripts/generate_config.py

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,6 @@ def create_compression_variants():
464464

465465

466466
def create_enterprise_auth_variants():
467-
expansions = dict(AUTH="auth")
468467
variants = []
469468

470469
# All python versions across platforms.
@@ -475,10 +474,8 @@ def create_enterprise_auth_variants():
475474
host = HOSTS["win64"]
476475
else:
477476
host = DEFAULT_HOST
478-
display_name = get_display_name("Auth Enterprise", host, python=python, **expansions)
479-
variant = create_variant(
480-
["test-enterprise-auth"], display_name, host=host, python=python, expansions=expansions
481-
)
477+
display_name = get_display_name("Auth Enterprise", host, python=python)
478+
variant = create_variant([".enterprise_auth"], display_name, host=host, python=python)
482479
variants.append(variant)
483480

484481
return variants
@@ -723,7 +720,7 @@ def create_atlas_connect_variants():
723720
host = DEFAULT_HOST
724721
return [
725722
create_variant(
726-
["atlas-connect"],
723+
[".atlas_connect"],
727724
get_display_name("Atlas connect", host, python=python),
728725
python=python,
729726
host=host,
@@ -915,6 +912,25 @@ def _create_ocsp_task(algo, variant, server_type, base_task_name):
915912
return EvgTask(name=task_name, tags=tags, commands=commands)
916913

917914

915+
def create_atlas_connect_tasks():
916+
vars = dict(TEST_NAME="atlas_connect")
917+
assume_func = FunctionCall(func="assume ec2 role")
918+
test_func = FunctionCall(func="run tests", vars=vars)
919+
task_name = "test-atlas-connect"
920+
tags = ["atlas_connect"]
921+
return [EvgTask(name=task_name, tags=tags, commands=[assume_func, test_func])]
922+
923+
924+
def create_enterprise_auth_tasks():
925+
vars = dict(TEST_NAME="enterprise_auth", AUTH="auth")
926+
server_func = FunctionCall(func="run server", vars=vars)
927+
assume_func = FunctionCall(func="assume ec2 role")
928+
test_func = FunctionCall(func="run tests", vars=vars)
929+
task_name = "test-enterprise-ath"
930+
tags = ["enterprise_auth"]
931+
return [EvgTask(name=task_name, tags=tags, commands=[server_func, assume_func, test_func])]
932+
933+
918934
def create_ocsp_tasks():
919935
tasks = []
920936
tests = [

.evergreen/scripts/run-atlas-tests.sh

Lines changed: 0 additions & 8 deletions
This file was deleted.

.evergreen/scripts/run-direct-tests.sh

Lines changed: 0 additions & 10 deletions
This file was deleted.

.evergreen/scripts/run-enterprise-auth-tests.sh

Lines changed: 0 additions & 9 deletions
This file was deleted.

.evergreen/scripts/setup_tests.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,10 @@ def setup_libmongocrypt():
112112
run_command("chmod +x libmongocrypt/nocrypto/bin/mongocrypt.dll")
113113

114114

115+
def get_secrets(name: str) -> None:
116+
run_command(f"bash {DRIVERS_TOOLS}/.evergreen/secrets_handling/setup-secrets.sh {name}")
117+
118+
115119
def handle_test_env() -> None:
116120
opts, _ = get_test_options("Set up the test environment and services.")
117121
test_name = opts.test_name
@@ -345,6 +349,12 @@ def handle_test_env() -> None:
345349
else:
346350
run_command(f"bash {auth_aws_dir}/setup-secrets.sh")
347351

352+
if test_name == "atlas_connect":
353+
get_secrets("drivers/atlas_connect")
354+
355+
if test_name == "enterprise_auth":
356+
get_secrets("drivers/enterprise_auth")
357+
348358
if test_name == "perf":
349359
# PYTHON-4769 Run perf_test.py directly otherwise pytest's test collection negatively
350360
# affects the benchmark results.

.evergreen/scripts/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class Distro:
3030

3131
# Map the test name to a test suite.
3232
TEST_SUITE_MAP = {
33-
"atlas": "atlas",
33+
"atlas_connect": "atlas_connect",
3434
"auth_aws": "auth_aws",
3535
"auth_oidc": "auth_oidc",
3636
"data_lake": "data_lake",

test/atlas/test_connection.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
import pymongo
2929
from pymongo.ssl_support import HAS_SNI
3030

31-
pytestmark = pytest.mark.atlas
31+
pytestmark = pytest.mark.atlas_connect
3232

3333

3434
URIS = {

0 commit comments

Comments
 (0)