Skip to content

Commit 1261432

Browse files
authored
feat(NODE-1837): add zstd compression option (#3237)
1 parent 981465c commit 1261432

File tree

11 files changed

+361
-5
lines changed

11 files changed

+361
-5
lines changed

.evergreen/config.in.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ functions:
101101
ORCHESTRATION_FILE=${ORCHESTRATION_FILE} \
102102
REQUIRE_API_VERSION=${REQUIRE_API_VERSION} \
103103
LOAD_BALANCER=${LOAD_BALANCER} \
104+
COMPRESSOR=${COMPRESSOR} \
104105
bash ${DRIVERS_TOOLS}/.evergreen/run-orchestration.sh
105106
# run-orchestration generates expansion file with the MONGODB_URI for the cluster
106107
- command: expansions.update
@@ -239,6 +240,26 @@ functions:
239240
LOAD_BALANCER="${LOAD_BALANCER}" \
240241
bash ${PROJECT_DIRECTORY}/.evergreen/run-tests.sh
241242
243+
"run-compression-tests":
244+
- command: shell.exec
245+
type: test
246+
params:
247+
working_dir: src
248+
timeout_secs: 300
249+
script: |
250+
${PREPARE_SHELL}
251+
252+
MONGODB_URI="${MONGODB_URI}" \
253+
AUTH=${AUTH} \
254+
SSL=${SSL} \
255+
MONGODB_API_VERSION="${MONGODB_API_VERSION}" \
256+
NODE_VERSION=${NODE_VERSION} \
257+
TOPOLOGY="${TOPOLOGY}" \
258+
COMPRESSOR="${COMPRESSOR}" \
259+
SKIP_DEPS=${SKIP_DEPS|1} \
260+
NO_EXIT=${NO_EXIT|1} \
261+
bash ${PROJECT_DIRECTORY}/.evergreen/run-tests.sh
262+
242263
"run lint checks":
243264
- command: subprocess.exec
244265
type: test

.evergreen/config.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ functions:
8484
ORCHESTRATION_FILE=${ORCHESTRATION_FILE} \
8585
REQUIRE_API_VERSION=${REQUIRE_API_VERSION} \
8686
LOAD_BALANCER=${LOAD_BALANCER} \
87+
COMPRESSOR=${COMPRESSOR} \
8788
bash ${DRIVERS_TOOLS}/.evergreen/run-orchestration.sh
8889
- command: expansions.update
8990
params:
@@ -214,6 +215,25 @@ functions:
214215
NO_EXIT=${NO_EXIT|1} \
215216
LOAD_BALANCER="${LOAD_BALANCER}" \
216217
bash ${PROJECT_DIRECTORY}/.evergreen/run-tests.sh
218+
run-compression-tests:
219+
- command: shell.exec
220+
type: test
221+
params:
222+
working_dir: src
223+
timeout_secs: 300
224+
script: |
225+
${PREPARE_SHELL}
226+
227+
MONGODB_URI="${MONGODB_URI}" \
228+
AUTH=${AUTH} \
229+
SSL=${SSL} \
230+
MONGODB_API_VERSION="${MONGODB_API_VERSION}" \
231+
NODE_VERSION=${NODE_VERSION} \
232+
TOPOLOGY="${TOPOLOGY}" \
233+
COMPRESSOR="${COMPRESSOR}" \
234+
SKIP_DEPS=${SKIP_DEPS|1} \
235+
NO_EXIT=${NO_EXIT|1} \
236+
bash ${PROJECT_DIRECTORY}/.evergreen/run-tests.sh
217237
run lint checks:
218238
- command: subprocess.exec
219239
type: test
@@ -1154,6 +1174,32 @@ tasks:
11541174
- func: run socks5 tests
11551175
vars:
11561176
SSL: ssl
1177+
- name: test-zstd-compression
1178+
tags:
1179+
- latest
1180+
- zstd
1181+
commands:
1182+
- func: install dependencies
1183+
- func: bootstrap mongo-orchestration
1184+
vars:
1185+
VERSION: latest
1186+
TOPOLOGY: replica_set
1187+
AUTH: auth
1188+
COMPRESSOR: zstd
1189+
- func: run-compression-tests
1190+
- name: test-snappy-compression
1191+
tags:
1192+
- latest
1193+
- snappy
1194+
commands:
1195+
- func: install dependencies
1196+
- func: bootstrap mongo-orchestration
1197+
vars:
1198+
VERSION: latest
1199+
TOPOLOGY: replica_set
1200+
AUTH: auth
1201+
COMPRESSOR: snappy
1202+
- func: run-compression-tests
11571203
- name: test-tls-support-latest
11581204
tags:
11591205
- tls-support
@@ -1964,6 +2010,8 @@ buildvariants:
19642010
- test-auth-ldap
19652011
- test-socks5
19662012
- test-socks5-tls
2013+
- test-zstd-compression
2014+
- test-snappy-compression
19672015
- test-tls-support-latest
19682016
- test-tls-support-6.0
19692017
- test-tls-support-5.0
@@ -2019,6 +2067,8 @@ buildvariants:
20192067
- test-auth-ldap
20202068
- test-socks5
20212069
- test-socks5-tls
2070+
- test-zstd-compression
2071+
- test-snappy-compression
20222072
- test-tls-support-latest
20232073
- test-tls-support-6.0
20242074
- test-tls-support-5.0
@@ -2070,6 +2120,8 @@ buildvariants:
20702120
- test-atlas-data-lake
20712121
- test-socks5
20722122
- test-socks5-tls
2123+
- test-zstd-compression
2124+
- test-snappy-compression
20732125
- test-tls-support-latest
20742126
- test-tls-support-6.0
20752127
- test-tls-support-5.0

.evergreen/generate_evergreen_tasks.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,26 @@ TASKS.push(
189189
]
190190
);
191191

192+
['zstd', 'snappy'].forEach(compressor => {
193+
TASKS.push({
194+
name: `test-${compressor}-compression`,
195+
tags: ['latest', compressor],
196+
commands: [
197+
{ func: 'install dependencies' },
198+
{
199+
func: 'bootstrap mongo-orchestration',
200+
vars: {
201+
VERSION: 'latest',
202+
TOPOLOGY: 'replica_set',
203+
AUTH: 'auth',
204+
COMPRESSOR: compressor
205+
}
206+
},
207+
{ func: 'run-compression-tests' }
208+
]
209+
});
210+
});
211+
192212
TLS_VERSIONS.forEach(VERSION => {
193213
TASKS.push({
194214
name: `test-tls-support-${VERSION}`,

.evergreen/run-tests.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ set -o errexit # Exit the script with error if any of the commands fail
1515
AUTH=${AUTH:-noauth}
1616
MONGODB_URI=${MONGODB_URI:-}
1717
TEST_NPM_SCRIPT=${TEST_NPM_SCRIPT:-check:integration-coverage}
18+
COMPRESSOR=${COMPRESSOR:-}
1819
if [[ -z "${NO_EXIT}" ]]; then
1920
TEST_NPM_SCRIPT="$TEST_NPM_SCRIPT -- --exit"
2021
fi
@@ -35,6 +36,14 @@ else
3536
source "${PROJECT_DIRECTORY}/.evergreen/init-nvm.sh"
3637
fi
3738

39+
if [ "$COMPRESSOR" != "" ]; then
40+
if [[ "$MONGODB_URI" == *"?"* ]]; then
41+
export MONGODB_URI="${MONGODB_URI}&compressors=${COMPRESSOR}"
42+
else
43+
export MONGODB_URI="${MONGODB_URI}/?compressors=${COMPRESSOR}"
44+
fi
45+
fi
46+
3847
# only run FLE tets on hosts we explicitly choose to test on
3948
if [[ -z "${CLIENT_ENCRYPTION}" ]]; then
4049
unset AWS_ACCESS_KEY_ID;
@@ -48,6 +57,8 @@ else
4857
fi
4958

5059
npm install mongodb-client-encryption@">=2.2.0-alpha.0"
60+
npm install @mongodb-js/zstd
61+
npm install snappy
5162

5263
export AUTH=$AUTH
5364
export SINGLE_MONGOS_LB_URI=${SINGLE_MONGOS_LB_URI}
@@ -56,5 +67,6 @@ export MONGODB_API_VERSION=${MONGODB_API_VERSION}
5667
export MONGODB_URI=${MONGODB_URI}
5768
export LOAD_BALANCER=${LOAD_BALANCER}
5869
export TEST_CSFLE=${TEST_CSFLE}
70+
export COMPRESSOR=${COMPRESSOR}
5971
# Do not add quotes, due to the way NO_EXIT is handled
6072
npm run ${TEST_NPM_SCRIPT}

package-lock.json

Lines changed: 145 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
"@istanbuljs/nyc-config-typescript": "^1.0.2",
3636
"@microsoft/api-extractor": "^7.20.0",
3737
"@microsoft/tsdoc-config": "^0.15.2",
38+
"@mongodb-js/zstd": "^1.0.0",
3839
"@types/chai": "^4.3.0",
3940
"@types/chai-subset": "^1.3.3",
4041
"@types/express": "^4.17.13",

0 commit comments

Comments
 (0)