Skip to content

Commit 7cd83f6

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
1 parent 464107c commit 7cd83f6

File tree

5 files changed

+52
-64
lines changed

5 files changed

+52
-64
lines changed

.github/workflows/encryption-tests.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,5 @@ jobs:
2929
uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4.0.4
3030
with:
3131
node-version: latest
32-
- name: Install Dependencies
33-
run: npm install
3432
- name: Run Tests
3533
run: npm run test-encryption

CONTRIBUTING.md

Lines changed: 7 additions & 2 deletions
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

Lines changed: 1 addition & 1 deletion
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": "npm install && npm install mongodb-client-encryption > /dev/null && 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

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

scripts/run-encryption-tests.sh

Lines changed: 0 additions & 23 deletions
This file was deleted.

0 commit comments

Comments
 (0)