Skip to content

Commit d54383d

Browse files
nbbeekenW-A-James
authored andcommitted
feat(NODE-4950)!: remove bson-ext import and squash commits
1 parent f7961a7 commit d54383d

File tree

324 files changed

+12344
-904
lines changed

Some content is hidden

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

324 files changed

+12344
-904
lines changed

.eslintrc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"root": true,
33
"parser": "@typescript-eslint/parser",
44
"parserOptions": {
5-
"ecmaVersion": 2019
5+
"ecmaVersion": 2020
66
},
77
"plugins": [
88
"simple-import-sort",

.evergreen/config.in.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ functions:
375375
working_dir: "src"
376376
script: |
377377
${PREPARE_SHELL}
378-
NODE_LTS_NAME=${NODE_LTS_NAME} MSVS_VERSION=${MSVS_VERSION} NPM_OPTIONS=${NPM_OPTIONS}\
378+
NODE_LTS_NAME=${NODE_LTS_NAME} NPM_OPTIONS=${NPM_OPTIONS}\
379379
bash ${PROJECT_DIRECTORY}/.evergreen/install-dependencies.sh
380380
- command: expansions.update
381381
params:
@@ -434,6 +434,7 @@ functions:
434434
export DRIVERS_TOOLS="${DRIVERS_TOOLS}"
435435
export NODE_LTS_NAME='${NODE_LTS_NAME}'
436436
export MONGODB_URI="${MONGODB_URI}"
437+
export TEST_SOCKS5_CSFLE="${TEST_SOCKS5_CSFLE}"
437438
export SSL="${SSL}"
438439
439440
# Disable xtrace (just in case it was accidentally set).
@@ -451,6 +452,7 @@ functions:
451452
script: |
452453
export PROJECT_DIRECTORY="$(pwd)"
453454
export KRB5_KEYTAB='${gssapi_auth_keytab_base64}'
455+
export KRB5_NEW_KEYTAB='${gssapi_auth_new_keytab_base64}'
454456
export KRB5_PRINCIPAL='${gssapi_auth_principal}'
455457
export MONGODB_URI='${gssapi_auth_mongodb_uri}'
456458
export NODE_LTS_NAME='${NODE_LTS_NAME}'

.evergreen/config.yml

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ functions:
334334
working_dir: src
335335
script: |
336336
${PREPARE_SHELL}
337-
NODE_LTS_NAME=${NODE_LTS_NAME} MSVS_VERSION=${MSVS_VERSION} NPM_OPTIONS=${NPM_OPTIONS}\
337+
NODE_LTS_NAME=${NODE_LTS_NAME} NPM_OPTIONS=${NPM_OPTIONS}\
338338
bash ${PROJECT_DIRECTORY}/.evergreen/install-dependencies.sh
339339
- command: expansions.update
340340
params:
@@ -398,6 +398,8 @@ functions:
398398
399399
export MONGODB_URI="${MONGODB_URI}"
400400
401+
export TEST_SOCKS5_CSFLE="${TEST_SOCKS5_CSFLE}"
402+
401403
export SSL="${SSL}"
402404
403405
@@ -419,6 +421,7 @@ functions:
419421
script: |
420422
export PROJECT_DIRECTORY="$(pwd)"
421423
export KRB5_KEYTAB='${gssapi_auth_keytab_base64}'
424+
export KRB5_NEW_KEYTAB='${gssapi_auth_new_keytab_base64}'
422425
export KRB5_PRINCIPAL='${gssapi_auth_principal}'
423426
export MONGODB_URI='${gssapi_auth_mongodb_uri}'
424427
export NODE_LTS_NAME='${NODE_LTS_NAME}'
@@ -1303,6 +1306,19 @@ tasks:
13031306
TOPOLOGY: replica_set
13041307
- func: bootstrap kms servers
13051308
- func: run socks5 tests
1309+
- name: test-socks5-csfle
1310+
tags:
1311+
- socks5-csfle
1312+
commands:
1313+
- func: install dependencies
1314+
- func: bootstrap mongo-orchestration
1315+
vars:
1316+
VERSION: latest
1317+
TOPOLOGY: replica_set
1318+
- func: bootstrap kms servers
1319+
- func: run socks5 tests
1320+
vars:
1321+
TEST_SOCKS5_CSFLE: 'true'
13061322
- name: test-socks5-tls
13071323
tags: []
13081324
commands:
@@ -2132,7 +2148,7 @@ tasks:
21322148
- func: bootstrap kms servers
21332149
- func: run custom csfle tests
21342150
vars:
2135-
CSFLE_GIT_REF: 67bec571c0c21f4db8a96b6bd61cb24dfc87a223
2151+
CSFLE_GIT_REF: 77b51c00ab4ff58916dd39f55657e1ecc0af281c
21362152
- name: run-custom-csfle-tests-5.0-master
21372153
tags:
21382154
- run-custom-dependency-tests
@@ -2162,7 +2178,7 @@ tasks:
21622178
- func: bootstrap kms servers
21632179
- func: run custom csfle tests
21642180
vars:
2165-
CSFLE_GIT_REF: 67bec571c0c21f4db8a96b6bd61cb24dfc87a223
2181+
CSFLE_GIT_REF: 77b51c00ab4ff58916dd39f55657e1ecc0af281c
21662182
- name: run-custom-csfle-tests-rapid-master
21672183
tags:
21682184
- run-custom-dependency-tests
@@ -2192,7 +2208,7 @@ tasks:
21922208
- func: bootstrap kms servers
21932209
- func: run custom csfle tests
21942210
vars:
2195-
CSFLE_GIT_REF: 67bec571c0c21f4db8a96b6bd61cb24dfc87a223
2211+
CSFLE_GIT_REF: 77b51c00ab4ff58916dd39f55657e1ecc0af281c
21962212
- name: run-custom-csfle-tests-latest-master
21972213
tags:
21982214
- run-custom-dependency-tests
@@ -2661,6 +2677,7 @@ buildvariants:
26612677
- test-auth-kerberos
26622678
- test-auth-ldap
26632679
- test-socks5
2680+
- test-socks5-csfle
26642681
- test-socks5-tls
26652682
- test-zstd-compression
26662683
- test-snappy-compression
@@ -2709,6 +2726,7 @@ buildvariants:
27092726
- test-auth-kerberos
27102727
- test-auth-ldap
27112728
- test-socks5
2729+
- test-socks5-csfle
27122730
- test-socks5-tls
27132731
- test-tls-support-latest
27142732
- test-tls-support-6.0
@@ -2752,8 +2770,10 @@ buildvariants:
27522770
- test-5.0-load-balanced
27532771
- test-6.0-load-balanced
27542772
- test-latest-load-balanced
2773+
- test-auth-kerberos
27552774
- test-auth-ldap
27562775
- test-socks5
2776+
- test-socks5-csfle
27572777
- test-socks5-tls
27582778
- test-tls-support-latest
27592779
- test-tls-support-6.0
@@ -2798,6 +2818,7 @@ buildvariants:
27982818
- test-6.0-load-balanced
27992819
- test-latest-load-balanced
28002820
- test-auth-ldap
2821+
- test-socks5-csfle
28012822
- test-socks5-tls
28022823
- test-tls-support-latest
28032824
- test-tls-support-6.0
@@ -2809,7 +2830,6 @@ buildvariants:
28092830
run_on: windows-64-vs2019-large
28102831
expansions:
28112832
NODE_LTS_NAME: fermium
2812-
MSVS_VERSION: 2019
28132833
tasks:
28142834
- test-latest-server
28152835
- test-latest-replica_set
@@ -2851,7 +2871,6 @@ buildvariants:
28512871
run_on: windows-64-vs2019-large
28522872
expansions:
28532873
NODE_LTS_NAME: gallium
2854-
MSVS_VERSION: 2019
28552874
tasks:
28562875
- test-latest-server
28572876
- test-latest-replica_set
@@ -2891,7 +2910,6 @@ buildvariants:
28912910
run_on: windows-64-vs2019-large
28922911
expansions:
28932912
NODE_LTS_NAME: hydrogen
2894-
MSVS_VERSION: 2019
28952913
tasks:
28962914
- test-latest-server
28972915
- test-latest-replica_set

.evergreen/generate_evergreen_tasks.js

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ const OPERATING_SYSTEMS = [
2828
name: 'windows-64-vs2019',
2929
display_name: 'Windows (VS2019)',
3030
run_on: 'windows-64-vs2019-large',
31-
msvsVersion: 2019,
3231
clientEncryption: false // TODO(NODE-3401): Unskip when Windows no longer fails to launch mongocryptd occasionally
3332
}
3433
].map(osConfig => ({
@@ -39,7 +38,7 @@ const OPERATING_SYSTEMS = [
3938
}));
4039

4140
// TODO: NODE-3060: enable skipped tests on windows
42-
const WINDOWS_SKIP_TAGS = new Set(['atlas-connect', 'auth', 'load_balancer']);
41+
const WINDOWS_SKIP_TAGS = new Set(['atlas-connect', 'auth', 'load_balancer', 'socks5-csfle']);
4342

4443
const TASKS = [];
4544
const SINGLETON_TASKS = [];
@@ -204,6 +203,27 @@ TASKS.push(
204203
{ func: 'run socks5 tests' }
205204
]
206205
},
206+
{
207+
name: 'test-socks5-csfle',
208+
tags: ['socks5-csfle'],
209+
commands: [
210+
{ func: 'install dependencies' },
211+
{
212+
func: 'bootstrap mongo-orchestration',
213+
vars: {
214+
VERSION: 'latest',
215+
TOPOLOGY: 'replica_set'
216+
}
217+
},
218+
{ func: 'bootstrap kms servers' },
219+
{
220+
func: 'run socks5 tests',
221+
vars: {
222+
TEST_SOCKS5_CSFLE: 'true'
223+
}
224+
}
225+
]
226+
},
207227
{
208228
name: 'test-socks5-tls',
209229
tags: [],
@@ -374,7 +394,6 @@ for (const
374394
run_on,
375395
nodeVersions = NODE_VERSIONS,
376396
clientEncryption,
377-
msvsVersion
378397
} of OPERATING_SYSTEMS) {
379398
const testedNodeVersions = NODE_VERSIONS.filter(version => nodeVersions.includes(version));
380399
const os = osName.split('-')[0];
@@ -397,9 +416,6 @@ for (const
397416
if (clientEncryption) {
398417
expansions.CLIENT_ENCRYPTION = true;
399418
}
400-
if (msvsVersion) {
401-
expansions.MSVS_VERSION = msvsVersion;
402-
}
403419

404420
BUILD_VARIANTS.push({ name, display_name, run_on, expansions, tasks: taskNames });
405421
};
@@ -578,8 +594,10 @@ BUILD_VARIANTS.push({
578594

579595
const oneOffFuncAsTasks = []
580596

597+
const FLE_PINNED_COMMIT = '77b51c00ab4ff58916dd39f55657e1ecc0af281c'
598+
581599
for (const version of ['5.0', 'rapid', 'latest']) {
582-
for (const ref of ['67bec571c0c21f4db8a96b6bd61cb24dfc87a223', 'master']) {
600+
for (const ref of [FLE_PINNED_COMMIT, 'master']) {
583601
oneOffFuncAsTasks.push({
584602
name: `run-custom-csfle-tests-${version}-${ref === 'master' ? ref : 'pinned-commit'}`,
585603
tags: ['run-custom-dependency-tests'],
@@ -667,9 +685,9 @@ for (const variant of BUILD_VARIANTS.filter(
667685
);
668686
}
669687

670-
// TODO(NODE-4894): fix kerberos tests on Node18
688+
// TODO(NODE-5021): Drop support for Kerberos 1.x on in 6.0.0
671689
for (const variant of BUILD_VARIANTS.filter(
672-
variant => variant.expansions && ['hydrogen', 'latest'].includes(variant.expansions.NODE_LTS_NAME)
690+
variant => variant.expansions && ['latest'].includes(variant.expansions.NODE_LTS_NAME)
673691
)) {
674692
variant.tasks = variant.tasks.filter(
675693
name => !['test-auth-kerberos'].includes(name)

.evergreen/install-dependencies.sh

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,14 @@ NVM_WINDOWS_URL="https://github.com/coreybutler/nvm-windows/releases/download/1.
55
NVM_URL="https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh"
66

77
NODE_LTS_NAME=${NODE_LTS_NAME:-fermium}
8-
MSVS_VERSION=${MSVS_VERSION:-2019}
98
NODE_ARTIFACTS_PATH="${PROJECT_DIRECTORY}/node-artifacts"
10-
NPM_CACHE_DIR="${NODE_ARTIFACTS_PATH}/npm"
11-
NPM_TMP_DIR="${NODE_ARTIFACTS_PATH}/tmp"
129

1310
# this needs to be explicitly exported for the nvm install below
1411
export NVM_DIR="${NODE_ARTIFACTS_PATH}/nvm"
1512
export XDG_CONFIG_HOME=${NODE_ARTIFACTS_PATH}
1613

1714
# create node artifacts path if needed
18-
mkdir -p ${NODE_ARTIFACTS_PATH}
19-
mkdir -p ${NPM_CACHE_DIR}
20-
mkdir -p "${NPM_TMP_DIR}"
15+
mkdir -p "${NODE_ARTIFACTS_PATH}"
2116

2217
function node_lts_to_version() {
2318
case $1 in
@@ -99,22 +94,12 @@ EOT
9994
which node || echo "node not found, PATH=$PATH"
10095
which npm || echo "npm not found, PATH=$PATH"
10196
npm cache clear --force # Fixes: Cannot read properties of null (reading 'pickAlgorithm') error on windows
102-
npm config set msvs_version ${MSVS_VERSION}
103-
npm config set scripts-prepend-node-path true
10497

10598
# install Node.js on Linux/MacOS
10699
else
107100
curl -o- $NVM_URL | bash
108101
[ -s "${NVM_DIR}/nvm.sh" ] && source "${NVM_DIR}/nvm.sh"
109102
nvm install --no-progress "$NODE_VERSION"
110-
111-
# setup npm cache in a local directory
112-
cat <<EOT > .npmrc
113-
devdir=${NPM_CACHE_DIR}/.node-gyp
114-
init-module=${NPM_CACHE_DIR}/.npm-init.js
115-
cache=${NPM_CACHE_DIR}
116-
tmp=${NPM_TMP_DIR}
117-
EOT
118103
fi
119104

120105
npm install ${NPM_OPTIONS}

.evergreen/run-kerberos-tests.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,17 @@ source "${PROJECT_DIRECTORY}/.evergreen/init-nvm.sh"
66

77
# set up keytab
88
mkdir -p "$(pwd)/.evergreen"
9-
touch "$(pwd)/.evergreen/krb5.conf.empty"
109
export KRB5_CONFIG="$(pwd)/.evergreen/krb5.conf.empty"
1110
echo "Writing keytab"
1211
# DON'T PRINT KEYTAB TO STDOUT
1312
set +o verbose
1413
if [[ "$OSTYPE" == "darwin"* ]]; then
15-
echo ${KRB5_KEYTAB} | base64 -D > "$(pwd)/.evergreen/drivers.keytab"
14+
echo ${KRB5_NEW_KEYTAB} | base64 -D > "$(pwd)/.evergreen/drivers.keytab"
1615
else
17-
echo ${KRB5_KEYTAB} | base64 -d > "$(pwd)/.evergreen/drivers.keytab"
16+
echo ${KRB5_NEW_KEYTAB} | base64 -d > "$(pwd)/.evergreen/drivers.keytab"
1817
fi
18+
echo "Running kdestroy"
19+
kdestroy -A
1920
echo "Running kinit"
2021
kinit -k -t "$(pwd)/.evergreen/drivers.keytab" -p ${KRB5_PRINCIPAL}
2122

.evergreen/run-kms-servers.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
cd ${DRIVERS_TOOLS}/.evergreen/csfle
22
. ./activate-kmstlsvenv.sh
33
# by default it always runs on port 5698
4-
./kmstlsvenv/bin/python3 -u kms_kmip_server.py &
5-
./kmstlsvenv/bin/python3 -u kms_http_server.py --ca_file ../x509gen/ca.pem --cert_file ../x509gen/expired.pem --port 8000 &
6-
./kmstlsvenv/bin/python3 -u kms_http_server.py --ca_file ../x509gen/ca.pem --cert_file ../x509gen/wrong-host.pem --port 8001 &
7-
./kmstlsvenv/bin/python3 -u kms_http_server.py --ca_file ../x509gen/ca.pem --cert_file ../x509gen/server.pem --port 8002 --require_client_cert &
4+
python -u kms_kmip_server.py &
5+
python -u kms_http_server.py --ca_file ../x509gen/ca.pem --cert_file ../x509gen/expired.pem --port 8000 &
6+
python -u kms_http_server.py --ca_file ../x509gen/ca.pem --cert_file ../x509gen/wrong-host.pem --port 8001 &
7+
python -u kms_http_server.py --ca_file ../x509gen/ca.pem --cert_file ../x509gen/server.pem --port 8002 --require_client_cert &

.evergreen/run-socks5-tests.sh

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ fi
1818

1919
# Grab a connection string that only refers to *one* of the hosts in MONGODB_URI
2020
FIRST_HOST=$(node -p 'new (require("mongodb-connection-string-url").default)(process.env.MONGODB_URI).hosts[0]')
21-
# Use localhost:12345 as the URL for the single host that we connect to,
21+
# Use 127.0.0.1:12345 as the URL for the single host that we connect to,
2222
# we configure the Socks5 proxy server script to redirect from this to FIRST_HOST
23-
export MONGODB_URI_SINGLEHOST="mongodb://localhost:12345/"
23+
export MONGODB_URI_SINGLEHOST="mongodb://127.0.0.1:12345/"
2424

2525
# Compute path to socks5 fake server script in a way that works on Windows
2626
SOCKS5_SERVER_SCRIPT="$DRIVERS_TOOLS/.evergreen/socks5srv.py"
@@ -29,22 +29,28 @@ if [ "Windows_NT" = "$OS" ]; then
2929
fi
3030

3131
# First, test with Socks5 + authentication required
32-
"$PYTHON_BINARY" "$SOCKS5_SERVER_SCRIPT" --port 1080 --auth username:p4ssw0rd --map "localhost:12345 to $FIRST_HOST" &
33-
PID=$!
34-
env SOCKS5_CONFIG='["localhost",1080,"username","p4ssw0rd"]' npm run check:socks5
35-
[ "$SSL" == "nossl" ] && [[ "$OSTYPE" == "linux-gnu"* ]] && \
36-
env MONGODB_URI='mongodb://localhost:12345/?proxyHost=localhost&proxyUsername=username&proxyPassword=p4ssw0rd' \
32+
"$PYTHON_BINARY" "$SOCKS5_SERVER_SCRIPT" --port 1080 --auth username:p4ssw0rd --map "127.0.0.1:12345 to $FIRST_HOST" &
33+
SOCKS5_PROXY_PID=$!
34+
if [[ $TEST_SOCKS5_CSFLE == "true" ]]; then
35+
[ "$SSL" == "nossl" ] && [[ "$OSTYPE" == "linux-gnu"* ]] && \
36+
env MONGODB_URI='mongodb://127.0.0.1:12345/?proxyHost=127.0.0.1&proxyUsername=username&proxyPassword=p4ssw0rd' \
3737
bash "${PROJECT_DIRECTORY}/.evergreen/run-custom-csfle-tests.sh"
38-
kill $PID
38+
else
39+
env SOCKS5_CONFIG='["127.0.0.1",1080,"username","p4ssw0rd"]' npm run check:socks5
40+
fi
41+
kill $SOCKS5_PROXY_PID
3942

4043
# Second, test with Socks5 + no authentication
41-
"$PYTHON_BINARY" "$SOCKS5_SERVER_SCRIPT" --port 1081 --map "localhost:12345 to $FIRST_HOST" &
42-
PID=$!
43-
env SOCKS5_CONFIG='["localhost",1081]' npm run check:socks5
44-
[ "$SSL" == "nossl" ] && [[ "$OSTYPE" == "linux-gnu"* ]] && \
45-
env MONGODB_URI='mongodb://localhost:12345/?proxyHost=localhost&proxyPort=1081' \
46-
bash "${PROJECT_DIRECTORY}/.evergreen/run-custom-csfle-tests.sh"
47-
kill $PID
44+
"$PYTHON_BINARY" "$SOCKS5_SERVER_SCRIPT" --port 1081 --map "127.0.0.1:12345 to $FIRST_HOST" &
45+
SOCKS5_PROXY_PID=$!
46+
if [[ $TEST_SOCKS5_CSFLE == "true" ]]; then
47+
[ "$SSL" == "nossl" ] && [[ "$OSTYPE" == "linux-gnu"* ]] && \
48+
env MONGODB_URI='mongodb://127.0.0.1:12345/?proxyHost=127.0.0.1&proxyPort=1081' \
49+
bash "${PROJECT_DIRECTORY}/.evergreen/run-custom-csfle-tests.sh"
50+
else
51+
env SOCKS5_CONFIG='["127.0.0.1",1081]' npm run check:socks5
52+
fi
53+
kill $SOCKS5_PROXY_PID
4854

4955
# TODO: It might be worth using something more robust to control
5056
# the Socks5 proxy server script's lifetime

.evergreen/run-tests.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ else
5252
source "$DRIVERS_TOOLS"/.evergreen/csfle/set-temp-creds.sh
5353
fi
5454

55-
npm install mongodb-client-encryption@"2.4.0-alpha.2"
55+
npm install mongodb-client-encryption@"2.5.0"
5656
npm install @mongodb-js/zstd
5757
npm install snappy
5858

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,3 +87,4 @@ etc/docs/build
8787
!docs/**/*.png
8888
!docs/**/*.css
8989
!docs/**/*.js
90+
.nvmrc

0 commit comments

Comments
 (0)