Skip to content

Commit e465058

Browse files
docs: add documentation for running aws integ tests locally (#4830)
Co-authored-by: Bailey Pearson <bailey.pearson@gmail.com>
1 parent cfb0bbd commit e465058

File tree

2 files changed

+63
-0
lines changed

2 files changed

+63
-0
lines changed

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,7 @@ source .evergreen/setup-mongodb-aws-auth-tests.sh
99
# load node.js environment
1010
source $DRIVERS_TOOLS/.evergreen/init-node-and-npm-env.sh
1111

12+
# clear AWS_PROFILE, so it doesn't interfere with env-creds
13+
unset AWS_PROFILE
14+
1215
npm run check:aws

test/readme.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ about the types of tests and how to run them.
2727
- [Running Benchmarks](#running-benchmarks)
2828
- [Configuration](#configuration)
2929
- [Secrets](#secrets)
30+
- [CSFLE](#csfle)
31+
- [AWS Profile](#aws-profile)
3032
- [Testing with Special Environments](#testing-with-special-environments)
3133
- [Load Balanced](#load-balanced)
3234
- [Client-Side Field-Level Encryption (CSFLE)](#client-side-field-level-encryption-csfle)
@@ -39,6 +41,7 @@ about the types of tests and how to run them.
3941
- [Deployed Lambda Tests](#deployed-lambda-tests)
4042
- [Kerberos Tests](#kerberos-tests)
4143
- [AWS Authentication tests](#aws-authentication-tests)
44+
- [Running AWS tests](#running-aws-tests)
4245
- [Container Tests](#container-tests)
4346
- [GCP](#gcp)
4447
- [Azure](#azure)
@@ -368,6 +371,8 @@ Local use of secrets manager requires:
368371

369372
(see instructions in the secrets handling readme).
370373

374+
### CSFLE
375+
371376
Here's an example usage of the tooling in drivers-evergreen-tools that configures credentials for CSFLE:
372377

373378
```bash
@@ -382,6 +387,33 @@ source secrets-export.sh
382387
> [!IMPORTANT]
383388
> Make sure `secrets-export.sh` is in the .gitignore of any Github repo you might be using these tools in to avoid leaking credentials. This is already done for this repo.
384389
390+
### AWS Profile
391+
392+
These instructions will help you locally configure profile-based AWS credentials.
393+
394+
Setup an AWS_PROFILE locally to be able to use AWS and to run AWS tests locally.
395+
396+
1. Get SSO sign-in info from AWS
397+
1. Navigate to https://corp.mongodb.com/app/UserHome
398+
2. Open AWS
399+
3. Choose `Drivers` account
400+
4. Choose `drivers-test-secrets-role`
401+
5. Click `Access Keys`
402+
6. Copy down `SSO start URL` and `SSO Region`
403+
2. Sign in locally
404+
1. Run `aws configure sso-session`
405+
2. Pick a name, like `drivers-test-secrets-session`
406+
3. Specify `SSO start URL` and `SSO Region` from earlier steps
407+
3. Add a profile
408+
1. Add the following profile to `~/.aws/config`
409+
410+
```ini
411+
[profile drivers-test-secrets-role-857654397073]
412+
sso_session = drivers-test-secrets-session
413+
sso_account_id = 857654397073
414+
sso_role_name = drivers-test-secrets-role
415+
```
416+
385417
## Testing with Special Environments
386418

387419
In order to test some features, you will need to generate and set a specialized group of environment variables. The subsections below will walk you through how to generate and set the environment variables for these features.
@@ -647,6 +679,34 @@ Choose your AWS authentication credential type and export the `AWS_CREDENTIAL_TY
647679

648680
1. Run the `bash .evergreen/run-mongodb-aws-tests.sh`.
649681

682+
An example of performing the above is [`etc/run-aws-integ-tests.sh`](etc/run-aws-integ-tests.sh).
683+
684+
#### Running AWS tests
685+
686+
Once you have the AWS Profile configured locally (see section "AWS Profile" for more info), you can run tests like this:
687+
688+
```sh
689+
export AWS_CREDENTIAL_TYPE="session-creds" # session-creds || env-creds
690+
export VERSION="latest"
691+
export NODE_LTS_VERSION="24"
692+
export AUTH="auth"
693+
export ORCHESTRATION_FILE="auth-aws.json"
694+
export TOPOLOGY="server"
695+
export NODE_DRIVER="$DRIVERS_TOOLS/.."
696+
export AWS_PROFILE="drivers-test-secrets-role-857654397073"
697+
698+
# Login with AWS Profile
699+
aws sso login --sso-session drivers-test-secrets-session
700+
701+
# Install dependencies
702+
bash ${NODE_DRIVER}/.evergreen/install-dependencies.sh
703+
704+
# Orchestration
705+
bash ${NODE_DRIVER}/.evergreen/run-orchestration.sh
706+
707+
bash ${NODE_DRIVER}/.evergreen/run-mongodb-aws-test.sh
708+
```
709+
650710
### Container Tests
651711

652712
It may become required to run tests or debug code inside a live Azure or GCP container. The best way to do this is to leverage

0 commit comments

Comments
 (0)