Skip to content

Commit 63ba4ac

Browse files
baileympearsondurrannbbeeken
authored
test(NODE-6101): cherry-pick test fixes from main (#4087)
Co-authored-by: Durran Jordan <[email protected]> Co-authored-by: Neal Beeken <[email protected]>
1 parent 55c290a commit 63ba4ac

File tree

98 files changed

+236
-146
lines changed

Some content is hidden

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

98 files changed

+236
-146
lines changed

.evergreen/config.in.yml

+7-22
Original file line numberDiff line numberDiff line change
@@ -1169,17 +1169,7 @@ tasks:
11691169
binary: bash
11701170
add_expansions_to_env: true
11711171
args:
1172-
- src/.evergreen/copy-driver-to-azure.sh
1173-
- command: subprocess.exec
1174-
type: test
1175-
params:
1176-
working_dir: src
1177-
binary: bash
1178-
add_expansions_to_env: true
1179-
env:
1180-
AZUREKMS_CMD: "env EXPECTED_AZUREKMS_OUTCOME=success bash src/.evergreen/run-azure-kms-tests.sh"
1181-
args:
1182-
- ${DRIVERS_TOOLS}/.evergreen/csfle/azurekms/run-command.sh
1172+
- src/.evergreen/copy-driver-to-azure-and-run.sh
11831173

11841174
- name: "test-azurekms-fail-task"
11851175
commands:
@@ -1269,14 +1259,8 @@ task_groups:
12691259
params:
12701260
working_dir: "src"
12711261
binary: bash
1272-
add_expansions_to_env: true
1273-
env:
1274-
testgcpkms_key_file: ${gcpkms_key_file}
1275-
GCPKMS_SERVICEACCOUNT: ${gcpkms_service_account}
1276-
GCPKMS_DRIVERS_TOOLS: ${DRIVERS_TOOLS}
1277-
GCPKMS_MACHINETYPE: "e2-standard-4"
12781262
args:
1279-
- .evergreen/setup-gcp-instance.sh
1263+
- ${DRIVERS_TOOLS}/.evergreen/csfle/gcpkms/setup.sh
12801264
- command: expansions.update
12811265
# Load the GCPKMS_GCLOUD, GCPKMS_INSTANCE, GCPKMS_REGION, and GCPKMS_ZONE expansions.
12821266
params:
@@ -1293,7 +1277,7 @@ task_groups:
12931277
GCPKMS_ZONE: ${GCPKMS_ZONE}
12941278
GCPKMS_INSTANCENAME: ${GCPKMS_INSTANCENAME}
12951279
args:
1296-
- ${DRIVERS_TOOLS}/.evergreen/csfle/gcpkms/delete-instance.sh
1280+
- ${DRIVERS_TOOLS}/.evergreen/csfle/gcpkms/teardown.sh
12971281
tasks:
12981282
- test-gcpkms-task
12991283

@@ -1306,9 +1290,10 @@ task_groups:
13061290
params:
13071291
working_dir: "src"
13081292
binary: bash
1309-
add_expansions_to_env: true
1293+
env:
1294+
AZUREKMS_VMNAME_PREFIX: "NODE_DRIVER"
13101295
args:
1311-
- .evergreen/setup-azure-vm.sh
1296+
- ${DRIVERS_TOOLS}/.evergreen/csfle/azurekms/setup.sh
13121297
- command: expansions.update
13131298
# Load AZUREKMS_VMNAME into the expansions.
13141299
params:
@@ -1324,7 +1309,7 @@ task_groups:
13241309
binary: bash
13251310
add_expansions_to_env: true
13261311
args:
1327-
- ${DRIVERS_TOOLS}/.evergreen/csfle/azurekms/delete-vm.sh
1312+
- ${DRIVERS_TOOLS}/.evergreen/csfle/azurekms/teardown.sh
13281313
tasks:
13291314
- test-azurekms-task
13301315

.evergreen/config.yml

+7-22
Original file line numberDiff line numberDiff line change
@@ -1125,17 +1125,7 @@ tasks:
11251125
binary: bash
11261126
add_expansions_to_env: true
11271127
args:
1128-
- src/.evergreen/copy-driver-to-azure.sh
1129-
- command: subprocess.exec
1130-
type: test
1131-
params:
1132-
working_dir: src
1133-
binary: bash
1134-
add_expansions_to_env: true
1135-
env:
1136-
AZUREKMS_CMD: env EXPECTED_AZUREKMS_OUTCOME=success bash src/.evergreen/run-azure-kms-tests.sh
1137-
args:
1138-
- ${DRIVERS_TOOLS}/.evergreen/csfle/azurekms/run-command.sh
1128+
- src/.evergreen/copy-driver-to-azure-and-run.sh
11391129
- name: test-azurekms-fail-task
11401130
commands:
11411131
- command: expansions.update
@@ -3596,14 +3586,8 @@ task_groups:
35963586
params:
35973587
working_dir: src
35983588
binary: bash
3599-
add_expansions_to_env: true
3600-
env:
3601-
testgcpkms_key_file: ${gcpkms_key_file}
3602-
GCPKMS_SERVICEACCOUNT: ${gcpkms_service_account}
3603-
GCPKMS_DRIVERS_TOOLS: ${DRIVERS_TOOLS}
3604-
GCPKMS_MACHINETYPE: e2-standard-4
36053589
args:
3606-
- .evergreen/setup-gcp-instance.sh
3590+
- ${DRIVERS_TOOLS}/.evergreen/csfle/gcpkms/setup.sh
36073591
- command: expansions.update
36083592
params:
36093593
file: src/testgcpkms-expansions.yml
@@ -3618,7 +3602,7 @@ task_groups:
36183602
GCPKMS_ZONE: ${GCPKMS_ZONE}
36193603
GCPKMS_INSTANCENAME: ${GCPKMS_INSTANCENAME}
36203604
args:
3621-
- ${DRIVERS_TOOLS}/.evergreen/csfle/gcpkms/delete-instance.sh
3605+
- ${DRIVERS_TOOLS}/.evergreen/csfle/gcpkms/teardown.sh
36223606
tasks:
36233607
- test-gcpkms-task
36243608
- name: test_azurekms_task_group
@@ -3630,9 +3614,10 @@ task_groups:
36303614
params:
36313615
working_dir: src
36323616
binary: bash
3633-
add_expansions_to_env: true
3617+
env:
3618+
AZUREKMS_VMNAME_PREFIX: NODE_DRIVER
36343619
args:
3635-
- .evergreen/setup-azure-vm.sh
3620+
- ${DRIVERS_TOOLS}/.evergreen/csfle/azurekms/setup.sh
36363621
- command: expansions.update
36373622
params:
36383623
file: src/testazurekms-expansions.yml
@@ -3645,7 +3630,7 @@ task_groups:
36453630
binary: bash
36463631
add_expansions_to_env: true
36473632
args:
3648-
- ${DRIVERS_TOOLS}/.evergreen/csfle/azurekms/delete-vm.sh
3633+
- ${DRIVERS_TOOLS}/.evergreen/csfle/azurekms/teardown.sh
36493634
tasks:
36503635
- test-azurekms-task
36513636
- name: test_atlas_task_group

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

+9-1
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
#! /usr/bin/env bash
22

33
set -o errexit
4+
source "${DRIVERS_TOOLS}/.evergreen/csfle/azurekms/secrets-export.sh"
45

56
if [ -z ${AZUREKMS_RESOURCEGROUP+omitted} ]; then echo "AZUREKMS_RESOURCEGROUP is unset" && exit 1; fi
67
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
88

99
source "${PROJECT_DIRECTORY}/.evergreen/init-node-and-npm-env.sh"
1010

11+
export AZUREKMS_PUBLICKEYPATH=/tmp/testazurekms_publickey
12+
export AZUREKMS_PRIVATEKEYPATH=/tmp/testazurekms_privatekey
13+
1114
echo "compressing node driver source ... begin"
1215
tar -czf node-driver-source.tgz src
1316
echo "compressing node driver source ... end"
@@ -22,3 +25,8 @@ echo "decompressing node driver tar on azure ... begin"
2225
export AZUREKMS_CMD="tar xf node-driver-source.tgz"
2326
"${DRIVERS_TOOLS}/.evergreen/csfle/azurekms/run-command.sh"
2427
echo "decompressing node driver tar on azure ... end"
28+
29+
echo "Running test ... begin"
30+
export AZUREKMS_CMD="env EXPECTED_AZUREKMS_OUTCOME=success bash src/.evergreen/run-azure-kms-tests.sh"
31+
${DRIVERS_TOOLS}/.evergreen/csfle/azurekms/run-command.sh
32+
echo "Running test ... end"

.evergreen/setup-azure-vm.sh

-20
This file was deleted.

.evergreen/setup-gcp-instance.sh

-9
This file was deleted.

.evergreen/setup-gcp-testing.sh

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#! /usr/bin/env bash
22

3+
source "${DRIVERS_TOOLS}/.evergreen/csfle/gcpkms/secrets-export.sh"
4+
35
# Assert required environment variables are present without printing them
46
if [ -z ${GCPKMS_GCLOUD+omitted} ]; then echo "GCPKMS_GCLOUD is unset" && exit 1; fi
57
if [ -z ${GCPKMS_PROJECT+omitted} ]; then echo "GCPKMS_PROJECT is unset" && exit 1; fi

test/integration/client-side-encryption/client_side_encryption.prose.22.range_explicit_encryption.test.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ const metaData: MongoDBMetadataUI = {
2020

2121
// The Range Explicit Encryption tests require MongoDB server 7.0+ for QE v2.
2222
// The tests must not run against a standalone.
23-
mongodb: '>=7.0.0',
23+
//
24+
// `rangePreview` is not supported on 8.0+ servers.
25+
mongodb: '>=7.0.0 <8.0.0',
2426
topology: '!single'
2527
}
2628
};
@@ -132,7 +134,7 @@ describe('Range Explicit Encryption', function () {
132134
let encryptedTwoHundred;
133135
let compareNumericValues;
134136
for (const { type: dataType, rangeOptions, factory } of dataTypes) {
135-
context(`datatype ${dataType}`, async function () {
137+
context(`datatype ${dataType}`, function () {
136138
beforeEach(async function () {
137139
compareNumericValues = function (value: unknown, expected: number): void {
138140
if (dataType === 'DoubleNoPrecision' || dataType === 'DoublePrecision') {

test/integration/crud/bulk.test.ts

+26-21
Original file line numberDiff line numberDiff line change
@@ -652,32 +652,37 @@ describe('Bulk', function () {
652652
}
653653
});
654654

655-
it('should correctly execute ordered batch using w:0', function (done) {
656-
client.connect((err, client) => {
657-
const db = client.db();
658-
const col = db.collection('batch_write_ordered_ops_9');
655+
it(
656+
'should correctly execute ordered batch using w:0',
657+
// TODO(NODE-6060): set `moreToCome` op_msg bit when `w: 0` is specified
658+
{ requires: { mongodb: '<8.0.0' } },
659+
function (done) {
660+
client.connect((err, client) => {
661+
const db = client.db();
662+
const col = db.collection('batch_write_ordered_ops_9');
659663

660-
const bulk = col.initializeOrderedBulkOp();
661-
for (let i = 0; i < 100; i++) {
662-
bulk.insert({ a: 1 });
663-
}
664+
const bulk = col.initializeOrderedBulkOp();
665+
for (let i = 0; i < 100; i++) {
666+
bulk.insert({ a: 1 });
667+
}
664668

665-
bulk.find({ b: 1 }).upsert().update({ b: 1 });
666-
bulk.find({ c: 1 }).delete();
669+
bulk.find({ b: 1 }).upsert().update({ b: 1 });
670+
bulk.find({ c: 1 }).delete();
667671

668-
bulk.execute({ writeConcern: { w: 0 } }, function (err, result) {
669-
expect(err).to.not.exist;
670-
test.equal(0, result.upsertedCount);
671-
test.equal(0, result.insertedCount);
672-
test.equal(0, result.matchedCount);
673-
test.ok(0 === result.modifiedCount || result.modifiedCount == null);
674-
test.equal(0, result.deletedCount);
675-
test.equal(false, result.hasWriteErrors());
672+
bulk.execute({ writeConcern: { w: 0 } }, function (err, result) {
673+
expect(err).to.not.exist;
674+
test.equal(0, result.upsertedCount);
675+
test.equal(0, result.insertedCount);
676+
test.equal(0, result.matchedCount);
677+
test.ok(0 === result.modifiedCount || result.modifiedCount == null);
678+
test.equal(0, result.deletedCount);
679+
test.equal(false, result.hasWriteErrors());
676680

677-
client.close(done);
681+
client.close(done);
682+
});
678683
});
679-
});
680-
});
684+
}
685+
);
681686

682687
it('should correctly handle single unordered batch API', function (done) {
683688
client.connect((err, client) => {

test/spec/client-side-encryption/tests/legacy/fle2v2-MissingKey.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
"key_vault_data": [],
5555
"tests": [
5656
{
57-
"description": "FLE2 encrypt fails with mising key",
57+
"description": "FLE2 encrypt fails with missing key",
5858
"clientOptions": {
5959
"autoEncryptOpts": {
6060
"kmsProviders": {
@@ -85,7 +85,7 @@
8585
]
8686
},
8787
{
88-
"description": "FLE2 decrypt fails with mising key",
88+
"description": "FLE2 decrypt fails with missing key",
8989
"clientOptions": {
9090
"autoEncryptOpts": {
9191
"kmsProviders": {

test/spec/client-side-encryption/tests/legacy/fle2v2-MissingKey.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ data: [
1919
encrypted_fields: {'fields': [{'keyId': {'$binary': {'base64': 'EjRWeBI0mHYSNBI0VniQEg==', 'subType': '04'}}, 'path': 'encryptedIndexed', 'bsonType': 'string', 'queries': {'queryType': 'equality', 'contention': {'$numberLong': '0'}}}, {'keyId': {'$binary': {'base64': 'q83vqxI0mHYSNBI0VniQEg==', 'subType': '04'}}, 'path': 'encryptedUnindexed', 'bsonType': 'string'}]}
2020
key_vault_data: []
2121
tests:
22-
- description: "FLE2 encrypt fails with mising key"
22+
- description: "FLE2 encrypt fails with missing key"
2323
clientOptions:
2424
autoEncryptOpts:
2525
kmsProviders:
@@ -30,7 +30,7 @@ tests:
3030
document: { _id: 1, encryptedIndexed: "123" }
3131
result:
3232
errorContains: "not all keys requested were satisfied"
33-
- description: "FLE2 decrypt fails with mising key"
33+
- description: "FLE2 decrypt fails with missing key"
3434
clientOptions:
3535
autoEncryptOpts:
3636
kmsProviders:

test/spec/client-side-encryption/tests/legacy/fle2v2-Range-Date-Aggregate.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
"replicaset",
77
"sharded",
88
"load-balanced"
9-
]
9+
],
10+
"maxServerVersion": "7.99.99"
1011
}
1112
],
1213
"database_name": "default",

test/spec/client-side-encryption/tests/legacy/fle2v2-Range-Date-Aggregate.yml

+2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ runOn:
55
# Skip QEv2 (also referred to as FLE2v2) tests on Serverless. Unskip once Serverless enables the QEv2 protocol.
66
# FLE 2 Encrypted collections are not supported on standalone.
77
topology: [ "replicaset", "sharded", "load-balanced" ]
8+
# Skip tests for "rangePreview" algorithm on Server 8.0+. Server 8.0 drops "rangePreview" and adds "range".
9+
maxServerVersion: "7.99.99"
810
database_name: &database_name "default"
911
collection_name: &collection_name "default"
1012
data: []

test/spec/client-side-encryption/tests/legacy/fle2v2-Range-Date-Correctness.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
"replicaset",
77
"sharded",
88
"load-balanced"
9-
]
9+
],
10+
"maxServerVersion": "7.99.99"
1011
}
1112
],
1213
"database_name": "default",

test/spec/client-side-encryption/tests/legacy/fle2v2-Range-Date-Correctness.yml

+2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ runOn:
77
# Skip QEv2 (also referred to as FLE2v2) tests on Serverless. Unskip once Serverless enables the QEv2 protocol.
88
# FLE 2 Encrypted collections are not supported on standalone.
99
topology: [ "replicaset", "sharded", "load-balanced" ]
10+
# Skip tests for "rangePreview" algorithm on Server 8.0+. Server 8.0 drops "rangePreview" and adds "range".
11+
maxServerVersion: "7.99.99"
1012
database_name: &database_name "default"
1113
collection_name: &collection_name "default"
1214
data: []

test/spec/client-side-encryption/tests/legacy/fle2v2-Range-Date-Delete.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
"replicaset",
77
"sharded",
88
"load-balanced"
9-
]
9+
],
10+
"maxServerVersion": "7.99.99"
1011
}
1112
],
1213
"database_name": "default",

test/spec/client-side-encryption/tests/legacy/fle2v2-Range-Date-Delete.yml

+2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ runOn:
55
# Skip QEv2 (also referred to as FLE2v2) tests on Serverless. Unskip once Serverless enables the QEv2 protocol.
66
# FLE 2 Encrypted collections are not supported on standalone.
77
topology: [ "replicaset", "sharded", "load-balanced" ]
8+
# Skip tests for "rangePreview" algorithm on Server 8.0+. Server 8.0 drops "rangePreview" and adds "range".
9+
maxServerVersion: "7.99.99"
810
database_name: &database_name "default"
911
collection_name: &collection_name "default"
1012
data: []

test/spec/client-side-encryption/tests/legacy/fle2v2-Range-Date-FindOneAndUpdate.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
"replicaset",
77
"sharded",
88
"load-balanced"
9-
]
9+
],
10+
"maxServerVersion": "7.99.99"
1011
}
1112
],
1213
"database_name": "default",

test/spec/client-side-encryption/tests/legacy/fle2v2-Range-Date-FindOneAndUpdate.yml

+2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ runOn:
55
# Skip QEv2 (also referred to as FLE2v2) tests on Serverless. Unskip once Serverless enables the QEv2 protocol.
66
# FLE 2 Encrypted collections are not supported on standalone.
77
topology: [ "replicaset", "sharded", "load-balanced" ]
8+
# Skip tests for "rangePreview" algorithm on Server 8.0+. Server 8.0 drops "rangePreview" and adds "range".
9+
maxServerVersion: "7.99.99"
810
database_name: &database_name "default"
911
collection_name: &collection_name "default"
1012
data: []

test/spec/client-side-encryption/tests/legacy/fle2v2-Range-Date-InsertFind.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
"replicaset",
77
"sharded",
88
"load-balanced"
9-
]
9+
],
10+
"maxServerVersion": "7.99.99"
1011
}
1112
],
1213
"database_name": "default",

0 commit comments

Comments
 (0)