Skip to content

Commit d2f7666

Browse files
Merge branch 'main' into NODE-5106
2 parents 8ca8f81 + 6537e27 commit d2f7666

File tree

84 files changed

+4649
-2572
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+4649
-2572
lines changed

.eslintrc.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@
8787
"global"
8888
],
8989
"@typescript-eslint/no-explicit-any": "off",
90+
"@typescript-eslint/require-await": "off",
9091
"no-restricted-imports": [
9192
"error",
9293
{
@@ -120,6 +121,12 @@
120121
"selector": "BinaryExpression[operator=/[=!]==?/] Literal[value='undefined']",
121122
"message": "Do not strictly check typeof undefined (NOTE: currently this rule only detects the usage of 'undefined' string literal so this could be a misfire)"
122123
}
124+
],
125+
"@typescript-eslint/no-unused-vars": [
126+
"error",
127+
{
128+
"argsIgnorePattern": "^_"
129+
}
123130
]
124131
},
125132
"overrides": [
@@ -228,6 +235,7 @@
228235
"@typescript-eslint/no-unsafe-call": "off",
229236
"@typescript-eslint/restrict-plus-operands": "off",
230237
"@typescript-eslint/restrict-template-expressions": "off",
238+
"@typescript-eslint/require-await": "off",
231239
"no-return-await": "off",
232240
"@typescript-eslint/return-await": [
233241
"error",

.evergreen/config.in.yml

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,15 @@ functions:
9494
- .evergreen/run-kms-servers.sh
9595
env:
9696
DRIVERS_TOOLS: ${DRIVERS_TOOLS}
97+
- command: subprocess.exec
98+
params:
99+
background: true
100+
working_dir: src
101+
binary: bash
102+
args:
103+
- .evergreen/run-azure-kms-mock-server.sh
104+
env:
105+
DRIVERS_TOOLS: ${DRIVERS_TOOLS}
97106

98107
"bootstrap oidc":
99108
- command: ec2.assume_role
@@ -1136,6 +1145,46 @@ tasks:
11361145
args:
11371146
- src/.evergreen/run-gcp-kms-tests.sh
11381147

1148+
1149+
- name: "test-azurekms-task"
1150+
commands:
1151+
- func: "install dependencies"
1152+
- command: subprocess.exec
1153+
type: setup
1154+
params:
1155+
binary: bash
1156+
add_expansions_to_env: true
1157+
args:
1158+
- src/.evergreen/copy-driver-to-azure.sh
1159+
- command: subprocess.exec
1160+
type: test
1161+
params:
1162+
working_dir: src
1163+
binary: bash
1164+
add_expansions_to_env: true
1165+
env:
1166+
AZUREKMS_CMD: "env EXPECTED_AZUREKMS_OUTCOME=success bash src/.evergreen/run-azure-kms-tests.sh"
1167+
args:
1168+
- ${DRIVERS_TOOLS}/.evergreen/csfle/azurekms/run-command.sh
1169+
1170+
- name: "test-azurekms-fail-task"
1171+
commands:
1172+
- func: "install dependencies"
1173+
- func: bootstrap mongo-orchestration
1174+
vars:
1175+
VERSION: latest
1176+
TOPOLOGY: server
1177+
AUTH: noauth
1178+
- command: subprocess.exec
1179+
type: test
1180+
params:
1181+
binary: bash
1182+
env:
1183+
EXPECTED_AZUREKMS_OUTCOME: "failure"
1184+
args:
1185+
- src/.evergreen/run-azure-kms-tests.sh
1186+
1187+
11391188
task_groups:
11401189
- name: serverless_task_group
11411190
setup_group_can_fail_task: true
@@ -1208,6 +1257,33 @@ task_groups:
12081257
tasks:
12091258
- test-gcpkms-task
12101259

1260+
- name: test_azurekms_task_group
1261+
setup_group_can_fail_task: true
1262+
setup_group_timeout_secs: 1800 # 30 minutes
1263+
setup_group:
1264+
- func: fetch source
1265+
- command: subprocess.exec
1266+
params:
1267+
working_dir: "src"
1268+
binary: bash
1269+
add_expansions_to_env: true
1270+
args:
1271+
- .evergreen/setup-azure-vm.sh
1272+
- command: expansions.update
1273+
# Load AZUREKMS_VMNAME into the expansions.
1274+
params:
1275+
file: src/testazurekms-expansions.yml
1276+
1277+
teardown_group:
1278+
- command: subprocess.exec
1279+
params:
1280+
binary: bash
1281+
add_expansions_to_env: true
1282+
args:
1283+
- ${DRIVERS_TOOLS}/.evergreen/csfle/azurekms/delete-vm.sh
1284+
tasks:
1285+
- test-azurekms-task
1286+
12111287
pre:
12121288
- func: "fetch source"
12131289
- func: "windows fix"

.evergreen/config.yml

Lines changed: 79 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,15 @@ functions:
6868
- .evergreen/run-kms-servers.sh
6969
env:
7070
DRIVERS_TOOLS: ${DRIVERS_TOOLS}
71+
- command: subprocess.exec
72+
params:
73+
background: true
74+
working_dir: src
75+
binary: bash
76+
args:
77+
- .evergreen/run-azure-kms-mock-server.sh
78+
env:
79+
DRIVERS_TOOLS: ${DRIVERS_TOOLS}
7180
bootstrap oidc:
7281
- command: ec2.assume_role
7382
params:
@@ -1067,6 +1076,42 @@ tasks:
10671076
EXPECTED_GCPKMS_OUTCOME: failure
10681077
args:
10691078
- src/.evergreen/run-gcp-kms-tests.sh
1079+
- name: test-azurekms-task
1080+
commands:
1081+
- func: install dependencies
1082+
- command: subprocess.exec
1083+
type: setup
1084+
params:
1085+
binary: bash
1086+
add_expansions_to_env: true
1087+
args:
1088+
- src/.evergreen/copy-driver-to-azure.sh
1089+
- command: subprocess.exec
1090+
type: test
1091+
params:
1092+
working_dir: src
1093+
binary: bash
1094+
add_expansions_to_env: true
1095+
env:
1096+
AZUREKMS_CMD: env EXPECTED_AZUREKMS_OUTCOME=success bash src/.evergreen/run-azure-kms-tests.sh
1097+
args:
1098+
- ${DRIVERS_TOOLS}/.evergreen/csfle/azurekms/run-command.sh
1099+
- name: test-azurekms-fail-task
1100+
commands:
1101+
- func: install dependencies
1102+
- func: bootstrap mongo-orchestration
1103+
vars:
1104+
VERSION: latest
1105+
TOPOLOGY: server
1106+
AUTH: noauth
1107+
- command: subprocess.exec
1108+
type: test
1109+
params:
1110+
binary: bash
1111+
env:
1112+
EXPECTED_AZUREKMS_OUTCOME: failure
1113+
args:
1114+
- src/.evergreen/run-azure-kms-tests.sh
10701115
- name: test-latest-server
10711116
tags:
10721117
- latest
@@ -2489,7 +2534,7 @@ tasks:
24892534
- func: bootstrap kms servers
24902535
- func: run custom csfle tests
24912536
vars:
2492-
CSFLE_GIT_REF: 77b51c00ab4ff58916dd39f55657e1ecc0af281c
2537+
CSFLE_GIT_REF: cd7e938619aa52ce652d13690780df5f383bbef0
24932538
- name: run-custom-csfle-tests-5.0-master
24942539
tags:
24952540
- run-custom-dependency-tests
@@ -2519,7 +2564,7 @@ tasks:
25192564
- func: bootstrap kms servers
25202565
- func: run custom csfle tests
25212566
vars:
2522-
CSFLE_GIT_REF: 77b51c00ab4ff58916dd39f55657e1ecc0af281c
2567+
CSFLE_GIT_REF: cd7e938619aa52ce652d13690780df5f383bbef0
25232568
- name: run-custom-csfle-tests-rapid-master
25242569
tags:
25252570
- run-custom-dependency-tests
@@ -2549,7 +2594,7 @@ tasks:
25492594
- func: bootstrap kms servers
25502595
- func: run custom csfle tests
25512596
vars:
2552-
CSFLE_GIT_REF: 77b51c00ab4ff58916dd39f55657e1ecc0af281c
2597+
CSFLE_GIT_REF: cd7e938619aa52ce652d13690780df5f383bbef0
25532598
- name: run-custom-csfle-tests-latest-master
25542599
tags:
25552600
- run-custom-dependency-tests
@@ -3088,6 +3133,30 @@ task_groups:
30883133
- ${DRIVERS_TOOLS}/.evergreen/csfle/gcpkms/delete-instance.sh
30893134
tasks:
30903135
- test-gcpkms-task
3136+
- name: test_azurekms_task_group
3137+
setup_group_can_fail_task: true
3138+
setup_group_timeout_secs: 1800
3139+
setup_group:
3140+
- func: fetch source
3141+
- command: subprocess.exec
3142+
params:
3143+
working_dir: src
3144+
binary: bash
3145+
add_expansions_to_env: true
3146+
args:
3147+
- .evergreen/setup-azure-vm.sh
3148+
- command: expansions.update
3149+
params:
3150+
file: src/testazurekms-expansions.yml
3151+
teardown_group:
3152+
- command: subprocess.exec
3153+
params:
3154+
binary: bash
3155+
add_expansions_to_env: true
3156+
args:
3157+
- ${DRIVERS_TOOLS}/.evergreen/csfle/azurekms/delete-vm.sh
3158+
tasks:
3159+
- test-azurekms-task
30913160
pre:
30923161
- func: fetch source
30933162
- func: windows fix
@@ -3557,6 +3626,13 @@ buildvariants:
35573626
tasks:
35583627
- test_gcpkms_task_group
35593628
- test-gcpkms-fail-task
3629+
- name: debian11-test-azure-kms
3630+
display_name: Azure KMS Test
3631+
run_on: debian11-small
3632+
batchtime: 20160
3633+
tasks:
3634+
- test_azurekms_task_group
3635+
- test-azurekms-fail-task
35603636
- name: rhel8-no-auth-tests
35613637
display_name: No Auth Tests
35623638
run_on: rhel80-large

.evergreen/copy-driver-to-azure.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#! /usr/bin/env bash
2+
3+
set -o errexit
4+
5+
if [ -z ${AZUREKMS_RESOURCEGROUP+omitted} ]; then echo "AZUREKMS_RESOURCEGROUP is unset" && exit 1; fi
6+
if [ -z ${AZUREKMS_VMNAME+omitted} ]; then echo "AZUREKMS_VMNAME is unset" && exit 1; fi
7+
if [ -z ${AZUREKMS_PRIVATEKEYPATH+omitted} ]; then echo "AZUREKMS_PRIVATEKEYPATH is unset" && exit 1; fi
8+
9+
source "${PROJECT_DIRECTORY}/.evergreen/init-nvm.sh"
10+
11+
echo "compressing node driver source ... begin"
12+
tar -czf node-driver-source.tgz src
13+
echo "compressing node driver source ... end"
14+
15+
export AZUREKMS_SRC=node-driver-source.tgz
16+
export AZUREKMS_DST="./"
17+
echo "copying node driver tar ... begin"
18+
"${DRIVERS_TOOLS}/.evergreen/csfle/azurekms/copy-file.sh"
19+
echo "copying node driver tar ... end"
20+
21+
echo "decompressing node driver tar on azure ... begin"
22+
export AZUREKMS_CMD="tar xf node-driver-source.tgz"
23+
"${DRIVERS_TOOLS}/.evergreen/csfle/azurekms/run-command.sh"
24+
echo "decompressing node driver tar on azure ... end"

.evergreen/generate_evergreen_tasks.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -456,9 +456,8 @@ for (const {
456456

457457
BUILD_VARIANTS.push({
458458
name: 'macos-1100',
459-
display_name: `MacOS 11 Node${
460-
versions.find(version => version.codeName === LATEST_LTS).versionNumber
461-
}`,
459+
display_name: `MacOS 11 Node${versions.find(version => version.codeName === LATEST_LTS).versionNumber
460+
}`,
462461
run_on: 'macos-1100',
463462
expansions: {
464463
NODE_LTS_NAME: LATEST_LTS,
@@ -596,7 +595,7 @@ BUILD_VARIANTS.push({
596595

597596
const oneOffFuncAsTasks = [];
598597

599-
const FLE_PINNED_COMMIT = '77b51c00ab4ff58916dd39f55657e1ecc0af281c';
598+
const FLE_PINNED_COMMIT = 'cd7e938619aa52ce652d13690780df5f383bbef0';
600599

601600
for (const version of ['5.0', 'rapid', 'latest']) {
602601
for (const ref of [FLE_PINNED_COMMIT, 'master']) {
@@ -668,6 +667,14 @@ BUILD_VARIANTS.push({
668667
tasks: ['test_gcpkms_task_group', 'test-gcpkms-fail-task']
669668
});
670669

670+
BUILD_VARIANTS.push({
671+
name: 'debian11-test-azure-kms',
672+
display_name: 'Azure KMS Test',
673+
run_on: 'debian11-small',
674+
batchtime: 20160,
675+
tasks: ['test_azurekms_task_group', 'test-azurekms-fail-task']
676+
});
677+
671678
BUILD_VARIANTS.push({
672679
name: 'rhel8-no-auth-tests',
673680
display_name: 'No Auth Tests',

.evergreen/install-dependencies.sh

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,17 @@ NODE_LTS_NAME=${NODE_LTS_NAME:-fermium}
55
NODE_ARTIFACTS_PATH="${PROJECT_DIRECTORY:-$(pwd)}/node-artifacts"
66
if [[ "$OS" = "Windows_NT" ]]; then NODE_ARTIFACTS_PATH=$(cygpath --unix "$NODE_ARTIFACTS_PATH"); fi
77

8+
CURL_FLAGS=(
9+
--fail # Exit code 1 if request fails
10+
--compressed # Request a compressed response should keep fetching fast
11+
--location # Follow a redirect
12+
--retry 8 # Retry HTTP 408, 429, 500, 502, 503 or 504, 8 times
13+
--silent # Do not print a progress bar
14+
--show-error # Despite the silent flag still print out errors
15+
--max-time 900 # 900 seconds is 15 minutes, evergreen times out at 20
16+
--continue-at - # If a download is interrupted it can figure out where to resume
17+
)
18+
819
mkdir -p "$NODE_ARTIFACTS_PATH/npm_global"
920

1021
# Comparisons are all case insensitive
@@ -13,7 +24,7 @@ shopt -s nocasematch
1324
# index.tab is a sorted tab separated values file with the following headers
1425
# 0 1 2 3 4 5 6 7 8 9 10
1526
# version date files npm v8 uv zlib openssl modules lts security
16-
curl --retry 8 -sS "https://nodejs.org/dist/index.tab" --max-time 300 --output node_index.tab
27+
curl "${CURL_FLAGS[@]}" "https://nodejs.org/dist/index.tab" --output node_index.tab
1728

1829
while IFS=$'\t' read -r -a row; do
1930
node_index_version="${row[0]}"
@@ -63,7 +74,7 @@ echo "Node.js ${node_index_version} for ${operating_system}-${architecture} rele
6374

6475
set -o xtrace
6576

66-
curl --fail --retry 8 -sS "${node_download_url}" --max-time 300 --output "$node_archive_path"
77+
curl "${CURL_FLAGS[@]}" "${node_download_url}" --output "$node_archive_path"
6778

6879
if [[ "$file_extension" = "zip" ]]; then
6980
unzip -q "$node_archive_path" -d "${NODE_ARTIFACTS_PATH}"
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#! /user/bin/env bash
2+
3+
if [ -z ${DRIVERS_TOOLS+omitted} ]; then echo "DRIVERS_TOOLS is unset" && exit 1; fi
4+
5+
set -o errexit
6+
7+
python3 $DRIVERS_TOOLS/.evergreen/csfle/bottle.py fake_azure:imds &
8+
9+
echo "Running Azure KMS idms server on port 8080"

.evergreen/run-azure-kms-tests.sh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#! /usr/bin/env bash
2+
3+
set -o errexit
4+
5+
pushd "src"
6+
PROJECT_DIRECTORY="$(pwd)"
7+
export PROJECT_DIRECTORY
8+
source ".evergreen/init-nvm.sh"
9+
10+
set -o xtrace
11+
12+
npm install --force 'mongodb-client-encryption@latest'
13+
14+
export MONGODB_URI="mongodb://localhost:27017"
15+
16+
export EXPECTED_AZUREKMS_OUTCOME=${EXPECTED_AZUREKMS_OUTCOME:-omitted}
17+
export TEST_CSFLE=true
18+
export CSFLE_KMS_PROVIDERS='not json'
19+
20+
npx mocha --config test/mocha_mongodb.json test/integration/client-side-encryption/client_side_encryption.prose.19.on_demand_azure.test.ts

.evergreen/run-gcp-kms-tests.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ source ".evergreen/init-nvm.sh"
99

1010
set -o xtrace
1111

12-
npm install 'mongodb-client-encryption@2.6.0-alpha.0'
12+
npm install 'mongodb-client-encryption@latest'
1313
npm install 'gcp-metadata'
1414

1515
export MONGODB_URI="mongodb://localhost:27017"

0 commit comments

Comments
 (0)