Skip to content

Commit 06ffdea

Browse files
comments addressed
readd dependency readd dependency lint readd dependency readd dependency fix dep fix dep2 fix dep2 fix dep3 fix dep4 fix dep5 fix dep6
1 parent 464107c commit 06ffdea

5 files changed

+57
-62
lines changed

.github/workflows/encryption-tests.yml

+2
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,7 @@ jobs:
3131
node-version: latest
3232
- name: Install Dependencies
3333
run: npm install
34+
- name: Install mongodb-client-encryption
35+
run: npm install mongodb-client-encryption
3436
- name: Run Tests
3537
run: npm run test-encryption

CONTRIBUTING.md

+7-2
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,13 @@ If you have a question about Mongoose (not a bug report) please post it to eithe
4646
* execute `npm run test-tsd` to run the typescript tests
4747
* execute `npm run ts-benchmark` to run the typescript benchmark "performance test" for a single time.
4848
* execute `npm run ts-benchmark-watch` to run the typescript benchmark "performance test" while watching changes on types folder. Note: Make sure to commit all changes before executing this command.
49-
* in order to run tests that require an cluster with encryption locally, run `npm run test-encryption`. Alternatively, you can start an encrypted cluster using the `scripts/configure-cluster-with-encryption.sh` file.
50-
* These scripts can take a few minutes to run. If a encryption script is exited prematurely, restart the shell and delete the `data/` directory to ensure clean-up.
49+
* in order to run tests that require an cluster with encryption locally, run `npm run test-encryption`/ Alternatively, you can start an encrypted cluster using the `scripts/configure-cluster-with-encryption.sh` file.
50+
* These scripts can take a few minutes to run.
51+
* To change an encryption configuration, it is recommended to follow these steps:
52+
* Edit the variables in `scripts/configure-cluster-with-encryption.sh` with your desired configuration.
53+
* Restart your shell.
54+
* Delete the `data/` directory if it exists.
55+
* Finally, run the configuration script.
5156

5257
## Documentation
5358

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@
104104
"test-deno": "deno run --allow-env --allow-read --allow-net --allow-run --allow-sys --allow-write ./test/deno.js",
105105
"test-rs": "START_REPLICA_SET=1 mocha --timeout 30000 --exit ./test/*.test.js",
106106
"test-tsd": "node ./test/types/check-types-filename && tsd",
107-
"test-encryption": "bash scripts/run-encryption-tests.sh",
107+
"test-encryption": "bash scripts/configure-cluster-with-encryption.sh && mocha --exit ./test/encryption/*.test.js && npm uninstall mongodb-client-encryption > /dev/null",
108108
"tdd": "mocha ./test/*.test.js --inspect --watch --recursive --watch-files ./**/*.{js,ts}",
109109
"test-coverage": "nyc --reporter=html --reporter=text npm test",
110110
"ts-benchmark": "cd ./benchmarks/typescript/simple && npm install && npm run benchmark | node ../../../scripts/tsc-diagnostics-check"

scripts/configure-cluster-with-encryption.sh

+47-36
Original file line numberDiff line numberDiff line change
@@ -5,39 +5,50 @@
55
# this script downloads all tools required to use FLE with mongodb, then starts a cluster of the provided configuration (sharded on 8.0 server)
66

77
export CWD=$(pwd);
8-
mkdir data
9-
cd data
10-
11-
# install encryption dependency
12-
npm install mongodb-client-encryption > /dev/null
13-
14-
# note:
15-
# we're using drivers-evergreen-tools which is a repo used by MongoDB drivers to start clusters for testing.
16-
# if you'd like to make changes to the cluster settings, edit the exported variables below.
17-
# for configuration options for the exported variables, see here: https://github.com/mongodb-labs/drivers-evergreen-tools/blob/master/.evergreen/run-orchestration.sh
18-
# after this script is run, the data/ folder will notably contain the following:
19-
# 'mo-expansion.yml' file which contains for your cluster URI and crypt shared library path
20-
# 'drivers-evergreen-tools/mongodb/bin' which contain executables for other mongodb libraries such as mongocryptd, mongosh, and mongod
21-
if [ ! -d "drivers-evergreen-tools/" ]; then
22-
git clone --depth=1 "https://github.com/mongodb-labs/drivers-evergreen-tools.git"
23-
fi
24-
25-
# configure cluster settings
26-
export DRIVERS_TOOLS=$CWD/data/drivers-evergreen-tools
27-
export MONGODB_VERSION=8.0
28-
export AUTH=true
29-
export MONGODB_BINARIES=$DRIVERS_TOOLS/mongodb/bin
30-
export MONGO_ORCHESTRATION_HOME=$DRIVERS_TOOLS/mo
31-
export PROJECT_ORCHESTRATION_HOME=$DRIVERS_TOOLS/.evergreen/orchestration
32-
export TOPOLOGY=sharded_cluster
33-
export SSL=nossl
34-
35-
cd $DRIVERS_TOOLS
36-
rm -rf mongosh mongodb mo
37-
mkdir mo
38-
cd -
39-
40-
rm expansions.sh 2> /dev/null
41-
42-
# start cluster
43-
bash $DRIVERS_TOOLS/.evergreen/run-orchestration.sh
8+
9+
# install extra dependency
10+
npm install mongodb-client-encryption
11+
12+
# set up mongodb cluster and encryption configuration if the data/ folder does not exist
13+
if [ ! -d "data" ]; then
14+
15+
mkdir data
16+
cd data
17+
18+
# note:
19+
# we're using drivers-evergreen-tools which is a repo used by MongoDB drivers to start clusters for testing.
20+
# if you'd like to make changes to the cluster settings, edit the exported variables below.
21+
# for configuration options for the exported variables, see here: https://github.com/mongodb-labs/drivers-evergreen-tools/blob/master/.evergreen/run-orchestration.sh
22+
# after this script is run, the data/ folder will notably contain the following:
23+
# 'mo-expansion.yml' file which contains for your cluster URI and crypt shared library path
24+
# 'drivers-evergreen-tools/mongodb/bin' which contain executables for other mongodb libraries such as mongocryptd, mongosh, and mongod
25+
if [ ! -d "drivers-evergreen-tools/" ]; then
26+
git clone --depth=1 "https://github.com/mongodb-labs/drivers-evergreen-tools.git"
27+
fi
28+
29+
# configure cluster settings
30+
export DRIVERS_TOOLS=$CWD/data/drivers-evergreen-tools
31+
export MONGODB_VERSION=8.0
32+
export AUTH=true
33+
export MONGODB_BINARIES=$DRIVERS_TOOLS/mongodb/bin
34+
export MONGO_ORCHESTRATION_HOME=$DRIVERS_TOOLS/mo
35+
export PROJECT_ORCHESTRATION_HOME=$DRIVERS_TOOLS/.evergreen/orchestration
36+
export TOPOLOGY=sharded_cluster
37+
export SSL=nossl
38+
39+
cd $DRIVERS_TOOLS
40+
rm -rf mongosh mongodb mo
41+
mkdir mo
42+
cd -
43+
44+
rm expansions.sh 2> /dev/null
45+
46+
echo 'Configuring Cluster...'
47+
48+
# start cluster
49+
(bash $DRIVERS_TOOLS/.evergreen/run-orchestration.sh) 1> /dev/null 2> /dev/null
50+
51+
echo 'Cluster Configuration Finished!'
52+
53+
cd ..
54+
fi

scripts/run-encryption-tests.sh

-23
This file was deleted.

0 commit comments

Comments
 (0)