Skip to content

Commit 134d166

Browse files
committed
PYTHON-5196 Convert OIDC tests to use new test scripts
1 parent 38127f4 commit 134d166

File tree

7 files changed

+30
-154
lines changed

7 files changed

+30
-154
lines changed

.evergreen/config.yml

Lines changed: 0 additions & 153 deletions
Original file line numberDiff line numberDiff line change
@@ -288,28 +288,6 @@ functions:
288288
- .evergreen/scripts/run-with-env.sh
289289
- .evergreen/scripts/run-atlas-tests.sh
290290

291-
"run oidc auth test with test credentials":
292-
- command: subprocess.exec
293-
type: test
294-
params:
295-
working_dir: "src"
296-
binary: bash
297-
include_expansions_in_env: ["DRIVERS_TOOLS", "AWS_ACCESS_KEY_ID", "AWS_SECRET_ACCESS_KEY", "AWS_SESSION_TOKEN"]
298-
args:
299-
- .evergreen/run-mongodb-oidc-test.sh
300-
301-
"run oidc k8s auth test":
302-
- command: subprocess.exec
303-
type: test
304-
params:
305-
binary: bash
306-
working_dir: src
307-
env:
308-
OIDC_ENV: k8s
309-
include_expansions_in_env: ["DRIVERS_TOOLS", "AWS_ACCESS_KEY_ID", "AWS_SECRET_ACCESS_KEY", "AWS_SESSION_TOKEN", "K8S_VARIANT"]
310-
args:
311-
- ${PROJECT_DIRECTORY}/.evergreen/run-mongodb-oidc-remote-test.sh
312-
313291
"cleanup":
314292
- command: subprocess.exec
315293
params:
@@ -442,96 +420,6 @@ task_groups:
442420
tasks:
443421
- ".serverless"
444422

445-
- name: testazureoidc_task_group
446-
setup_group:
447-
- func: fetch source
448-
- func: setup system
449-
- command: subprocess.exec
450-
params:
451-
binary: bash
452-
env:
453-
AZUREOIDC_VMNAME_PREFIX: "PYTHON_DRIVER"
454-
args:
455-
- ${DRIVERS_TOOLS}/.evergreen/auth_oidc/azure/create-and-setup-vm.sh
456-
teardown_task:
457-
- command: subprocess.exec
458-
params:
459-
binary: bash
460-
args:
461-
- ${DRIVERS_TOOLS}/.evergreen/auth_oidc/azure/delete-vm.sh
462-
setup_group_can_fail_task: true
463-
setup_group_timeout_secs: 1800
464-
tasks:
465-
- oidc-auth-test-azure
466-
467-
- name: testgcpoidc_task_group
468-
setup_group:
469-
- func: fetch source
470-
- func: setup system
471-
- command: subprocess.exec
472-
params:
473-
binary: bash
474-
env:
475-
GCPOIDC_VMNAME_PREFIX: "PYTHON_DRIVER"
476-
args:
477-
- ${DRIVERS_TOOLS}/.evergreen/auth_oidc/gcp/setup.sh
478-
teardown_task:
479-
- command: subprocess.exec
480-
params:
481-
binary: bash
482-
args:
483-
- ${DRIVERS_TOOLS}/.evergreen/auth_oidc/gcp/teardown.sh
484-
setup_group_can_fail_task: true
485-
setup_group_timeout_secs: 1800
486-
tasks:
487-
- oidc-auth-test-gcp
488-
489-
- name: testk8soidc_task_group
490-
setup_group:
491-
- func: fetch source
492-
- func: setup system
493-
- command: ec2.assume_role
494-
params:
495-
role_arn: ${aws_test_secrets_role}
496-
duration_seconds: 1800
497-
- command: subprocess.exec
498-
params:
499-
binary: bash
500-
args:
501-
- ${DRIVERS_TOOLS}/.evergreen/auth_oidc/k8s/setup.sh
502-
teardown_task:
503-
- command: subprocess.exec
504-
params:
505-
binary: bash
506-
args:
507-
- ${DRIVERS_TOOLS}/.evergreen/auth_oidc/k8s/teardown.sh
508-
setup_group_can_fail_task: true
509-
setup_group_timeout_secs: 1800
510-
tasks:
511-
- oidc-auth-test-k8s
512-
513-
- name: testoidc_task_group
514-
setup_group:
515-
- func: fetch source
516-
- func: setup system
517-
- func: "assume ec2 role"
518-
- command: subprocess.exec
519-
params:
520-
binary: bash
521-
include_expansions_in_env: ["AWS_ACCESS_KEY_ID", "AWS_SECRET_ACCESS_KEY", "AWS_SESSION_TOKEN"]
522-
args:
523-
- ${DRIVERS_TOOLS}/.evergreen/auth_oidc/setup.sh
524-
teardown_task:
525-
- command: subprocess.exec
526-
params:
527-
binary: bash
528-
args:
529-
- ${DRIVERS_TOOLS}/.evergreen/auth_oidc/teardown.sh
530-
setup_group_can_fail_task: true
531-
setup_group_timeout_secs: 1800
532-
tasks:
533-
- oidc-auth-test
534-
535423
- name: test_aws_lambda_task_group
536424
setup_group:
537425
- func: fetch source
@@ -1028,47 +916,6 @@ tasks:
1028916
OCSP_ALGORITHM: "ecdsa"
1029917
OCSP_TLS_SHOULD_SUCCEED: "false"
1030918

1031-
- name: "oidc-auth-test"
1032-
commands:
1033-
- func: "run oidc auth test with test credentials"
1034-
1035-
- name: "oidc-auth-test-azure"
1036-
commands:
1037-
- command: subprocess.exec
1038-
type: test
1039-
params:
1040-
binary: bash
1041-
working_dir: src
1042-
env:
1043-
OIDC_ENV: azure
1044-
include_expansions_in_env: ["DRIVERS_TOOLS"]
1045-
args:
1046-
- ${PROJECT_DIRECTORY}/.evergreen/run-mongodb-oidc-remote-test.sh
1047-
1048-
- name: "oidc-auth-test-gcp"
1049-
commands:
1050-
- command: subprocess.exec
1051-
type: test
1052-
params:
1053-
binary: bash
1054-
working_dir: src
1055-
env:
1056-
OIDC_ENV: gcp
1057-
include_expansions_in_env: ["DRIVERS_TOOLS"]
1058-
args:
1059-
- ${PROJECT_DIRECTORY}/.evergreen/run-mongodb-oidc-remote-test.sh
1060-
1061-
- name: "oidc-auth-test-k8s"
1062-
commands:
1063-
- func: "run oidc k8s auth test"
1064-
vars:
1065-
K8S_VARIANT: eks
1066-
- func: "run oidc k8s auth test"
1067-
vars:
1068-
K8S_VARIANT: gke
1069-
- func: "run oidc k8s auth test"
1070-
vars:
1071-
K8S_VARIANT: aks
1072919
# }}}
1073920
- name: "coverage-report"
1074921
tags: ["coverage"]

.evergreen/scripts/generate_config.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -884,6 +884,12 @@ def create_aws_tasks():
884884
return tasks
885885

886886

887+
def create_oidc_tasks():
888+
tasks = []
889+
tasks.append([])
890+
return tasks
891+
892+
887893
##################
888894
# Generate Config
889895
##################

.evergreen/scripts/run_server.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ def start_server():
3232
elif test_name == "load_balancer":
3333
set_env("LOAD_BALANCER")
3434

35+
elif test_name == "auth_oidc":
36+
cmd = ["bash", f"{DRIVERS_TOOLS}/.evergreen/auth_oidc/start-local-server.sh"]
37+
run_command(cmd, cwd=DRIVERS_TOOLS)
38+
return
39+
3540
if not os.environ.get("TEST_CRYPT_SHARED"):
3641
set_env("SKIP_CRYPT_SHARED")
3742

.evergreen/scripts/run_tests.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,13 @@ def run() -> None:
112112
run_command(f"{DRIVERS_TOOLS}/.evergreen/auth_aws/aws_setup.sh ecs")
113113
return
114114

115+
# Run remote oidc tests.
116+
if TEST_NAME == "auth_oidc" and SUB_TEST_NAME in [""]:
117+
from oidc_tester import test_oidc_remote
118+
119+
test_oidc_remote(SUB_TEST_NAME)
120+
return
121+
115122
if os.environ.get("DEBUG_LOG"):
116123
TEST_ARGS.extend(f"-o log_cli_level={logging.DEBUG} -o log_cli=1".split())
117124

.evergreen/scripts/setup_tests.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,9 @@ def handle_test_env() -> None:
239239
cmd = f'bash "{DRIVERS_TOOLS}/.evergreen/run-load-balancer.sh" start'
240240
run_command(cmd)
241241

242+
if test_name == "oidc":
243+
pass
244+
242245
if SSL != "nossl":
243246
if not DRIVERS_TOOLS:
244247
raise RuntimeError("Missing DRIVERS_TOOLS")

.evergreen/scripts/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class Distro:
4949
}
5050

5151
# Tests that require a sub test suite.
52-
SUB_TEST_REQUIRED = ["auth_aws", "kms"]
52+
SUB_TEST_REQUIRED = ["auth_aws", "auth_oidc", "kms"]
5353

5454

5555
def get_test_options(

justfile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,14 @@ teardown-tests:
7676
run-server *args="":
7777
bash .evergreen/scripts/run-server.sh {{args}}
7878

79+
[group('server')]
80+
run-atlas-server *args="":
81+
bash .evergreen/scripts/run-atlas-server.sh {{args}}
82+
7983
[group('server')]
8084
stop-server:
8185
bash .evergreen/scripts/stop-server.sh
86+
87+
[group('server')]
88+
stop-atlas-server *args="":
89+
bash .evergreen/scripts/stop-atlas-server.sh {{args}}

0 commit comments

Comments
 (0)