@@ -5,21 +5,27 @@ if [ -z ${AWS_ACCESS_KEY_ID+omitted} ]; then echo "AWS_ACCESS_KEY_ID is unset" &
5
5
if [ -z ${AWS_SECRET_ACCESS_KEY+omitted} ]; then echo " AWS_SECRET_ACCESS_KEY is unset" && exit 1; fi
6
6
if [ -z ${CSFLE_KMS_PROVIDERS+omitted} ]; then echo " CSFLE_KMS_PROVIDERS is unset" && exit 1; fi
7
7
8
+ export AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID}
9
+ export AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY}
10
+ export CSFLE_KMS_PROVIDERS=${CSFLE_KMS_PROVIDERS}
11
+
8
12
[ -s " $PROJECT_DIRECTORY /node-artifacts/nvm/nvm.sh" ] && source " $PROJECT_DIRECTORY " /node-artifacts/nvm/nvm.sh
9
13
10
14
set -o xtrace # Write all commands first to stderr
11
15
set -o errexit # Exit the script with error if any of the commands fail
12
16
17
+ ABS_PATH_TO_PATCH=$( pwd)
18
+
13
19
# Environment Variables:
14
20
# CSFLE_GIT_REF - set the git reference to checkout for a custom CSFLE version
15
21
# CDRIVER_GIT_REF - set the git reference to checkout for a custom CDRIVER version (this is for libbson)
16
22
17
23
CSFLE_GIT_REF=${CSFLE_GIT_REF:- master}
18
- CDRIVER_GIT_REF=${CDRIVER_GIT_REF:- 1.17.4 }
24
+ CDRIVER_GIT_REF=${CDRIVER_GIT_REF:- 1.17.6 }
19
25
20
- rm -rf csfle-deps-tmp
21
- mkdir -p csfle-deps-tmp
22
- pushd csfle-deps-tmp
26
+ rm -rf ../ csfle-deps-tmp
27
+ mkdir -p ../ csfle-deps-tmp
28
+ pushd ../ csfle-deps-tmp
23
29
24
30
rm -rf libmongocrypt mongo-c-driver
25
31
@@ -37,15 +43,53 @@ popd # mongo-c-driver
37
43
38
44
pushd libmongocrypt/bindings/node
39
45
46
+ npm install --production --ignore-scripts
40
47
source ./.evergreen/find_cmake.sh
41
48
bash ./etc/build-static.sh
42
49
43
50
popd # libmongocrypt/bindings/node
44
- popd # csfle-deps-tmp
45
-
46
- npm install
51
+ popd # ../csfle-deps-tmp
47
52
48
- cp -r csfle-deps-tmp/libmongocrypt/bindings/node node_modules/mongodb-client-encryption
53
+ # copy mongodb-client-encryption into driver's node_modules
54
+ cp -R ../csfle-deps-tmp/libmongocrypt/bindings/node node_modules/mongodb-client-encryption
49
55
50
56
export MONGODB_URI=${MONGODB_URI}
51
- npx mocha test/functional/client_side_encryption
57
+ set +o errexit # We want to run both test suites even if the first fails
58
+ npm run check:csfle
59
+ DRIVER_CSFLE_TEST_RESULT=$?
60
+ set -o errexit
61
+
62
+ # Great! our drivers tests ran
63
+ # there are tests inside the bindings repo that we also want to check
64
+
65
+ pushd ../csfle-deps-tmp/libmongocrypt/bindings/node
66
+
67
+ # a mongocryptd was certainly started by the driver tests,
68
+ # let us let the bindings tests start their own
69
+ killall mongocryptd || true
70
+
71
+ # only prod deps were installed earlier, install devDependencies here (except for mongodb!)
72
+ npm install --ignore-scripts
73
+
74
+ # copy mongodb into CSFLE's node_modules
75
+ rm -rf node_modules/mongodb
76
+ cp -R " $ABS_PATH_TO_PATCH " node_modules/mongodb
77
+ pushd node_modules/mongodb
78
+ # lets be sure we have compiled TS since driver tests don't need to compile
79
+ npm run build:ts
80
+ popd # node_modules/mongodb
81
+
82
+ # this variable needs to be empty
83
+ export MONGODB_NODE_SKIP_LIVE_TESTS=" "
84
+ # all of the below must be defined (as well as AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY)
85
+ export AWS_REGION=" us-east-1"
86
+ export AWS_CMK_ID=" arn:aws:kms:us-east-1:579766882180:key/89fcc2c4-08b0-4bd9-9f25-e30687b580d0"
87
+ npm test -- --colors
88
+
89
+ popd # ../csfle-deps-tmp/libmongocrypt/bindings/node
90
+
91
+ # Exit the script in a way that will show evergreen a pass or fail
92
+ if [ $DRIVER_CSFLE_TEST_RESULT -ne 0 ]; then
93
+ echo " Driver tests failed, look above for results"
94
+ exit 1
95
+ fi
0 commit comments