Skip to content

Commit

Permalink
Fix atlas tests
Browse files Browse the repository at this point in the history
  • Loading branch information
comandeo-mongo committed Jun 24, 2024
1 parent cf9bcee commit 8b94f9b
Show file tree
Hide file tree
Showing 5 changed files with 118 additions and 28 deletions.
54 changes: 51 additions & 3 deletions .evergreen/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ functions:
working_dir: "src"
script: |
${PREPARE_SHELL}
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
MONGODB_URI="${MONGODB_URI}" .evergreen/run-tests-atlas.sh
"run serverless tests":
- command: shell.exec
Expand Down Expand Up @@ -527,6 +527,54 @@ task_groups:
- "test-serverless"

- name: testatlas_task_group
setup_group_can_fail_task: true
setup_group_timeout_secs: 1800 # 30 minutes
setup_group:
- func: fetch source
- func: create expansions
- command: shell.exec
params:
shell: "bash"
working_dir: "src"
script: |
${PREPARE_SHELL}
echo "Setting up Atlas cluster"
DRIVERS_ATLAS_PUBLIC_API_KEY="${DRIVERS_ATLAS_PUBLIC_API_KEY}" \
DRIVERS_ATLAS_PRIVATE_API_KEY="${DRIVERS_ATLAS_PRIVATE_API_KEY}" \
DRIVERS_ATLAS_GROUP_ID="${DRIVERS_ATLAS_GROUP_ID}" \
DRIVERS_ATLAS_LAMBDA_USER="${DRIVERS_ATLAS_LAMBDA_USER}" \
DRIVERS_ATLAS_LAMBDA_PASSWORD="${DRIVERS_ATLAS_LAMBDA_PASSWORD}" \
LAMBDA_STACK_NAME="dbx-ruby-lambda" \
MONGODB_VERSION="7.0" \
task_id="${task_id}" \
execution="${execution}" \
$DRIVERS_TOOLS/.evergreen/atlas/setup-atlas-cluster.sh
echo "MONGODB_URI=${MONGODB_URI}"
- command: expansions.update
params:
file: src/atlas-expansion.yml
teardown_group:
- command: shell.exec
params:
shell: "bash"
working_dir: "src"
script: |
${PREPARE_SHELL}
DRIVERS_ATLAS_PUBLIC_API_KEY="${DRIVERS_ATLAS_PUBLIC_API_KEY}" \
DRIVERS_ATLAS_PRIVATE_API_KEY="${DRIVERS_ATLAS_PRIVATE_API_KEY}" \
DRIVERS_ATLAS_GROUP_ID="${DRIVERS_ATLAS_GROUP_ID}" \
LAMBDA_STACK_NAME="dbx-ruby-lambda" \
task_id="${task_id}" \
execution="${execution}" \
$DRIVERS_TOOLS/.evergreen/atlas/teardown-atlas-cluster.sh
tasks:
- test-atlas

- name: testatlas_full_task_group
setup_group_can_fail_task: true
setup_group_timeout_secs: 1800 # 30 minutes
setup_group:
Expand Down Expand Up @@ -1805,15 +1853,15 @@ buildvariants:
os: rhel8
display_name: "Atlas (Full)"
tasks:
- name: testatlas_task_group
- name: testatlas_full_task_group

- matrix_name: "atlas"
matrix_spec:
ruby: ["ruby-3.2", "ruby-3.1", "ruby-3.0", "ruby-2.7", "jruby-9.4", "jruby-9.3"]
os: rhel8
display_name: "Atlas tests ${ruby}"
tasks:
- name: test-atlas
- name: testatlas_task_group

# Commented out, pending RUBY-3414
# - matrix_name: "serverless"
Expand Down
50 changes: 49 additions & 1 deletion .evergreen/config/common.yml.erb
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ functions:
working_dir: "src"
script: |
${PREPARE_SHELL}
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
MONGODB_URI="${MONGODB_URI}" .evergreen/run-tests-atlas.sh

"run serverless tests":
- command: shell.exec
Expand Down Expand Up @@ -524,6 +524,54 @@ task_groups:
- "test-serverless"

- name: testatlas_task_group
setup_group_can_fail_task: true
setup_group_timeout_secs: 1800 # 30 minutes
setup_group:
- func: fetch source
- func: create expansions
- command: shell.exec
params:
shell: "bash"
working_dir: "src"
script: |
${PREPARE_SHELL}

echo "Setting up Atlas cluster"

DRIVERS_ATLAS_PUBLIC_API_KEY="${DRIVERS_ATLAS_PUBLIC_API_KEY}" \
DRIVERS_ATLAS_PRIVATE_API_KEY="${DRIVERS_ATLAS_PRIVATE_API_KEY}" \
DRIVERS_ATLAS_GROUP_ID="${DRIVERS_ATLAS_GROUP_ID}" \
DRIVERS_ATLAS_LAMBDA_USER="${DRIVERS_ATLAS_LAMBDA_USER}" \
DRIVERS_ATLAS_LAMBDA_PASSWORD="${DRIVERS_ATLAS_LAMBDA_PASSWORD}" \
LAMBDA_STACK_NAME="dbx-ruby-lambda" \
MONGODB_VERSION="7.0" \
task_id="${task_id}" \
execution="${execution}" \
$DRIVERS_TOOLS/.evergreen/atlas/setup-atlas-cluster.sh

echo "MONGODB_URI=${MONGODB_URI}"
- command: expansions.update
params:
file: src/atlas-expansion.yml
teardown_group:
- command: shell.exec
params:
shell: "bash"
working_dir: "src"
script: |
${PREPARE_SHELL}

DRIVERS_ATLAS_PUBLIC_API_KEY="${DRIVERS_ATLAS_PUBLIC_API_KEY}" \
DRIVERS_ATLAS_PRIVATE_API_KEY="${DRIVERS_ATLAS_PRIVATE_API_KEY}" \
DRIVERS_ATLAS_GROUP_ID="${DRIVERS_ATLAS_GROUP_ID}" \
LAMBDA_STACK_NAME="dbx-ruby-lambda" \
task_id="${task_id}" \
execution="${execution}" \
$DRIVERS_TOOLS/.evergreen/atlas/teardown-atlas-cluster.sh
tasks:
- test-atlas

- name: testatlas_full_task_group
setup_group_can_fail_task: true
setup_group_timeout_secs: 1800 # 30 minutes
setup_group:
Expand Down
4 changes: 2 additions & 2 deletions .evergreen/config/standard.yml.erb
Original file line number Diff line number Diff line change
Expand Up @@ -498,15 +498,15 @@ buildvariants:
os: rhel8
display_name: "Atlas (Full)"
tasks:
- name: testatlas_task_group
- name: testatlas_full_task_group

- matrix_name: "atlas"
matrix_spec:
ruby: <%= supported_rubies %>
os: rhel8
display_name: "Atlas tests ${ruby}"
tasks:
- name: test-atlas
- name: testatlas_task_group

# Commented out, pending RUBY-3414
# - matrix_name: "serverless"
Expand Down
36 changes: 15 additions & 21 deletions .evergreen/run-tests-atlas.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,21 @@ bundle_install
echo "Running specs"

test_status=0
for uri in ATLAS_REPLICA_SET_URI ATLAS_SHARDED_URI ATLAS_FREE_TIER_URI \
ATLAS_TLS11_URI ATLAS_TLS12_URI ATLAS_SERVERLESS_URI ATLAS_SERVERLESS_LB_URI
do
# ${!foo} syntax is bash specific:
# https://stackoverflow.com/questions/14049057/bash-expand-variable-in-a-variable
export ATLAS_URI="${!uri}"

if test -z "$ATLAS_URI"; then
echo "The \$$uri environment variable was not set" 1>&2
test_status=1
fi

bundle exec rspec spec/atlas -fd
this_test_status=$?
echo "TEST STATUS"
echo ${this_test_status}

if test $this_test_status != 0; then
test_status=$this_test_status
fi
done
export ATLAS_URI=$MONGODB_URI

if test -z "$ATLAS_URI"; then
echo "The \$$uri environment variable was not set" 1>&2
test_status=1
fi

bundle exec rspec spec/atlas -fd
this_test_status=$?
echo "TEST STATUS"
echo ${this_test_status}

if test $this_test_status != 0; then
test_status=$this_test_status
fi

kill_jruby

Expand Down
2 changes: 1 addition & 1 deletion .mod/drivers-evergreen-tools

0 comments on commit 8b94f9b

Please sign in to comment.