Skip to content

Commit d3c2d72

Browse files
authored
RUBY-3058 sync causal consistency test (#2667)
1 parent 8b9387e commit d3c2d72

File tree

1 file changed

+119
-0
lines changed

1 file changed

+119
-0
lines changed
Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
description: "implicit sessions default causal consistency"
2+
3+
schemaVersion: "1.3"
4+
5+
runOnRequirements:
6+
- minServerVersion: "4.2"
7+
topologies: [replicaset, sharded, load-balanced]
8+
9+
createEntities:
10+
- client:
11+
id: &client0 client0
12+
useMultipleMongoses: false
13+
observeEvents: [commandStartedEvent]
14+
- database:
15+
id: &database0 database0
16+
client: *client0
17+
databaseName: &databaseName implicit-cc-tests
18+
- collection:
19+
id: &collectionDefault collectionDefault
20+
database: *database0
21+
collectionName: &collectionNameDefault coll-default
22+
- collection:
23+
id: &collectionSnapshot collectionSnapshot
24+
database: *database0
25+
collectionName: &collectionNameSnapshot coll-snapshot
26+
collectionOptions:
27+
readConcern: { level: snapshot }
28+
- collection:
29+
id: &collectionlinearizable collectionlinearizable
30+
database: *database0
31+
collectionName: &collectionNamelinearizable coll-linearizable
32+
collectionOptions:
33+
readConcern: { level: linearizable }
34+
35+
initialData:
36+
- collectionName: *collectionNameDefault
37+
databaseName: *databaseName
38+
documents:
39+
- { _id: 1, x: default }
40+
- collectionName: *collectionNameSnapshot
41+
databaseName: *databaseName
42+
documents:
43+
- { _id: 1, x: snapshot }
44+
- collectionName: *collectionNamelinearizable
45+
databaseName: *databaseName
46+
documents:
47+
- { _id: 1, x: linearizable }
48+
49+
tests:
50+
- description: "readConcern is not sent on retried read in implicit session when readConcern level is not specified"
51+
operations:
52+
- &failPointCommand
53+
name: failPoint
54+
object: testRunner
55+
arguments:
56+
client: *client0
57+
failPoint:
58+
configureFailPoint: failCommand
59+
mode: { times: 1 }
60+
data:
61+
failCommands: [find]
62+
errorCode: 11600 #InterruptedAtShutdown
63+
- name: find
64+
object: *collectionDefault
65+
arguments:
66+
filter: {}
67+
expectResult: [{ _id: 1, x: default }]
68+
expectEvents:
69+
- client: *client0
70+
events:
71+
- commandStartedEvent: &commandStartedEventDefault
72+
command:
73+
find: *collectionNameDefault
74+
filter: {}
75+
readConcern: { $$exists: false }
76+
databaseName: *databaseName
77+
- commandStartedEvent: *commandStartedEventDefault
78+
79+
- description: "afterClusterTime is not sent on retried read in implicit session when readConcern level is snapshot"
80+
runOnRequirements:
81+
- minServerVersion: "5.0"
82+
operations:
83+
- *failPointCommand
84+
- name: find
85+
object: *collectionSnapshot
86+
arguments:
87+
filter: {}
88+
expectResult: [{ _id: 1, x: snapshot }]
89+
expectEvents:
90+
- client: *client0
91+
events:
92+
- commandStartedEvent: &commandStartedEventSnapshot
93+
command:
94+
find: *collectionNameSnapshot
95+
filter: {}
96+
readConcern:
97+
{ level: snapshot, afterClusterTime: { $$exists: false } }
98+
databaseName: *databaseName
99+
- commandStartedEvent: *commandStartedEventSnapshot
100+
101+
- description: "afterClusterTime is not sent on retried read in implicit session when readConcern level is linearizable"
102+
operations:
103+
- *failPointCommand
104+
- name: find
105+
object: *collectionlinearizable
106+
arguments:
107+
filter: {}
108+
expectResult: [{ _id: 1, x: linearizable }]
109+
expectEvents:
110+
- client: *client0
111+
events:
112+
- commandStartedEvent: &commandStartedEventLinearizable
113+
command:
114+
find: *collectionNamelinearizable
115+
filter: {}
116+
readConcern:
117+
{ level: linearizable, afterClusterTime: { $$exists: false } }
118+
databaseName: *databaseName
119+
- commandStartedEvent: *commandStartedEventLinearizable

0 commit comments

Comments
 (0)