Skip to content

Commit adc54be

Browse files
Merge branch 'main' into COMPASS-8451
2 parents 35ca69b + 7f1fec5 commit adc54be

File tree

157 files changed

+4499
-3931
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

157 files changed

+4499
-3931
lines changed

.evergreen/functions.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -685,8 +685,6 @@ functions:
685685
DEBUG: ${debug|}
686686
COMPASS_E2E_ATLAS_CLOUD_SANDBOX_USERNAME: ${e2e_tests_compass_web_atlas_username}
687687
COMPASS_E2E_ATLAS_CLOUD_SANDBOX_PASSWORD: ${e2e_tests_compass_web_atlas_password}
688-
COMPASS_E2E_ATLAS_CLOUD_SANDBOX_DBUSER_USERNAME: ${e2e_tests_compass_web_atlas_db_username}
689-
COMPASS_E2E_ATLAS_CLOUD_SANDBOX_DBUSER_PASSWORD: ${e2e_tests_compass_web_atlas_password}
690688
MCLI_PUBLIC_API_KEY: ${e2e_tests_mcli_public_api_key}
691689
MCLI_PRIVATE_API_KEY: ${e2e_tests_mcli_private_api_key}
692690
MCLI_ORG_ID: ${e2e_tests_mcli_org_id}

.evergreen/start-atlas-cloud-cluster.sh

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
#!/bin/bash
22

3+
RUN_ID="$(date +"%s")-$(git rev-parse --short HEAD)"
4+
DELETE_AFTER="$(date -u -Iseconds -d '+2 hours' 2>/dev/null || date -u -Iseconds -v '+2H')"
5+
36
# This script helps to automatically provision Atlas cluster for running the e2e
47
# tests against. In CI this will always create a new cluster and delete it when
58
# the test run is finished. You can also use this script locally to run e2e
@@ -16,8 +19,8 @@
1619
#
1720
# - Setup a new org and project. Save the org id and project id for later.
1821
#
19-
# - Create new db user with username / password auth and admin role. This user
20-
# will be used to prepopulate dbs with data in tests. Save the credentials.
22+
# - Add test payment details within the organization (Billing) to be able to
23+
# create clusters.
2124
#
2225
# - Create a new API key (Access Manager > Project Access > Create Application >
2326
# API Key) for the project you created and save the public and private keys.
@@ -38,8 +41,6 @@
3841
#
3942
# COMPASS_E2E_ATLAS_CLOUD_SANDBOX_USERNAME Cloud user you created
4043
# COMPASS_E2E_ATLAS_CLOUD_SANDBOX_PASSWORD Cloud user password
41-
# COMPASS_E2E_ATLAS_CLOUD_SANDBOX_DBUSER_USERNAME Db user for the project
42-
# COMPASS_E2E_ATLAS_CLOUD_SANDBOX_DBUSER_PASSWORD Db user password
4344
#
4445
# - Source the script followed by running the tests to make sure that some
4546
# variables exported from this script are available for the test env:
@@ -53,10 +54,13 @@ _ATLAS_CLOUD_TEST_CLUSTER_NAME=${ATLAS_CLOUD_TEST_CLUSTER_NAME:-""}
5354
# truncate if it's too long) so we're very limited in terms of how unique this
5455
# name can be. Hopefully the epoch + part of git hash is enough for these to not
5556
# overlap when tests are running
56-
DEFAULT_ATLAS_CLOUD_TEST_CLUSTER_NAME="e2e-$(date +"%s")-$(git rev-parse HEAD)"
57+
DEFAULT_ATLAS_CLOUD_TEST_CLUSTER_NAME="e2e-$RUN_ID"
5758

5859
ATLAS_CLUSTER_NAME="${_ATLAS_CLOUD_TEST_CLUSTER_NAME:-$DEFAULT_ATLAS_CLOUD_TEST_CLUSTER_NAME}"
5960

61+
ATLAS_TEST_DB_USERNAME="testuser-$RUN_ID"
62+
ATLAS_TEST_DB_PASSWORD="$(head -c 32 /dev/urandom | base64 | tr -dc 'a-zA-Z0-9')"
63+
6064
function atlascli() {
6165
docker run \
6266
-e MCLI_PUBLIC_API_KEY \
@@ -79,15 +83,32 @@ cleanup() {
7983
else
8084
echo "Custom cluster name provided ($_ATLAS_CLOUD_TEST_CLUSTER_NAME), skipping cluster cleanup"
8185
fi
86+
echo "Deleting Atlas db user \`$ATLAS_TEST_DB_USERNAME\`..."
87+
atlascli dbusers delete $ATLAS_TEST_DB_USERNAME --force
8288
}
8389

8490
trap cleanup EXIT
8591

92+
echo "Allowing access from current ip..."
93+
atlascli accessList create \
94+
--currentIp \
95+
--deleteAfter "$DELETE_AFTER"
96+
97+
echo "Creating Atlas db user \`$ATLAS_TEST_DB_USERNAME\`..."
98+
atlascli dbusers create atlasAdmin \
99+
--username "$ATLAS_TEST_DB_USERNAME" \
100+
--password "$ATLAS_TEST_DB_PASSWORD" \
101+
--deleteAfter "$DELETE_AFTER" # so that it's autoremoved if cleaning up failed for some reason
102+
103+
export COMPASS_E2E_ATLAS_CLOUD_SANDBOX_DBUSER_USERNAME="$ATLAS_TEST_DB_USERNAME"
104+
export COMPASS_E2E_ATLAS_CLOUD_SANDBOX_DBUSER_PASSWORD="$ATLAS_TEST_DB_PASSWORD"
105+
86106
echo "Creating Atlas deployment \`$ATLAS_CLUSTER_NAME\` to test against..."
87-
atlascli clusters create $ATLAS_CLUSTER_NAME \
107+
(atlascli clusters create $ATLAS_CLUSTER_NAME \
88108
--provider AWS \
89109
--region US_EAST_1 \
90-
--tier M10
110+
--tier M10 \
111+
--type GEOSHARDED || true) # can error if custom name was provided, will fail on next step if it's not expected failure
91112

92113
echo "Waiting for the deployment to be provisioned..."
93114
atlascli clusters watch $ATLAS_CLUSTER_NAME

.github/workflows/check-pr-title.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@ jobs:
1919
# Skip the JIRA ticket check for PRs opened by bots
2020
if: ${{ !contains(github.event.pull_request.user.login, '[bot]') }}
2121
with:
22-
regex: '[A-Z]{4,10}-[0-9]{1,5}$'
22+
regex: '[A-Z]{4,10}-[0-9]{1,10}$'
2323
error-hint: 'Invalid PR title. Make sure it ends with a JIRA ticket - i.e. COMPASS-1234 or add the no-title-validation label'
2424
ignore-labels: 'no-title-validation'

AUTHORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,3 +94,4 @@ Kræn Hansen <[email protected]>
9494
Ruchitha Rajaghatta <[email protected]>
9595
9696
Nikola Irinchev <[email protected]>
97+
djechlin-mongodb <[email protected]>

0 commit comments

Comments
 (0)