Skip to content

Commit

Permalink
comments addressed
Browse files Browse the repository at this point in the history
readd  dependency

readd  dependency

lint

readd  dependency

readd  dependency

fix dep

fix dep2

fix dep2

fix dep3

fix dep4

fix dep5
  • Loading branch information
aditi-khare-mongoDB committed Jan 9, 2025
1 parent 464107c commit 7cd83f6
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 64 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/encryption-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,5 @@ jobs:
uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4.0.4
with:
node-version: latest
- name: Install Dependencies
run: npm install
- name: Run Tests
run: npm run test-encryption
9 changes: 7 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,13 @@ If you have a question about Mongoose (not a bug report) please post it to eithe
* execute `npm run test-tsd` to run the typescript tests
* execute `npm run ts-benchmark` to run the typescript benchmark "performance test" for a single time.
* 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.
* 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.
* 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.
* 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.
* These scripts can take a few minutes to run.
* To change an encryption configuration, it is recommended to follow these steps:
* Edit the variables in `scripts/configure-cluster-with-encryption.sh` with your desired configuration.
* Restart your shell.
* Delete the `data/` directory if it exists.
* Finally, run the configuration script.

## Documentation

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
"test-deno": "deno run --allow-env --allow-read --allow-net --allow-run --allow-sys --allow-write ./test/deno.js",
"test-rs": "START_REPLICA_SET=1 mocha --timeout 30000 --exit ./test/*.test.js",
"test-tsd": "node ./test/types/check-types-filename && tsd",
"test-encryption": "bash scripts/run-encryption-tests.sh",
"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",
"tdd": "mocha ./test/*.test.js --inspect --watch --recursive --watch-files ./**/*.{js,ts}",
"test-coverage": "nyc --reporter=html --reporter=text npm test",
"ts-benchmark": "cd ./benchmarks/typescript/simple && npm install && npm run benchmark | node ../../../scripts/tsc-diagnostics-check"
Expand Down
80 changes: 44 additions & 36 deletions scripts/configure-cluster-with-encryption.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,39 +5,47 @@
# this script downloads all tools required to use FLE with mongodb, then starts a cluster of the provided configuration (sharded on 8.0 server)

export CWD=$(pwd);
mkdir data
cd data

# install encryption dependency
npm install mongodb-client-encryption > /dev/null

# note:
# we're using drivers-evergreen-tools which is a repo used by MongoDB drivers to start clusters for testing.
# if you'd like to make changes to the cluster settings, edit the exported variables below.
# for configuration options for the exported variables, see here: https://github.com/mongodb-labs/drivers-evergreen-tools/blob/master/.evergreen/run-orchestration.sh
# after this script is run, the data/ folder will notably contain the following:
# 'mo-expansion.yml' file which contains for your cluster URI and crypt shared library path
# 'drivers-evergreen-tools/mongodb/bin' which contain executables for other mongodb libraries such as mongocryptd, mongosh, and mongod
if [ ! -d "drivers-evergreen-tools/" ]; then
git clone --depth=1 "https://github.com/mongodb-labs/drivers-evergreen-tools.git"
fi

# configure cluster settings
export DRIVERS_TOOLS=$CWD/data/drivers-evergreen-tools
export MONGODB_VERSION=8.0
export AUTH=true
export MONGODB_BINARIES=$DRIVERS_TOOLS/mongodb/bin
export MONGO_ORCHESTRATION_HOME=$DRIVERS_TOOLS/mo
export PROJECT_ORCHESTRATION_HOME=$DRIVERS_TOOLS/.evergreen/orchestration
export TOPOLOGY=sharded_cluster
export SSL=nossl

cd $DRIVERS_TOOLS
rm -rf mongosh mongodb mo
mkdir mo
cd -

rm expansions.sh 2> /dev/null

# start cluster
bash $DRIVERS_TOOLS/.evergreen/run-orchestration.sh

# set up mongodb cluster and encryption configuration if the data/ folder does not exist
if [ ! -d "data" ]; then

mkdir data
cd data

# note:
# we're using drivers-evergreen-tools which is a repo used by MongoDB drivers to start clusters for testing.
# if you'd like to make changes to the cluster settings, edit the exported variables below.
# for configuration options for the exported variables, see here: https://github.com/mongodb-labs/drivers-evergreen-tools/blob/master/.evergreen/run-orchestration.sh
# after this script is run, the data/ folder will notably contain the following:
# 'mo-expansion.yml' file which contains for your cluster URI and crypt shared library path
# 'drivers-evergreen-tools/mongodb/bin' which contain executables for other mongodb libraries such as mongocryptd, mongosh, and mongod
if [ ! -d "drivers-evergreen-tools/" ]; then
git clone --depth=1 "https://github.com/mongodb-labs/drivers-evergreen-tools.git"
fi

# configure cluster settings
export DRIVERS_TOOLS=$CWD/data/drivers-evergreen-tools
export MONGODB_VERSION=8.0
export AUTH=true
export MONGODB_BINARIES=$DRIVERS_TOOLS/mongodb/bin
export MONGO_ORCHESTRATION_HOME=$DRIVERS_TOOLS/mo
export PROJECT_ORCHESTRATION_HOME=$DRIVERS_TOOLS/.evergreen/orchestration
export TOPOLOGY=sharded_cluster
export SSL=nossl

cd $DRIVERS_TOOLS
rm -rf mongosh mongodb mo
mkdir mo
cd -

rm expansions.sh 2> /dev/null

echo 'Configuring Cluster...'

# start cluster
(bash $DRIVERS_TOOLS/.evergreen/run-orchestration.sh) 1> /dev/null 2> /dev/null

echo 'Cluster Configuration Finished!'

cd ..
fi
23 changes: 0 additions & 23 deletions scripts/run-encryption-tests.sh

This file was deleted.

0 comments on commit 7cd83f6

Please sign in to comment.