Skip to content

Commit 8b94f9b

Browse files
Fix atlas tests
1 parent cf9bcee commit 8b94f9b

File tree

5 files changed

+118
-28
lines changed

5 files changed

+118
-28
lines changed

.evergreen/config.yml

Lines changed: 51 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ functions:
434434
working_dir: "src"
435435
script: |
436436
${PREPARE_SHELL}
437-
AUTH=${AUTH} SSL=${SSL} TOPOLOGY=${TOPOLOGY} RVM_RUBY="${RVM_RUBY}" ATLAS_REPLICA_SET_URI=${atlas_replica_set_uri} ATLAS_SHARDED_URI=${atlas_sharded_uri} ATLAS_FREE_TIER_URI=${atlas_free_tier_uri} ATLAS_TLS11_URI=${atlas_tls11_uri} ATLAS_TLS12_URI=${atlas_tls12_uri} ATLAS_SERVERLESS_URI=${atlas_serverless_uri} ATLAS_SERVERLESS_LB_URI=${atlas_serverless_lb_uri} .evergreen/run-tests-atlas.sh
437+
MONGODB_URI="${MONGODB_URI}" .evergreen/run-tests-atlas.sh
438438
439439
"run serverless tests":
440440
- command: shell.exec
@@ -527,6 +527,54 @@ task_groups:
527527
- "test-serverless"
528528

529529
- name: testatlas_task_group
530+
setup_group_can_fail_task: true
531+
setup_group_timeout_secs: 1800 # 30 minutes
532+
setup_group:
533+
- func: fetch source
534+
- func: create expansions
535+
- command: shell.exec
536+
params:
537+
shell: "bash"
538+
working_dir: "src"
539+
script: |
540+
${PREPARE_SHELL}
541+
542+
echo "Setting up Atlas cluster"
543+
544+
DRIVERS_ATLAS_PUBLIC_API_KEY="${DRIVERS_ATLAS_PUBLIC_API_KEY}" \
545+
DRIVERS_ATLAS_PRIVATE_API_KEY="${DRIVERS_ATLAS_PRIVATE_API_KEY}" \
546+
DRIVERS_ATLAS_GROUP_ID="${DRIVERS_ATLAS_GROUP_ID}" \
547+
DRIVERS_ATLAS_LAMBDA_USER="${DRIVERS_ATLAS_LAMBDA_USER}" \
548+
DRIVERS_ATLAS_LAMBDA_PASSWORD="${DRIVERS_ATLAS_LAMBDA_PASSWORD}" \
549+
LAMBDA_STACK_NAME="dbx-ruby-lambda" \
550+
MONGODB_VERSION="7.0" \
551+
task_id="${task_id}" \
552+
execution="${execution}" \
553+
$DRIVERS_TOOLS/.evergreen/atlas/setup-atlas-cluster.sh
554+
555+
echo "MONGODB_URI=${MONGODB_URI}"
556+
- command: expansions.update
557+
params:
558+
file: src/atlas-expansion.yml
559+
teardown_group:
560+
- command: shell.exec
561+
params:
562+
shell: "bash"
563+
working_dir: "src"
564+
script: |
565+
${PREPARE_SHELL}
566+
567+
DRIVERS_ATLAS_PUBLIC_API_KEY="${DRIVERS_ATLAS_PUBLIC_API_KEY}" \
568+
DRIVERS_ATLAS_PRIVATE_API_KEY="${DRIVERS_ATLAS_PRIVATE_API_KEY}" \
569+
DRIVERS_ATLAS_GROUP_ID="${DRIVERS_ATLAS_GROUP_ID}" \
570+
LAMBDA_STACK_NAME="dbx-ruby-lambda" \
571+
task_id="${task_id}" \
572+
execution="${execution}" \
573+
$DRIVERS_TOOLS/.evergreen/atlas/teardown-atlas-cluster.sh
574+
tasks:
575+
- test-atlas
576+
577+
- name: testatlas_full_task_group
530578
setup_group_can_fail_task: true
531579
setup_group_timeout_secs: 1800 # 30 minutes
532580
setup_group:
@@ -1805,15 +1853,15 @@ buildvariants:
18051853
os: rhel8
18061854
display_name: "Atlas (Full)"
18071855
tasks:
1808-
- name: testatlas_task_group
1856+
- name: testatlas_full_task_group
18091857

18101858
- matrix_name: "atlas"
18111859
matrix_spec:
18121860
ruby: ["ruby-3.2", "ruby-3.1", "ruby-3.0", "ruby-2.7", "jruby-9.4", "jruby-9.3"]
18131861
os: rhel8
18141862
display_name: "Atlas tests ${ruby}"
18151863
tasks:
1816-
- name: test-atlas
1864+
- name: testatlas_task_group
18171865

18181866
# Commented out, pending RUBY-3414
18191867
# - matrix_name: "serverless"

.evergreen/config/common.yml.erb

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@ functions:
431431
working_dir: "src"
432432
script: |
433433
${PREPARE_SHELL}
434-
AUTH=${AUTH} SSL=${SSL} TOPOLOGY=${TOPOLOGY} RVM_RUBY="${RVM_RUBY}" ATLAS_REPLICA_SET_URI=${atlas_replica_set_uri} ATLAS_SHARDED_URI=${atlas_sharded_uri} ATLAS_FREE_TIER_URI=${atlas_free_tier_uri} ATLAS_TLS11_URI=${atlas_tls11_uri} ATLAS_TLS12_URI=${atlas_tls12_uri} ATLAS_SERVERLESS_URI=${atlas_serverless_uri} ATLAS_SERVERLESS_LB_URI=${atlas_serverless_lb_uri} .evergreen/run-tests-atlas.sh
434+
MONGODB_URI="${MONGODB_URI}" .evergreen/run-tests-atlas.sh
435435

436436
"run serverless tests":
437437
- command: shell.exec
@@ -524,6 +524,54 @@ task_groups:
524524
- "test-serverless"
525525

526526
- name: testatlas_task_group
527+
setup_group_can_fail_task: true
528+
setup_group_timeout_secs: 1800 # 30 minutes
529+
setup_group:
530+
- func: fetch source
531+
- func: create expansions
532+
- command: shell.exec
533+
params:
534+
shell: "bash"
535+
working_dir: "src"
536+
script: |
537+
${PREPARE_SHELL}
538+
539+
echo "Setting up Atlas cluster"
540+
541+
DRIVERS_ATLAS_PUBLIC_API_KEY="${DRIVERS_ATLAS_PUBLIC_API_KEY}" \
542+
DRIVERS_ATLAS_PRIVATE_API_KEY="${DRIVERS_ATLAS_PRIVATE_API_KEY}" \
543+
DRIVERS_ATLAS_GROUP_ID="${DRIVERS_ATLAS_GROUP_ID}" \
544+
DRIVERS_ATLAS_LAMBDA_USER="${DRIVERS_ATLAS_LAMBDA_USER}" \
545+
DRIVERS_ATLAS_LAMBDA_PASSWORD="${DRIVERS_ATLAS_LAMBDA_PASSWORD}" \
546+
LAMBDA_STACK_NAME="dbx-ruby-lambda" \
547+
MONGODB_VERSION="7.0" \
548+
task_id="${task_id}" \
549+
execution="${execution}" \
550+
$DRIVERS_TOOLS/.evergreen/atlas/setup-atlas-cluster.sh
551+
552+
echo "MONGODB_URI=${MONGODB_URI}"
553+
- command: expansions.update
554+
params:
555+
file: src/atlas-expansion.yml
556+
teardown_group:
557+
- command: shell.exec
558+
params:
559+
shell: "bash"
560+
working_dir: "src"
561+
script: |
562+
${PREPARE_SHELL}
563+
564+
DRIVERS_ATLAS_PUBLIC_API_KEY="${DRIVERS_ATLAS_PUBLIC_API_KEY}" \
565+
DRIVERS_ATLAS_PRIVATE_API_KEY="${DRIVERS_ATLAS_PRIVATE_API_KEY}" \
566+
DRIVERS_ATLAS_GROUP_ID="${DRIVERS_ATLAS_GROUP_ID}" \
567+
LAMBDA_STACK_NAME="dbx-ruby-lambda" \
568+
task_id="${task_id}" \
569+
execution="${execution}" \
570+
$DRIVERS_TOOLS/.evergreen/atlas/teardown-atlas-cluster.sh
571+
tasks:
572+
- test-atlas
573+
574+
- name: testatlas_full_task_group
527575
setup_group_can_fail_task: true
528576
setup_group_timeout_secs: 1800 # 30 minutes
529577
setup_group:

.evergreen/config/standard.yml.erb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -498,15 +498,15 @@ buildvariants:
498498
os: rhel8
499499
display_name: "Atlas (Full)"
500500
tasks:
501-
- name: testatlas_task_group
501+
- name: testatlas_full_task_group
502502

503503
- matrix_name: "atlas"
504504
matrix_spec:
505505
ruby: <%= supported_rubies %>
506506
os: rhel8
507507
display_name: "Atlas tests ${ruby}"
508508
tasks:
509-
- name: test-atlas
509+
- name: testatlas_task_group
510510

511511
# Commented out, pending RUBY-3414
512512
# - matrix_name: "serverless"

.evergreen/run-tests-atlas.sh

Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -15,27 +15,21 @@ bundle_install
1515
echo "Running specs"
1616

1717
test_status=0
18-
for uri in ATLAS_REPLICA_SET_URI ATLAS_SHARDED_URI ATLAS_FREE_TIER_URI \
19-
ATLAS_TLS11_URI ATLAS_TLS12_URI ATLAS_SERVERLESS_URI ATLAS_SERVERLESS_LB_URI
20-
do
21-
# ${!foo} syntax is bash specific:
22-
# https://stackoverflow.com/questions/14049057/bash-expand-variable-in-a-variable
23-
export ATLAS_URI="${!uri}"
24-
25-
if test -z "$ATLAS_URI"; then
26-
echo "The \$$uri environment variable was not set" 1>&2
27-
test_status=1
28-
fi
29-
30-
bundle exec rspec spec/atlas -fd
31-
this_test_status=$?
32-
echo "TEST STATUS"
33-
echo ${this_test_status}
34-
35-
if test $this_test_status != 0; then
36-
test_status=$this_test_status
37-
fi
38-
done
18+
export ATLAS_URI=$MONGODB_URI
19+
20+
if test -z "$ATLAS_URI"; then
21+
echo "The \$$uri environment variable was not set" 1>&2
22+
test_status=1
23+
fi
24+
25+
bundle exec rspec spec/atlas -fd
26+
this_test_status=$?
27+
echo "TEST STATUS"
28+
echo ${this_test_status}
29+
30+
if test $this_test_status != 0; then
31+
test_status=$this_test_status
32+
fi
3933

4034
kill_jruby
4135

.mod/drivers-evergreen-tools

0 commit comments

Comments
 (0)