Skip to content

Commit a124e21

Browse files
authored
DRIVERS-1237: Do not rely on dotted field for client-side error (#1011)
Since dots/dollars are no longer prohibited, these tests can use update/replace validation to yield a client-side error.
1 parent 39ccfce commit a124e21

File tree

4 files changed

+31
-28
lines changed

4 files changed

+31
-28
lines changed

source/transactions/tests/legacy/errors-client.json

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,15 @@
2525
"object": "session0"
2626
},
2727
{
28-
"name": "insertOne",
28+
"name": "updateOne",
2929
"object": "collection",
3030
"arguments": {
3131
"session": "session0",
32-
"document": {
33-
"_id": {
34-
".": "."
35-
}
32+
"filter": {
33+
"_id": 1
34+
},
35+
"update": {
36+
"x": 1
3637
}
3738
},
3839
"error": true
@@ -60,22 +61,23 @@
6061
"arguments": {
6162
"session": "session0",
6263
"document": {
63-
"_id": 4
64+
"_id": 1
6465
}
6566
},
6667
"result": {
67-
"insertedId": 4
68+
"insertedId": 1
6869
}
6970
},
7071
{
71-
"name": "insertOne",
72+
"name": "updateOne",
7273
"object": "collection",
7374
"arguments": {
7475
"session": "session0",
75-
"document": {
76-
"_id": {
77-
".": "."
78-
}
76+
"filter": {
77+
"_id": 1
78+
},
79+
"update": {
80+
"x": 1
7981
}
8082
},
8183
"error": true

source/transactions/tests/legacy/errors-client.yml

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ tests:
1616
operations:
1717
- name: startTransaction
1818
object: session0
19-
- name: insertOne
19+
- name: updateOne
2020
object: collection
2121
arguments:
2222
session: session0
23-
document:
24-
_id: {.: .}
23+
filter: { _id: 1 }
24+
update: { x: 1 }
2525
error: true
2626
- name: assertSessionTransactionState
2727
object: testRunner
@@ -38,16 +38,15 @@ tests:
3838
object: collection
3939
arguments:
4040
session: session0
41-
document:
42-
_id: 4
41+
document: { _id: 1 }
4342
result:
44-
insertedId: 4
45-
- name: insertOne
43+
insertedId: 1
44+
- name: updateOne
4645
object: collection
4746
arguments:
4847
session: session0
49-
document:
50-
_id: {.: .}
48+
filter: { _id: 1 }
49+
update: { x: 1 }
5150
error: true
5251
- name: assertSessionTransactionState
5352
object: testRunner

source/unified-test-format/tests/valid-pass/poc-transactions.json

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,14 +61,15 @@
6161
"object": "session0"
6262
},
6363
{
64-
"name": "insertOne",
64+
"name": "updateOne",
6565
"object": "collection0",
6666
"arguments": {
6767
"session": "session0",
68-
"document": {
69-
"_id": {
70-
".": "."
71-
}
68+
"filter": {
69+
"_id": 1
70+
},
71+
"update": {
72+
"x": 1
7273
}
7374
},
7475
"expectError": {

source/unified-test-format/tests/valid-pass/poc-transactions.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,12 @@ tests:
3434
operations:
3535
- name: startTransaction
3636
object: *session0
37-
- name: insertOne
37+
- name: updateOne
3838
object: *collection0
3939
arguments:
4040
session: *session0
41-
document: { _id: { .: . } }
41+
filter: { _id: 1 }
42+
update: { x: 1 }
4243
# Original test only asserted a generic error
4344
expectError: { isClientError: true }
4445
- name: assertSessionTransactionState

0 commit comments

Comments
 (0)