-
Notifications
You must be signed in to change notification settings - Fork 1.8k
/
Copy pathrun-mongosh-integration-tests.sh
38 lines (26 loc) · 1.33 KB
/
run-mongosh-integration-tests.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/bash
## Runs mongosh tests against the latest a particular build of the Node driver.
##
## Params:
## PROJECT_DIRECTORY - the directory containing the node driver source
## PROJECT_DIRECTORY - a unique identifier for the task (used in CI)
## MONGOSH_RUN_ONLY_IN_PACKAGE (optional) - a mongosh package name, without the `@mongosh` prefix. if set,
## only the tests for the provided mognosh package are run.
set -o errexit # Exit the script with error if any of the commands fail
set -o xtrace # Write all commands first to stderr
if [ -z ${PROJECT_DIRECTORY+omitted} ]; then echo "PROJECT_DIRECTORY is unset" && exit 1; fi
if [ -z ${TASK_ID+omitted} ]; then echo "TASK_ID is unset" && exit 1; fi
MONGOSH_RUN_ONLY_IN_PACKAGE=${MONGOSH_RUN_ONLY_IN_PACKAGE:-""}
source $DRIVERS_TOOLS/.evergreen/init-node-and-npm-env.sh
npm cache clear --force || true
npm install --global [email protected] || true
npm pack | tee npm-pack.log
npm cache clear --force || true
npm install --global [email protected] || true
TARBALL_FILENAME="$(tail -n1 npm-pack.log)"
MONGOSH_DIRECTORY="/tmp/$TASK_ID"
git clone --depth=10 https://github.com/mongodb-js/mongosh.git $MONGOSH_DIRECTORY
cd $MONGOSH_DIRECTORY
export DRIVER_TARBALL_PATH="${PROJECT_DIRECTORY}/${TARBALL_FILENAME}"
export MONGOSH_RUN_ONLY_IN_PACKAGE="$MONGOSH_RUN_ONLY_IN_PACKAGE"
npm run test-nodedriver