Skip to content

Commit 48dbd16

Browse files
committed
test fixes
1 parent 610db96 commit 48dbd16

File tree

3 files changed

+223
-1
lines changed

3 files changed

+223
-1
lines changed

test/integration/client-side-operations-timeout/client_side_operations_timeout.spec.test.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1+
import * as util from 'node:util';
2+
13
import { join } from 'path';
24
import * as semver from 'semver';
35

46
import { loadSpecTests } from '../../spec';
57
import { runUnifiedSuite } from '../../tools/unified-spec-runner/runner';
8+
util.inspect.defaultOptions.depth = 5;
69

710
const skippedSpecs = {};
811

@@ -22,7 +25,8 @@ const skippedTests = {
2225
'TODO(DRIVERS-2970): see modified test in unified-csot-node-specs',
2326
'timeoutMS is refreshed for getMore - failure':
2427
'TODO(DRIVERS-2965): see modified test in unified-csot-node-specs', // Skipping for both tailable awaitData and tailable non-awaitData cursors
25-
'timeoutMS applies to full resume attempt in a next call': 'TODO(DRIVERS-3006)'
28+
'timeoutMS applies to full resume attempt in a next call': 'TODO(DRIVERS-3006)',
29+
'timeoutMS is refreshed for getMore if maxAwaitTimeMS is set': 'TODO(DRIVERS-XXXX)'
2630
};
2731

2832
describe('CSOT spec tests', function () {
Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
{
2+
"description": "timeoutMS behaves correctly for change streams",
3+
"schemaVersion": "1.9",
4+
"runOnRequirements": [
5+
{
6+
"minServerVersion": "4.4",
7+
"topologies": [
8+
"replicaset",
9+
"sharded"
10+
]
11+
}
12+
],
13+
"createEntities": [
14+
{
15+
"client": {
16+
"id": "failPointClient",
17+
"useMultipleMongoses": false
18+
}
19+
},
20+
{
21+
"client": {
22+
"id": "client",
23+
"useMultipleMongoses": false,
24+
"observeEvents": [
25+
"commandStartedEvent"
26+
],
27+
"ignoreCommandMonitoringEvents": [
28+
"killCursors"
29+
]
30+
}
31+
},
32+
{
33+
"database": {
34+
"id": "database",
35+
"client": "client",
36+
"databaseName": "test"
37+
}
38+
},
39+
{
40+
"collection": {
41+
"id": "collection",
42+
"database": "database",
43+
"collectionName": "coll"
44+
}
45+
}
46+
],
47+
"initialData": [
48+
{
49+
"collectionName": "coll",
50+
"databaseName": "test",
51+
"documents": []
52+
}
53+
],
54+
"tests": [
55+
{
56+
"description": "timeoutMS is refreshed for getMore if maxAwaitTimeMS is set",
57+
"operations": [
58+
{
59+
"name": "failPoint",
60+
"object": "testRunner",
61+
"arguments": {
62+
"client": "failPointClient",
63+
"failPoint": {
64+
"configureFailPoint": "failCommand",
65+
"mode": {
66+
"times": 2
67+
},
68+
"data": {
69+
"failCommands": [
70+
"aggregate",
71+
"getMore"
72+
],
73+
"blockConnection": true,
74+
"blockTimeMS": 150
75+
}
76+
}
77+
}
78+
},
79+
{
80+
"name": "createChangeStream",
81+
"object": "collection",
82+
"arguments": {
83+
"pipeline": [],
84+
"timeoutMS": 200,
85+
"batchSize": 2,
86+
"maxAwaitTimeMS": 10
87+
},
88+
"saveResultAsEntity": "changeStream"
89+
},
90+
{
91+
"name": "iterateOnce",
92+
"object": "changeStream"
93+
}
94+
],
95+
"expectEvents": [
96+
{
97+
"client": "client",
98+
"events": [
99+
{
100+
"commandStartedEvent": {
101+
"commandName": "aggregate",
102+
"databaseName": "test",
103+
"command": {
104+
"aggregate": "coll",
105+
"maxTimeMS": {
106+
"$$type": [
107+
"int",
108+
"long"
109+
]
110+
}
111+
}
112+
}
113+
},
114+
{
115+
"commandStartedEvent": {
116+
"commandName": "getMore",
117+
"databaseName": "test",
118+
"command": {
119+
"getMore": {
120+
"$$type": [
121+
"int",
122+
"long"
123+
]
124+
},
125+
"collection": "coll",
126+
"maxTimeMS": 10
127+
}
128+
}
129+
}
130+
]
131+
}
132+
]
133+
}
134+
]
135+
}

test/integration/client-side-operations-timeout/unified-csot-node-specs/tailable-awaitData.json

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,89 @@
141141
]
142142
}
143143
]
144+
},
145+
{
146+
"description": "timeoutMS is refreshed for getMore if maxAwaitTimeMS is set",
147+
"operations": [
148+
{
149+
"name": "failPoint",
150+
"object": "testRunner",
151+
"arguments": {
152+
"client": "failPointClient",
153+
"failPoint": {
154+
"configureFailPoint": "failCommand",
155+
"mode": {
156+
"times": 2
157+
},
158+
"data": {
159+
"failCommands": [
160+
"find",
161+
"getMore"
162+
],
163+
"blockConnection": true,
164+
"blockTimeMS": 150
165+
}
166+
}
167+
}
168+
},
169+
{
170+
"name": "createFindCursor",
171+
"object": "collection",
172+
"arguments": {
173+
"filter": {},
174+
"cursorType": "tailableAwait",
175+
"timeoutMS": 250,
176+
"batchSize": 1,
177+
"maxAwaitTimeMS": 10
178+
},
179+
"saveResultAsEntity": "tailableCursor"
180+
},
181+
{
182+
"name": "iterateUntilDocumentOrError",
183+
"object": "tailableCursor"
184+
},
185+
{
186+
"name": "iterateUntilDocumentOrError",
187+
"object": "tailableCursor"
188+
}
189+
],
190+
"expectEvents": [
191+
{
192+
"client": "client",
193+
"events": [
194+
{
195+
"commandStartedEvent": {
196+
"commandName": "find",
197+
"databaseName": "test",
198+
"command": {
199+
"find": "coll",
200+
"tailable": true,
201+
"awaitData": true,
202+
"maxTimeMS": {
203+
"$$exists": true
204+
}
205+
}
206+
}
207+
},
208+
{
209+
"commandStartedEvent": {
210+
"commandName": "getMore",
211+
"databaseName": "test",
212+
"command": {
213+
"getMore": {
214+
"$$type": [
215+
"int",
216+
"long"
217+
]
218+
},
219+
"collection": "coll",
220+
"maxTimeMS": 10
221+
}
222+
}
223+
}
224+
]
225+
}
226+
]
144227
}
145228
]
146229
}

0 commit comments

Comments
 (0)