Skip to content

Commit 206b99e

Browse files
RUST-2055 Filter OIDC tests with cargo nextest (#1317)
1 parent 54238fb commit 206b99e

File tree

4 files changed

+153
-204
lines changed

4 files changed

+153
-204
lines changed

.evergreen/config.yml

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ buildvariants:
286286
- test-k8s-oidc-task-group
287287

288288
- name: oidc-macos
289-
display_name: "OIDC Macos"
289+
display_name: "OIDC MacOS"
290290
patchable: true
291291
run_on:
292292
- macos-14
@@ -645,6 +645,7 @@ task_groups:
645645
${PREPARE_SHELL}
646646
${DRIVERS_TOOLS}/.evergreen/auth_oidc/setup.sh
647647
teardown_task:
648+
- func: "upload test results"
648649
- command: subprocess.exec
649650
params:
650651
binary: bash
@@ -1177,7 +1178,7 @@ tasks:
11771178
- ${DRIVERS_TOOLS}/.evergreen/auth_oidc/azure/run-driver-test.sh
11781179
env:
11791180
AZUREOIDC_DRIVERS_TAR_FILE: ${STATIC_TEST_TARBALL}
1180-
AZUREOIDC_TEST_CMD: "ls -laR data && PROJECT_DIRECTORY='.' OIDC_ENV=azure OIDC=oidc TEST_FILE=./${STATIC_TEST_BINARY} ./.evergreen/run-mongodb-oidc-test.sh"
1181+
AZUREOIDC_TEST_CMD: "source ./env.sh && RUST_BACKTRACE=1 ./${STATIC_TEST_BINARY} test::spec::oidc_skip_ci::azure -- --no-capture"
11811182

11821183
- name: "oidc-auth-test-gcp-latest"
11831184
commands:
@@ -1193,7 +1194,7 @@ tasks:
11931194
- ${DRIVERS_TOOLS}/.evergreen/auth_oidc/gcp/run-driver-test.sh
11941195
env:
11951196
GCPOIDC_DRIVERS_TAR_FILE: ${STATIC_TEST_TARBALL}
1196-
GCPOIDC_TEST_CMD: "ls -la && PROJECT_DIRECTORY='.' OIDC_ENV=gcp OIDC=oidc TEST_FILE=./${STATIC_TEST_BINARY} ./.evergreen/run-mongodb-oidc-test.sh"
1197+
GCPOIDC_TEST_CMD: "source ./secrets-export.sh && RUST_BACKTRACE=1 ./${STATIC_TEST_BINARY} test::spec::oidc_skip_ci::gcp -- --no-capture"
11971198

11981199
- name: "oidc-auth-test-k8s-latest"
11991200
commands:
@@ -1700,16 +1701,16 @@ functions:
17001701
role_arn: ${aws_test_secrets_role}
17011702

17021703
"run oidc auth test with test credentials":
1703-
- command: shell.exec
1704+
- command: subprocess.exec
17041705
type: test
17051706
params:
17061707
working_dir: src
1707-
shell: bash
1708-
include_expansions_in_env: ["DRIVERS_TOOLS", "AWS_ACCESS_KEY_ID", "AWS_SECRET_ACCESS_KEY", "AWS_SESSION_TOKEN"]
1709-
script: |
1710-
${PREPARE_SHELL}
1711-
export OIDC="oidc"
1712-
.evergreen/run-mongodb-oidc-test.sh
1708+
binary: bash
1709+
include_expansions_in_env:
1710+
- DRIVERS_TOOLS
1711+
- PROJECT_DIRECTORY
1712+
args:
1713+
- .evergreen/run-mongodb-oidc-test.sh
17131714

17141715
"start happy eyeballs server":
17151716
- command: subprocess.exec
@@ -1953,7 +1954,7 @@ functions:
19531954
- ${DRIVERS_TOOLS}/.evergreen/auth_oidc/k8s/run-driver-test.sh
19541955
env:
19551956
K8S_DRIVERS_TAR_FILE: ${STATIC_TEST_TARBALL}
1956-
K8S_TEST_CMD: "ls -la && PROJECT_DIRECTORY='.' OIDC_ENV=k8s OIDC=oidc TEST_FILE=./${STATIC_TEST_BINARY} ./.evergreen/run-mongodb-oidc-test.sh"
1957+
K8S_TEST_CMD: "RUST_BACKTRACE=1 ./${STATIC_TEST_BINARY} test::spec::oidc_skip_ci::k8s -- --no-capture"
19571958
include_expansions_in_env:
19581959
- AWS_ACCESS_KEY_ID
19591960
- AWS_SECRET_ACCESS_KEY

.evergreen/run-mongodb-oidc-test.sh

Lines changed: 15 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -3,44 +3,23 @@
33
set +x # Disable debug trace
44
set -o errexit # Exit the script with error if any of the commands fail
55

6+
source .evergreen/env.sh
7+
source .evergreen/cargo-test.sh
8+
9+
CARGO_OPTIONS+=("--ignore-default-filter")
10+
611
echo "Running MONGODB-OIDC authentication tests"
712

8-
OIDC_ENV=${OIDC_ENV:-"test"}
9-
10-
export TEST_AUTH_OIDC=1
11-
export COVERAGE=1
12-
export AUTH="auth"
13-
14-
if [ $OIDC_ENV == "test" ]; then
15-
16-
source .evergreen/env.sh
17-
source .evergreen/cargo-test.sh
18-
# Make sure DRIVERS_TOOLS is set.
19-
if [ -z "$DRIVERS_TOOLS" ]; then
20-
echo "Must specify DRIVERS_TOOLS"
21-
exit 1
22-
fi
23-
source ${DRIVERS_TOOLS}/.evergreen/auth_oidc/secrets-export.sh
24-
25-
cargo nextest run test::spec::oidc::basic --no-capture --profile ci
26-
RESULT=$?
27-
cp target/nextest/ci/junit.xml results.xml
28-
elif [ $OIDC_ENV == "azure" ]; then
29-
source ./env.sh
30-
31-
$TEST_FILE test::spec::oidc::azure --nocapture
32-
RESULT=$?
33-
elif [ $OIDC_ENV == "gcp" ]; then
34-
source ./secrets-export.sh
35-
36-
$TEST_FILE test::spec::oidc::gcp --nocapture
37-
RESULT=$?
38-
elif [ $OIDC_ENV == "k8s" ]; then
39-
$TEST_FILE test::spec::oidc::k8s --nocapture
40-
RESULT=$?
41-
else
42-
echo "Unrecognized OIDC_ENV '${OIDC_ENV}'"
13+
# Make sure DRIVERS_TOOLS is set.
14+
if [ -z "$DRIVERS_TOOLS" ]; then
15+
echo "Must specify DRIVERS_TOOLS"
4316
exit 1
4417
fi
4518

46-
exit $RESULT
19+
source ${DRIVERS_TOOLS}/.evergreen/auth_oidc/secrets-export.sh
20+
21+
set +o errexit
22+
23+
cargo_test test::spec::oidc_skip_ci::basic
24+
25+
exit $CARGO_RESULT

src/test/spec.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ mod handshake;
1010
#[cfg(feature = "dns-resolver")]
1111
mod initial_dns_seedlist_discovery;
1212
mod load_balancers;
13-
mod oidc;
13+
#[path = "spec/oidc.rs"]
14+
mod oidc_skip_ci;
1415
mod read_write_concern;
1516
mod retryable_reads;
1617
mod retryable_writes;

0 commit comments

Comments
 (0)