Skip to content

Commit 0773374

Browse files
authored
CXX-2697 add search index spec tests and management helpers (#986)
1 parent 1bf9c8b commit 0773374

27 files changed

+1525
-39
lines changed

.mci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,7 @@ functions:
463463
export URI_OPTIONS_TESTS_PATH="$(pwd)/../data/uri-options"
464464
export VERSIONED_API_TESTS_PATH=$(pwd)/../data/versioned-api
465465
export WITH_TRANSACTION_TESTS_PATH="$(pwd)/../data/with_transaction"
466+
export INDEX_MANAGEMENT_TESTS_PATH="$(pwd)/../data/index-management"
466467
467468
export MONGODB_API_VERSION="${MONGODB_API_VERSION}"
468469
Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
{
2+
"description": "createSearchIndex",
3+
"schemaVersion": "1.4",
4+
"createEntities": [
5+
{
6+
"client": {
7+
"id": "client0",
8+
"useMultipleMongoses": false,
9+
"observeEvents": [
10+
"commandStartedEvent"
11+
]
12+
}
13+
},
14+
{
15+
"database": {
16+
"id": "database0",
17+
"client": "client0",
18+
"databaseName": "database0"
19+
}
20+
},
21+
{
22+
"collection": {
23+
"id": "collection0",
24+
"database": "database0",
25+
"collectionName": "collection0"
26+
}
27+
}
28+
],
29+
"runOnRequirements": [
30+
{
31+
"minServerVersion": "7.0.0",
32+
"topologies": [
33+
"replicaset",
34+
"load-balanced",
35+
"sharded"
36+
],
37+
"serverless": "forbid"
38+
}
39+
],
40+
"tests": [
41+
{
42+
"description": "no name provided for an index definition",
43+
"operations": [
44+
{
45+
"name": "createSearchIndex",
46+
"object": "collection0",
47+
"arguments": {
48+
"model": {
49+
"definition": {
50+
"mappings": {
51+
"dynamic": true
52+
}
53+
}
54+
}
55+
},
56+
"expectError": {
57+
"isError": true
58+
}
59+
}
60+
],
61+
"expectEvents": [
62+
{
63+
"client": "client0",
64+
"events": [
65+
{
66+
"commandStartedEvent": {
67+
"command": {
68+
"createSearchIndexes": "collection0",
69+
"indexes": [
70+
{
71+
"definition": {
72+
"mappings": {
73+
"dynamic": true
74+
}
75+
}
76+
}
77+
],
78+
"$db": "database0"
79+
}
80+
}
81+
}
82+
]
83+
}
84+
]
85+
},
86+
{
87+
"description": "name provided for an index definition",
88+
"operations": [
89+
{
90+
"name": "createSearchIndex",
91+
"object": "collection0",
92+
"arguments": {
93+
"model": {
94+
"definition": {
95+
"mappings": {
96+
"dynamic": true
97+
}
98+
},
99+
"name": "test index"
100+
}
101+
},
102+
"expectError": {
103+
"isError": true
104+
}
105+
}
106+
],
107+
"expectEvents": [
108+
{
109+
"client": "client0",
110+
"events": [
111+
{
112+
"commandStartedEvent": {
113+
"command": {
114+
"createSearchIndexes": "collection0",
115+
"indexes": [
116+
{
117+
"definition": {
118+
"mappings": {
119+
"dynamic": true
120+
}
121+
},
122+
"name": "test index"
123+
}
124+
],
125+
"$db": "database0"
126+
}
127+
}
128+
}
129+
]
130+
}
131+
]
132+
}
133+
]
134+
}
Lines changed: 169 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,169 @@
1+
{
2+
"description": "createSearchIndexes",
3+
"schemaVersion": "1.4",
4+
"createEntities": [
5+
{
6+
"client": {
7+
"id": "client0",
8+
"useMultipleMongoses": false,
9+
"observeEvents": [
10+
"commandStartedEvent"
11+
]
12+
}
13+
},
14+
{
15+
"database": {
16+
"id": "database0",
17+
"client": "client0",
18+
"databaseName": "database0"
19+
}
20+
},
21+
{
22+
"collection": {
23+
"id": "collection0",
24+
"database": "database0",
25+
"collectionName": "collection0"
26+
}
27+
}
28+
],
29+
"runOnRequirements": [
30+
{
31+
"minServerVersion": "7.0.0",
32+
"topologies": [
33+
"replicaset",
34+
"load-balanced",
35+
"sharded"
36+
],
37+
"serverless": "forbid"
38+
}
39+
],
40+
"tests": [
41+
{
42+
"description": "empty index definition array",
43+
"operations": [
44+
{
45+
"name": "createSearchIndexes",
46+
"object": "collection0",
47+
"arguments": {
48+
"models": []
49+
},
50+
"expectError": {
51+
"isError": true
52+
}
53+
}
54+
],
55+
"expectEvents": [
56+
{
57+
"client": "client0",
58+
"events": [
59+
{
60+
"commandStartedEvent": {
61+
"command": {
62+
"createSearchIndexes": "collection0",
63+
"indexes": [],
64+
"$db": "database0"
65+
}
66+
}
67+
}
68+
]
69+
}
70+
]
71+
},
72+
{
73+
"description": "no name provided for an index definition",
74+
"operations": [
75+
{
76+
"name": "createSearchIndexes",
77+
"object": "collection0",
78+
"arguments": {
79+
"models": [
80+
{
81+
"definition": {
82+
"mappings": {
83+
"dynamic": true
84+
}
85+
}
86+
}
87+
]
88+
},
89+
"expectError": {
90+
"isError": true
91+
}
92+
}
93+
],
94+
"expectEvents": [
95+
{
96+
"client": "client0",
97+
"events": [
98+
{
99+
"commandStartedEvent": {
100+
"command": {
101+
"createSearchIndexes": "collection0",
102+
"indexes": [
103+
{
104+
"definition": {
105+
"mappings": {
106+
"dynamic": true
107+
}
108+
}
109+
}
110+
],
111+
"$db": "database0"
112+
}
113+
}
114+
}
115+
]
116+
}
117+
]
118+
},
119+
{
120+
"description": "name provided for an index definition",
121+
"operations": [
122+
{
123+
"name": "createSearchIndexes",
124+
"object": "collection0",
125+
"arguments": {
126+
"models": [
127+
{
128+
"definition": {
129+
"mappings": {
130+
"dynamic": true
131+
}
132+
},
133+
"name": "test index"
134+
}
135+
]
136+
},
137+
"expectError": {
138+
"isError": true
139+
}
140+
}
141+
],
142+
"expectEvents": [
143+
{
144+
"client": "client0",
145+
"events": [
146+
{
147+
"commandStartedEvent": {
148+
"command": {
149+
"createSearchIndexes": "collection0",
150+
"indexes": [
151+
{
152+
"definition": {
153+
"mappings": {
154+
"dynamic": true
155+
}
156+
},
157+
"name": "test index"
158+
}
159+
],
160+
"$db": "database0"
161+
}
162+
}
163+
}
164+
]
165+
}
166+
]
167+
}
168+
]
169+
}
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
{
2+
"description": "dropSearchIndex",
3+
"schemaVersion": "1.4",
4+
"createEntities": [
5+
{
6+
"client": {
7+
"id": "client0",
8+
"useMultipleMongoses": false,
9+
"observeEvents": [
10+
"commandStartedEvent"
11+
]
12+
}
13+
},
14+
{
15+
"database": {
16+
"id": "database0",
17+
"client": "client0",
18+
"databaseName": "database0"
19+
}
20+
},
21+
{
22+
"collection": {
23+
"id": "collection0",
24+
"database": "database0",
25+
"collectionName": "collection0"
26+
}
27+
}
28+
],
29+
"runOnRequirements": [
30+
{
31+
"minServerVersion": "7.0.0",
32+
"topologies": [
33+
"replicaset",
34+
"load-balanced",
35+
"sharded"
36+
],
37+
"serverless": "forbid"
38+
}
39+
],
40+
"tests": [
41+
{
42+
"description": "sends the correct command",
43+
"operations": [
44+
{
45+
"name": "dropSearchIndex",
46+
"object": "collection0",
47+
"arguments": {
48+
"name": "test index"
49+
},
50+
"expectError": {
51+
"isError": true
52+
}
53+
}
54+
],
55+
"expectEvents": [
56+
{
57+
"client": "client0",
58+
"events": [
59+
{
60+
"commandStartedEvent": {
61+
"command": {
62+
"dropSearchIndex": "collection0",
63+
"name": "test index",
64+
"$db": "database0"
65+
}
66+
}
67+
}
68+
]
69+
}
70+
]
71+
}
72+
]
73+
}

0 commit comments

Comments
 (0)