Skip to content

Commit 2f67139

Browse files
test(NODE-7129): sync CRUD spec tests to latest (#4643)
1 parent d03a6bd commit 2f67139

18 files changed

+2941
-2
lines changed

test/integration/crud/crud.spec.test.ts

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,33 @@ const loadBalancedCollationTests = [
3939
'Distinct with a collation'
4040
];
4141

42+
const unimplementedCrudTests = {
43+
'inserting _id with type null via clientBulkWrite':
44+
'TODO(NODE-6468): Test that inserts and upserts respect null _id values (DRIVERS-2124)',
45+
'inserting _id with type null via insertOne':
46+
'TODO(NODE-6468): Test that inserts and upserts respect null _id values (DRIVERS-2124)',
47+
'inserting _id with type null via insertMany':
48+
'TODO(NODE-6468): Test that inserts and upserts respect null _id values (DRIVERS-2124)',
49+
'inserting _id with type null via bulkWrite':
50+
'TODO(NODE-6468): Test that inserts and upserts respect null _id values (DRIVERS-2124)',
51+
'partialResult is unset when all operations fail during an unordered bulk write':
52+
'TODO(NODE-6384): do not set partialResult when using unacknowledged writes',
53+
'partialResult is unset when first operation fails during an ordered bulk write (summary)':
54+
'TODO(NODE-6384): do not set partialResult when using unacknowledged writes',
55+
'partialResult is unset when first operation fails during an ordered bulk write (verbose)':
56+
'TODO(NODE-6384): do not set partialResult when using unacknowledged writes',
57+
'InsertMany passes bypassDocumentValidation: false':
58+
'TODO(NODE-6484): Allow drivers to set bypassDocumentValidation: false on write commands (DRIVERS-2865)',
59+
'FindOneAndUpdate passes bypassDocumentValidation: false':
60+
'TODO(NODE-6484): Allow drivers to set bypassDocumentValidation: false on write commands (DRIVERS-2865)',
61+
'FindOneAndReplace passes bypassDocumentValidation: false':
62+
'TODO(NODE-6484): Allow drivers to set bypassDocumentValidation: false on write commands (DRIVERS-2865)',
63+
'BulkWrite passes bypassDocumentValidation: false':
64+
'TODO(NODE-6484): Allow drivers to set bypassDocumentValidation: false on write commands (DRIVERS-2865)',
65+
'Aggregate with $out passes bypassDocumentValidation: false':
66+
'TODO(NODE-6484): Allow drivers to set bypassDocumentValidation: false on write commands (DRIVERS-2865)'
67+
};
68+
4269
describe('CRUD unified', function () {
4370
runUnifiedSuite(
4471
loadSpecTests(path.join('crud', 'unified')),
@@ -47,7 +74,9 @@ describe('CRUD unified', function () {
4774
? `TODO(NODE-3541)`
4875
: isLoadBalanced && loadBalancedCollationTests.includes(description)
4976
? `TODO(NODE-6280): fix collation for find and modify commands on load balanced mode`
50-
: false;
77+
: description in unimplementedCrudTests
78+
? unimplementedCrudTests[description]
79+
: false;
5180
}
5281
);
5382
});
Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
{
2+
"description": "bulkWrite-updateMany-pipeline",
3+
"schemaVersion": "1.0",
4+
"runOnRequirements": [
5+
{
6+
"minServerVersion": "4.1.11"
7+
}
8+
],
9+
"createEntities": [
10+
{
11+
"client": {
12+
"id": "client0",
13+
"observeEvents": [
14+
"commandStartedEvent"
15+
]
16+
}
17+
},
18+
{
19+
"database": {
20+
"id": "database0",
21+
"client": "client0",
22+
"databaseName": "crud-tests"
23+
}
24+
},
25+
{
26+
"collection": {
27+
"id": "collection0",
28+
"database": "database0",
29+
"collectionName": "test"
30+
}
31+
}
32+
],
33+
"initialData": [
34+
{
35+
"collectionName": "test",
36+
"databaseName": "crud-tests",
37+
"documents": [
38+
{
39+
"_id": 1,
40+
"x": 1,
41+
"y": 1,
42+
"t": {
43+
"u": {
44+
"v": 1
45+
}
46+
}
47+
},
48+
{
49+
"_id": 2,
50+
"x": 2,
51+
"y": 1
52+
}
53+
]
54+
}
55+
],
56+
"tests": [
57+
{
58+
"description": "UpdateMany in bulk write using pipelines",
59+
"operations": [
60+
{
61+
"object": "collection0",
62+
"name": "bulkWrite",
63+
"arguments": {
64+
"requests": [
65+
{
66+
"updateMany": {
67+
"filter": {},
68+
"update": [
69+
{
70+
"$project": {
71+
"x": 1
72+
}
73+
},
74+
{
75+
"$addFields": {
76+
"foo": 1
77+
}
78+
}
79+
]
80+
}
81+
}
82+
]
83+
},
84+
"expectResult": {
85+
"matchedCount": 2,
86+
"modifiedCount": 2,
87+
"upsertedCount": 0
88+
}
89+
}
90+
],
91+
"expectEvents": [
92+
{
93+
"client": "client0",
94+
"events": [
95+
{
96+
"commandStartedEvent": {
97+
"command": {
98+
"update": "test",
99+
"updates": [
100+
{
101+
"q": {},
102+
"u": [
103+
{
104+
"$project": {
105+
"x": 1
106+
}
107+
},
108+
{
109+
"$addFields": {
110+
"foo": 1
111+
}
112+
}
113+
],
114+
"multi": true,
115+
"upsert": {
116+
"$$unsetOrMatches": false
117+
}
118+
}
119+
]
120+
},
121+
"commandName": "update",
122+
"databaseName": "crud-tests"
123+
}
124+
}
125+
]
126+
}
127+
],
128+
"outcome": [
129+
{
130+
"collectionName": "test",
131+
"databaseName": "crud-tests",
132+
"documents": [
133+
{
134+
"_id": 1,
135+
"x": 1,
136+
"foo": 1
137+
},
138+
{
139+
"_id": 2,
140+
"x": 2,
141+
"foo": 1
142+
}
143+
]
144+
}
145+
]
146+
}
147+
]
148+
}
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
description: bulkWrite-updateMany-pipeline
2+
3+
schemaVersion: '1.0'
4+
5+
runOnRequirements:
6+
- minServerVersion: 4.1.11
7+
8+
createEntities:
9+
- client:
10+
id: &client0 client0
11+
observeEvents:
12+
- commandStartedEvent
13+
- database:
14+
id: &database0 database0
15+
client: client0
16+
databaseName: &database_name crud-tests
17+
- collection:
18+
id: &collection0 collection0
19+
database: database0
20+
collectionName: &collection_name test
21+
22+
initialData:
23+
- collectionName: *collection_name
24+
databaseName: *database_name
25+
documents:
26+
- { _id: 1, x: 1, y: 1, t: { u: { v: 1 } } }
27+
- { _id: 2, x: 2, y: 1 }
28+
29+
tests:
30+
-
31+
description: 'UpdateMany in bulk write using pipelines'
32+
operations:
33+
- object: *collection0
34+
name: bulkWrite
35+
arguments:
36+
requests:
37+
- updateMany:
38+
filter: { }
39+
update:
40+
- { $project: { x: 1 } }
41+
- { $addFields: { foo: 1 } }
42+
expectResult:
43+
matchedCount: 2
44+
modifiedCount: 2
45+
upsertedCount: 0
46+
expectEvents:
47+
- client: *client0
48+
events:
49+
- commandStartedEvent:
50+
command:
51+
update: *collection_name
52+
updates:
53+
- q: { }
54+
u:
55+
- { $project: { x: 1 } }
56+
- { $addFields: { foo: 1 } }
57+
multi: true
58+
upsert: { $$unsetOrMatches: false }
59+
commandName: update
60+
databaseName: *database_name
61+
outcome:
62+
-
63+
collectionName: *collection_name
64+
databaseName: *database_name
65+
documents:
66+
- { _id: 1, x: 1, foo: 1 }
67+
- { _id: 2, x: 2, foo: 1 }

0 commit comments

Comments
 (0)