Debian Codegraph @

testdata/retryable-reads/mapReduce.json

raw
1 {
2 "runOn": [
3 {
4 "minServerVersion": "4.0",
5 "topology": [
6 "single",
7 "replicaset"
8 ]
9 },
10 {
11 "minServerVersion": "4.1.7",
12 "topology": [
13 "sharded",
14 "load-balanced"
15 ]
16 }
17 ],
18 "database_name": "retryable-reads-tests",
19 "collection_name": "coll",
20 "data": [
21 {
22 "_id": 1,
23 "x": 0
24 },
25 {
26 "_id": 2,
27 "x": 1
28 },
29 {
30 "_id": 3,
31 "x": 2
32 }
33 ],
34 "tests": [
35 {
36 "description": "MapReduce succeeds with retry on",
37 "operations": [
38 {
39 "name": "mapReduce",
40 "object": "collection",
41 "arguments": {
42 "map": {
43 "$code": "function inc() { return emit(0, this.x + 1) }"
44 },
45 "reduce": {
46 "$code": "function sum(key, values) { return values.reduce((acc, x) => acc + x); }"
47 },
48 "out": {
49 "inline": 1
50 }
51 },
52 "result": [
53 {
54 "_id": 0,
55 "value": 6
56 }
57 ]
58 }
59 ],
60 "expectations": [
61 {
62 "command_started_event": {
63 "command": {
64 "mapReduce": "coll",
65 "map": {
66 "$code": "function inc() { return emit(0, this.x + 1) }"
67 },
68 "reduce": {
69 "$code": "function sum(key, values) { return values.reduce((acc, x) => acc + x); }"
70 },
71 "out": {
72 "inline": 1
73 }
74 },
75 "database_name": "retryable-reads-tests"
76 }
77 }
78 ]
79 },
80 {
81 "description": "MapReduce fails with retry on",
82 "failPoint": {
83 "configureFailPoint": "failCommand",
84 "mode": {
85 "times": 1
86 },
87 "data": {
88 "failCommands": [
89 "mapReduce"
90 ],
91 "closeConnection": true
92 }
93 },
94 "operations": [
95 {
96 "name": "mapReduce",
97 "object": "collection",
98 "arguments": {
99 "map": {
100 "$code": "function inc() { return emit(0, this.x + 1) }"
101 },
102 "reduce": {
103 "$code": "function sum(key, values) { return values.reduce((acc, x) => acc + x); }"
104 },
105 "out": {
106 "inline": 1
107 }
108 },
109 "error": true
110 }
111 ],
112 "expectations": [
113 {
114 "command_started_event": {
115 "command": {
116 "mapReduce": "coll",
117 "map": {
118 "$code": "function inc() { return emit(0, this.x + 1) }"
119 },
120 "reduce": {
121 "$code": "function sum(key, values) { return values.reduce((acc, x) => acc + x); }"
122 },
123 "out": {
124 "inline": 1
125 }
126 },
127 "database_name": "retryable-reads-tests"
128 }
129 }
130 ]
131 },
132 {
133 "description": "MapReduce fails with retry off",
134 "clientOptions": {
135 "retryReads": false
136 },
137 "failPoint": {
138 "configureFailPoint": "failCommand",
139 "mode": {
140 "times": 1
141 },
142 "data": {
143 "failCommands": [
144 "mapReduce"
145 ],
146 "closeConnection": true
147 }
148 },
149 "operations": [
150 {
151 "name": "mapReduce",
152 "object": "collection",
153 "arguments": {
154 "map": {
155 "$code": "function inc() { return emit(0, this.x + 1) }"
156 },
157 "reduce": {
158 "$code": "function sum(key, values) { return values.reduce((acc, x) => acc + x); }"
159 },
160 "out": {
161 "inline": 1
162 }
163 },
164 "error": true
165 }
166 ],
167 "expectations": [
168 {
169 "command_started_event": {
170 "command": {
171 "mapReduce": "coll",
172 "map": {
173 "$code": "function inc() { return emit(0, this.x + 1) }"
174 },
175 "reduce": {
176 "$code": "function sum(key, values) { return values.reduce((acc, x) => acc + x); }"
177 },
178 "out": {
179 "inline": 1
180 }
181 },
182 "database_name": "retryable-reads-tests"
183 }
184 }
185 ]
186 }
187 ]
188 }