Skip to content

Commit b71ee37

Browse files
committed
PHPLIB-1327: Sync Index Management Tests
This syncs index management tests to mongodb/specifications@e54cb7c. This commit also includes a new spec test introduced that should've been copied over in PHPLIB-1307.
1 parent 8338889 commit b71ee37

File tree

6 files changed

+262
-10
lines changed

6 files changed

+262
-10
lines changed

tests/UnifiedSpecTests/index-management/createSearchIndex.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
},
5656
"expectError": {
5757
"isError": true,
58-
"errorContains": "Search index commands are only supported with Atlas"
58+
"errorContains": "Atlas"
5959
}
6060
}
6161
],
@@ -102,7 +102,7 @@
102102
},
103103
"expectError": {
104104
"isError": true,
105-
"errorContains": "Search index commands are only supported with Atlas"
105+
"errorContains": "Atlas"
106106
}
107107
}
108108
],

tests/UnifiedSpecTests/index-management/createSearchIndexes.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
},
5050
"expectError": {
5151
"isError": true,
52-
"errorContains": "Search index commands are only supported with Atlas"
52+
"errorContains": "Atlas"
5353
}
5454
}
5555
],
@@ -89,7 +89,7 @@
8989
},
9090
"expectError": {
9191
"isError": true,
92-
"errorContains": "Search index commands are only supported with Atlas"
92+
"errorContains": "Atlas"
9393
}
9494
}
9595
],
@@ -138,7 +138,7 @@
138138
},
139139
"expectError": {
140140
"isError": true,
141-
"errorContains": "Search index commands are only supported with Atlas"
141+
"errorContains": "Atlas"
142142
}
143143
}
144144
],

tests/UnifiedSpecTests/index-management/dropSearchIndex.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
},
5050
"expectError": {
5151
"isError": true,
52-
"errorContains": "Search index commands are only supported with Atlas"
52+
"errorContains": "Atlas"
5353
}
5454
}
5555
],

tests/UnifiedSpecTests/index-management/listSearchIndexes.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
"object": "collection0",
4747
"expectError": {
4848
"isError": true,
49-
"errorContains": "Search index commands are only supported with Atlas"
49+
"errorContains": "Atlas"
5050
}
5151
}
5252
],
@@ -81,7 +81,7 @@
8181
},
8282
"expectError": {
8383
"isError": true,
84-
"errorContains": "Search index commands are only supported with Atlas"
84+
"errorContains": "Atlas"
8585
}
8686
}
8787
],
@@ -122,7 +122,7 @@
122122
},
123123
"expectError": {
124124
"isError": true,
125-
"errorContains": "Search index commands are only supported with Atlas"
125+
"errorContains": "Atlas"
126126
}
127127
}
128128
],
Lines changed: 252 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,252 @@
1+
{
2+
"description": "search index operations ignore read and write concern",
3+
"schemaVersion": "1.4",
4+
"createEntities": [
5+
{
6+
"client": {
7+
"id": "client0",
8+
"useMultipleMongoses": false,
9+
"uriOptions": {
10+
"readConcernLevel": "local",
11+
"w": 1
12+
},
13+
"observeEvents": [
14+
"commandStartedEvent"
15+
]
16+
}
17+
},
18+
{
19+
"database": {
20+
"id": "database0",
21+
"client": "client0",
22+
"databaseName": "database0"
23+
}
24+
},
25+
{
26+
"collection": {
27+
"id": "collection0",
28+
"database": "database0",
29+
"collectionName": "collection0"
30+
}
31+
}
32+
],
33+
"runOnRequirements": [
34+
{
35+
"minServerVersion": "7.0.0",
36+
"topologies": [
37+
"replicaset",
38+
"load-balanced",
39+
"sharded"
40+
],
41+
"serverless": "forbid"
42+
}
43+
],
44+
"tests": [
45+
{
46+
"description": "createSearchIndex ignores read and write concern",
47+
"operations": [
48+
{
49+
"name": "createSearchIndex",
50+
"object": "collection0",
51+
"arguments": {
52+
"model": {
53+
"definition": {
54+
"mappings": {
55+
"dynamic": true
56+
}
57+
}
58+
}
59+
},
60+
"expectError": {
61+
"isError": true,
62+
"errorContains": "Atlas"
63+
}
64+
}
65+
],
66+
"expectEvents": [
67+
{
68+
"client": "client0",
69+
"events": [
70+
{
71+
"commandStartedEvent": {
72+
"command": {
73+
"createSearchIndexes": "collection0",
74+
"indexes": [
75+
{
76+
"definition": {
77+
"mappings": {
78+
"dynamic": true
79+
}
80+
}
81+
}
82+
],
83+
"$db": "database0",
84+
"writeConcern": {
85+
"$$exists": false
86+
},
87+
"readConcern": {
88+
"$$exists": false
89+
}
90+
}
91+
}
92+
}
93+
]
94+
}
95+
]
96+
},
97+
{
98+
"description": "createSearchIndexes ignores read and write concern",
99+
"operations": [
100+
{
101+
"name": "createSearchIndexes",
102+
"object": "collection0",
103+
"arguments": {
104+
"models": []
105+
},
106+
"expectError": {
107+
"isError": true,
108+
"errorContains": "Atlas"
109+
}
110+
}
111+
],
112+
"expectEvents": [
113+
{
114+
"client": "client0",
115+
"events": [
116+
{
117+
"commandStartedEvent": {
118+
"command": {
119+
"createSearchIndexes": "collection0",
120+
"indexes": [],
121+
"$db": "database0",
122+
"writeConcern": {
123+
"$$exists": false
124+
},
125+
"readConcern": {
126+
"$$exists": false
127+
}
128+
}
129+
}
130+
}
131+
]
132+
}
133+
]
134+
},
135+
{
136+
"description": "dropSearchIndex ignores read and write concern",
137+
"operations": [
138+
{
139+
"name": "dropSearchIndex",
140+
"object": "collection0",
141+
"arguments": {
142+
"name": "test index"
143+
},
144+
"expectError": {
145+
"isError": true,
146+
"errorContains": "Atlas"
147+
}
148+
}
149+
],
150+
"expectEvents": [
151+
{
152+
"client": "client0",
153+
"events": [
154+
{
155+
"commandStartedEvent": {
156+
"command": {
157+
"dropSearchIndex": "collection0",
158+
"name": "test index",
159+
"$db": "database0",
160+
"writeConcern": {
161+
"$$exists": false
162+
},
163+
"readConcern": {
164+
"$$exists": false
165+
}
166+
}
167+
}
168+
}
169+
]
170+
}
171+
]
172+
},
173+
{
174+
"description": "listSearchIndexes ignores read and write concern",
175+
"operations": [
176+
{
177+
"name": "listSearchIndexes",
178+
"object": "collection0",
179+
"expectError": {
180+
"isError": true,
181+
"errorContains": "Atlas"
182+
}
183+
}
184+
],
185+
"expectEvents": [
186+
{
187+
"client": "client0",
188+
"events": [
189+
{
190+
"commandStartedEvent": {
191+
"command": {
192+
"aggregate": "collection0",
193+
"pipeline": [
194+
{
195+
"$listSearchIndexes": {}
196+
}
197+
],
198+
"writeConcern": {
199+
"$$exists": false
200+
},
201+
"readConcern": {
202+
"$$exists": false
203+
}
204+
}
205+
}
206+
}
207+
]
208+
}
209+
]
210+
},
211+
{
212+
"description": "updateSearchIndex ignores the read and write concern",
213+
"operations": [
214+
{
215+
"name": "updateSearchIndex",
216+
"object": "collection0",
217+
"arguments": {
218+
"name": "test index",
219+
"definition": {}
220+
},
221+
"expectError": {
222+
"isError": true,
223+
"errorContains": "Atlas"
224+
}
225+
}
226+
],
227+
"expectEvents": [
228+
{
229+
"client": "client0",
230+
"events": [
231+
{
232+
"commandStartedEvent": {
233+
"command": {
234+
"updateSearchIndex": "collection0",
235+
"name": "test index",
236+
"definition": {},
237+
"$db": "database0",
238+
"writeConcern": {
239+
"$$exists": false
240+
},
241+
"readConcern": {
242+
"$$exists": false
243+
}
244+
}
245+
}
246+
}
247+
]
248+
}
249+
]
250+
}
251+
]
252+
}

tests/UnifiedSpecTests/index-management/updateSearchIndex.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
},
5151
"expectError": {
5252
"isError": true,
53-
"errorContains": "Search index commands are only supported with Atlas"
53+
"errorContains": "Atlas"
5454
}
5555
}
5656
],

0 commit comments

Comments
 (0)