Skip to content

Commit d08480b

Browse files
ci(NODE-6686): deployed Atlas cluster tests use secrets manager (#4384)
Co-authored-by: Durran Jordan <[email protected]>
1 parent d1b2453 commit d08480b

File tree

3 files changed

+77
-49
lines changed

3 files changed

+77
-49
lines changed

.evergreen/config.in.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -1602,11 +1602,13 @@ task_groups:
16021602
params:
16031603
working_dir: src
16041604
binary: bash
1605-
add_expansions_to_env: true
16061605
env:
16071606
MONGODB_VERSION: "7.0"
1607+
LAMBDA_STACK_NAME: dbx-node-lambda
1608+
CLUSTER_PREFIX: dbx-node-lambda
16081609
args:
16091610
- ${DRIVERS_TOOLS}/.evergreen/atlas/setup-atlas-cluster.sh
1611+
- atlas
16101612
- command: expansions.update
16111613
params:
16121614
file: src/atlas-expansion.yml
@@ -1615,7 +1617,6 @@ task_groups:
16151617
params:
16161618
working_dir: src
16171619
binary: bash
1618-
add_expansions_to_env: true
16191620
args:
16201621
- ${DRIVERS_TOOLS}/.evergreen/atlas/teardown-atlas-cluster.sh
16211622
setup_group_can_fail_task: true
@@ -1630,9 +1631,9 @@ task_groups:
16301631
params:
16311632
working_dir: src
16321633
binary: bash
1633-
add_expansions_to_env: true
16341634
env:
16351635
MONGODB_VERSION: "7.0"
1636+
CLUSTER_PREFIX: dbx-node-search-indexes
16361637
args:
16371638
- ${DRIVERS_TOOLS}/.evergreen/atlas/setup-atlas-cluster.sh
16381639
- command: expansions.update
@@ -1643,7 +1644,6 @@ task_groups:
16431644
params:
16441645
working_dir: src
16451646
binary: bash
1646-
add_expansions_to_env: true
16471647
args:
16481648
- ${DRIVERS_TOOLS}/.evergreen/atlas/teardown-atlas-cluster.sh
16491649
setup_group_can_fail_task: true

.evergreen/config.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -4623,11 +4623,13 @@ task_groups:
46234623
params:
46244624
working_dir: src
46254625
binary: bash
4626-
add_expansions_to_env: true
46274626
env:
46284627
MONGODB_VERSION: '7.0'
4628+
LAMBDA_STACK_NAME: dbx-node-lambda
4629+
CLUSTER_PREFIX: dbx-node-lambda
46294630
args:
46304631
- ${DRIVERS_TOOLS}/.evergreen/atlas/setup-atlas-cluster.sh
4632+
- atlas
46314633
- command: expansions.update
46324634
params:
46334635
file: src/atlas-expansion.yml
@@ -4636,7 +4638,6 @@ task_groups:
46364638
params:
46374639
working_dir: src
46384640
binary: bash
4639-
add_expansions_to_env: true
46404641
args:
46414642
- ${DRIVERS_TOOLS}/.evergreen/atlas/teardown-atlas-cluster.sh
46424643
setup_group_can_fail_task: true
@@ -4650,9 +4651,9 @@ task_groups:
46504651
params:
46514652
working_dir: src
46524653
binary: bash
4653-
add_expansions_to_env: true
46544654
env:
46554655
MONGODB_VERSION: '7.0'
4656+
CLUSTER_PREFIX: dbx-node-search-indexes
46564657
args:
46574658
- ${DRIVERS_TOOLS}/.evergreen/atlas/setup-atlas-cluster.sh
46584659
- command: expansions.update
@@ -4663,7 +4664,6 @@ task_groups:
46634664
params:
46644665
working_dir: src
46654666
binary: bash
4666-
add_expansions_to_env: true
46674667
args:
46684668
- ${DRIVERS_TOOLS}/.evergreen/atlas/teardown-atlas-cluster.sh
46694669
setup_group_can_fail_task: true

test/readme.md

+69-41
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,23 @@ about the types of tests and how to run them.
2626
- [Skipping Tests](#skipping-tests)
2727
- [Running Benchmarks](#running-benchmarks)
2828
- [Configuration](#configuration)
29+
- [Secrets](#secrets)
2930
- [Testing with Special Environments](#testing-with-special-environments)
3031
- [Serverless](#serverless)
3132
- [Load Balanced](#load-balanced)
3233
- [Client-Side Field-Level Encryption (CSFLE)](#client-side-field-level-encryption-csfle)
33-
- [Testing driver changes with mongosh](#testing-driver-changes-with-mongosh)
34-
- [Point mongosh to the driver](#point-mongosh-to-the-driver)
35-
- [Run specific package tests](#run-specific-package-tests)
3634
- [KMIP FLE support tests](#kmip-fle-support-tests)
3735
- [Deployed KMS Tests](#deployed-kms-tests)
3836
- [Azure KMS](#azure-kms)
3937
- [GCP KMS](#gcp-kms)
38+
- [Deployed Atlas Tests](#deployed-atlas-tests)
39+
- [Launching an Atlas Cluster](#launching-an-atlas-cluster)
40+
- [Search Indexes](#search-indexes)
41+
- [Deployed Lambda Tests](#deployed-lambda-tests)
4042
- [TODO Special Env Sections](#todo-special-env-sections)
43+
- [Testing driver changes with mongosh](#testing-driver-changes-with-mongosh)
44+
- [Point mongosh to the driver](#point-mongosh-to-the-driver)
45+
- [Run specific package tests](#run-specific-package-tests)
4146

4247
## About the Tests
4348

@@ -594,44 +599,6 @@ The following steps will walk you through how to run the tests for CSFLE.
594599
595600
To run the functional tests using the crypt shared library instead of `mongocryptd`, download the appropriate version of the crypt shared library for the enterprise server version [here](https://www.mongodb.com/download-center/enterprise/releases) and then set the location of it in the environment variable `CRYPT_SHARED_LIB_PATH`.
596601
597-
#### Testing driver changes with mongosh
598-
599-
These steps require `mongosh` to be available locally. Clone it from GitHub.
600-
601-
`mongosh` uses a `lerna` monorepo. As a result, `mongosh` contains multiple references to the `mongodb` package
602-
in their `package.json`s.
603-
604-
Set up `mongosh` by following the steps in the `mongosh` readme.
605-
606-
##### Point mongosh to the driver
607-
608-
mongosh contains a script that does this. To use the script, create an environment
609-
variable `REPLACE_PACKAGE` that contains a string in the form
610-
`mongodb:<path to your local instance of the driver>`. The package replacement script will replace
611-
all occurrences of `mongodb` with the local path of your driver.
612-
613-
An alternative, which can be useful for
614-
testing a release, is to first run `npm pack` on the driver. This generates a tarball containing all the code
615-
that would be uploaded to `npm` if it were released. Then, set the environment variable `REPLACE_PACKAGE`
616-
with the full path to the file.
617-
618-
Once the environment variable is set, run replace package in `mongosh` with:
619-
```sh
620-
npm run replace:package
621-
```
622-
623-
##### Run specific package tests
624-
625-
`mongosh`'s readme documents how to run its tests. Most likely, it isn't necessary to run all of mongosh's
626-
tests. The `mongosh` readme also documents how to run tests for a particular scope. The scopes are
627-
listed in the `generate_mongosh_tasks.js` evergreen generation script.
628-
629-
For example, to run the `service-provider-server` package, run the following command in `mongosh`:
630-
631-
```shell
632-
lerna run test --scope @mongosh/service-provider-server
633-
```
634-
635602
#### KMIP FLE support tests
636603
637604
1. Install `virtualenv`:
@@ -729,6 +696,29 @@ source $DRIVERS_TOOLS/.evergreen/init-node-and-npm-env.sh
729696
bash .evergreen/run-deployed-gcp-kms-tests.sh
730697
```
731698
699+
700+
### Deployed Atlas Tests
701+
702+
#### Launching an Atlas Cluster
703+
704+
Using drivers evergreen tools, run the `setup-atlas-cluster` script. You must also set the CLUSTER_PREFIX environment variable.
705+
706+
```bash
707+
CLUSTER_PREFIX=dbx-node-lambda bash ${DRIVERS_TOOLS}/.evergreen/atlas/setup-atlas-cluster.sh
708+
```
709+
710+
The URI of the cluster is available in the `atlas-expansions.yml` file.
711+
712+
#### Search Indexes
713+
714+
1. Set up an Atlas cluster, as outlined in the "Launching an Atlas Cluster" section.
715+
2. Add the URI of the cluster to the environment as the MONGODB_URI environment variable.
716+
3. Run the tests with `npm run check:search-indexes`.
717+
718+
#### Deployed Lambda Tests
719+
720+
TODO(NODE-6698): Update deployed lambda test section.
721+
732722
### TODO Special Env Sections
733723
734724
- Kerberos
@@ -755,3 +745,41 @@ bash .evergreen/run-deployed-gcp-kms-tests.sh
755745
[npm-csfle]: https://www.npmjs.com/package/mongodb-client-encryption
756746
[atlas-api-key]: https://docs.atlas.mongodb.com/tutorial/configure-api-access/organization/create-one-api-key
757747
[scram-auth]: https://docs.atlas.mongodb.com/security-add-mongodb-users/#database-user-authentication
748+
749+
## Testing driver changes with mongosh
750+
751+
These steps require `mongosh` to be available locally. Clone it from GitHub.
752+
753+
`mongosh` uses a `lerna` monorepo. As a result, `mongosh` contains multiple references to the `mongodb` package
754+
in their `package.json`s.
755+
756+
Set up `mongosh` by following the steps in the `mongosh` readme.
757+
758+
### Point mongosh to the driver
759+
760+
mongosh contains a script that does this. To use the script, create an environment
761+
variable `REPLACE_PACKAGE` that contains a string in the form
762+
`mongodb:<path to your local instance of the driver>`. The package replacement script will replace
763+
all occurrences of `mongodb` with the local path of your driver.
764+
765+
An alternative, which can be useful for
766+
testing a release, is to first run `npm pack` on the driver. This generates a tarball containing all the code
767+
that would be uploaded to `npm` if it were released. Then, set the environment variable `REPLACE_PACKAGE`
768+
with the full path to the file.
769+
770+
Once the environment variable is set, run replace package in `mongosh` with:
771+
```sh
772+
npm run replace:package
773+
```
774+
775+
### Run specific package tests
776+
777+
`mongosh`'s readme documents how to run its tests. Most likely, it isn't necessary to run all of mongosh's
778+
tests. The `mongosh` readme also documents how to run tests for a particular scope. The scopes are
779+
listed in the `generate_mongosh_tasks.js` evergreen generation script.
780+
781+
For example, to run the `service-provider-server` package, run the following command in `mongosh`:
782+
783+
```shell
784+
lerna run test --scope @mongosh/service-provider-server
785+
```

0 commit comments

Comments
 (0)