Skip to content

Commit ccedeac

Browse files
GODRIVER-3359 Sync unified spec tests
1 parent 98a74d2 commit ccedeac

10 files changed

+36
-220
lines changed

testdata/index-management/createSearchIndex.json

Lines changed: 6 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,12 @@
5050
"mappings": {
5151
"dynamic": true
5252
}
53-
},
54-
"type": "search"
53+
}
5554
}
5655
},
5756
"expectError": {
5857
"isError": true,
59-
"errorContains": "Atlas"
58+
"errorContains": "Search index commands are only supported with Atlas"
6059
}
6160
}
6261
],
@@ -74,8 +73,7 @@
7473
"mappings": {
7574
"dynamic": true
7675
}
77-
},
78-
"type": "search"
76+
}
7977
}
8078
],
8179
"$db": "database0"
@@ -99,13 +97,12 @@
9997
"dynamic": true
10098
}
10199
},
102-
"name": "test index",
103-
"type": "search"
100+
"name": "test index"
104101
}
105102
},
106103
"expectError": {
107104
"isError": true,
108-
"errorContains": "Atlas"
105+
"errorContains": "Search index commands are only supported with Atlas"
109106
}
110107
}
111108
],
@@ -124,68 +121,7 @@
124121
"dynamic": true
125122
}
126123
},
127-
"name": "test index",
128-
"type": "search"
129-
}
130-
],
131-
"$db": "database0"
132-
}
133-
}
134-
}
135-
]
136-
}
137-
]
138-
},
139-
{
140-
"description": "create a vector search index",
141-
"operations": [
142-
{
143-
"name": "createSearchIndex",
144-
"object": "collection0",
145-
"arguments": {
146-
"model": {
147-
"definition": {
148-
"fields": [
149-
{
150-
"type": "vector",
151-
"path": "plot_embedding",
152-
"numDimensions": 1536,
153-
"similarity": "euclidean"
154-
}
155-
]
156-
},
157-
"name": "test index",
158-
"type": "vectorSearch"
159-
}
160-
},
161-
"expectError": {
162-
"isError": true,
163-
"errorContains": "Atlas"
164-
}
165-
}
166-
],
167-
"expectEvents": [
168-
{
169-
"client": "client0",
170-
"events": [
171-
{
172-
"commandStartedEvent": {
173-
"command": {
174-
"createSearchIndexes": "collection0",
175-
"indexes": [
176-
{
177-
"definition": {
178-
"fields": [
179-
{
180-
"type": "vector",
181-
"path": "plot_embedding",
182-
"numDimensions": 1536,
183-
"similarity": "euclidean"
184-
}
185-
]
186-
},
187-
"name": "test index",
188-
"type": "vectorSearch"
124+
"name": "test index"
189125
}
190126
],
191127
"$db": "database0"

testdata/index-management/createSearchIndex.yml

Lines changed: 6 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -26,61 +26,37 @@ tests:
2626
- name: createSearchIndex
2727
object: *collection0
2828
arguments:
29-
model: { definition: &definition { mappings: { dynamic: true } } , type: 'search' }
29+
model: { definition: &definition { mappings: { dynamic: true } } }
3030
expectError:
3131
# This test always errors in a non-Atlas environment. The test functions as a unit test by asserting
3232
# that the driver constructs and sends the correct command.
33-
# The expected error message was changed in SERVER-83003. Check for the substring "Atlas" shared by both error messages.
3433
isError: true
35-
errorContains: Atlas
34+
errorContains: Search index commands are only supported with Atlas
3635
expectEvents:
3736
- client: *client0
3837
events:
3938
- commandStartedEvent:
4039
command:
4140
createSearchIndexes: *collection0
42-
indexes: [ { definition: *definition, type: 'search'} ]
41+
indexes: [ { definition: *definition } ]
4342
$db: *database0
4443

4544
- description: "name provided for an index definition"
4645
operations:
4746
- name: createSearchIndex
4847
object: *collection0
4948
arguments:
50-
model: { definition: &definition { mappings: { dynamic: true } } , name: 'test index', type: 'search' }
49+
model: { definition: &definition { mappings: { dynamic: true } } , name: 'test index' }
5150
expectError:
5251
# This test always errors in a non-Atlas environment. The test functions as a unit test by asserting
5352
# that the driver constructs and sends the correct command.
54-
# The expected error message was changed in SERVER-83003. Check for the substring "Atlas" shared by both error messages.
5553
isError: true
56-
errorContains: Atlas
54+
errorContains: Search index commands are only supported with Atlas
5755
expectEvents:
5856
- client: *client0
5957
events:
6058
- commandStartedEvent:
6159
command:
6260
createSearchIndexes: *collection0
63-
indexes: [ { definition: *definition, name: 'test index', type: 'search' } ]
64-
$db: *database0
65-
66-
- description: "create a vector search index"
67-
operations:
68-
- name: createSearchIndex
69-
object: *collection0
70-
arguments:
71-
model: { definition: &definition { fields: [ {"type": "vector", "path": "plot_embedding", "numDimensions": 1536, "similarity": "euclidean"} ] }
72-
, name: 'test index', type: 'vectorSearch' }
73-
expectError:
74-
# This test always errors in a non-Atlas environment. The test functions as a unit test by asserting
75-
# that the driver constructs and sends the correct command.
76-
# The expected error message was changed in SERVER-83003. Check for the substring "Atlas" shared by both error messages.
77-
isError: true
78-
errorContains: Atlas
79-
expectEvents:
80-
- client: *client0
81-
events:
82-
- commandStartedEvent:
83-
command:
84-
createSearchIndexes: *collection0
85-
indexes: [ { definition: *definition, name: 'test index', type: 'vectorSearch' } ]
61+
indexes: [ { definition: *definition, name: 'test index' } ]
8662
$db: *database0

testdata/index-management/createSearchIndexes.json

Lines changed: 7 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
},
5050
"expectError": {
5151
"isError": true,
52-
"errorContains": "Atlas"
52+
"errorContains": "Search index commands are only supported with Atlas"
5353
}
5454
}
5555
],
@@ -83,14 +83,13 @@
8383
"mappings": {
8484
"dynamic": true
8585
}
86-
},
87-
"type": "search"
86+
}
8887
}
8988
]
9089
},
9190
"expectError": {
9291
"isError": true,
93-
"errorContains": "Atlas"
92+
"errorContains": "Search index commands are only supported with Atlas"
9493
}
9594
}
9695
],
@@ -108,8 +107,7 @@
108107
"mappings": {
109108
"dynamic": true
110109
}
111-
},
112-
"type": "search"
110+
}
113111
}
114112
],
115113
"$db": "database0"
@@ -134,14 +132,13 @@
134132
"dynamic": true
135133
}
136134
},
137-
"name": "test index",
138-
"type": "search"
135+
"name": "test index"
139136
}
140137
]
141138
},
142139
"expectError": {
143140
"isError": true,
144-
"errorContains": "Atlas"
141+
"errorContains": "Search index commands are only supported with Atlas"
145142
}
146143
}
147144
],
@@ -160,70 +157,7 @@
160157
"dynamic": true
161158
}
162159
},
163-
"name": "test index",
164-
"type": "search"
165-
}
166-
],
167-
"$db": "database0"
168-
}
169-
}
170-
}
171-
]
172-
}
173-
]
174-
},
175-
{
176-
"description": "create a vector search index",
177-
"operations": [
178-
{
179-
"name": "createSearchIndexes",
180-
"object": "collection0",
181-
"arguments": {
182-
"models": [
183-
{
184-
"definition": {
185-
"fields": [
186-
{
187-
"type": "vector",
188-
"path": "plot_embedding",
189-
"numDimensions": 1536,
190-
"similarity": "euclidean"
191-
}
192-
]
193-
},
194-
"name": "test index",
195-
"type": "vectorSearch"
196-
}
197-
]
198-
},
199-
"expectError": {
200-
"isError": true,
201-
"errorContains": "Atlas"
202-
}
203-
}
204-
],
205-
"expectEvents": [
206-
{
207-
"client": "client0",
208-
"events": [
209-
{
210-
"commandStartedEvent": {
211-
"command": {
212-
"createSearchIndexes": "collection0",
213-
"indexes": [
214-
{
215-
"definition": {
216-
"fields": [
217-
{
218-
"type": "vector",
219-
"path": "plot_embedding",
220-
"numDimensions": 1536,
221-
"similarity": "euclidean"
222-
}
223-
]
224-
},
225-
"name": "test index",
226-
"type": "vectorSearch"
160+
"name": "test index"
227161
}
228162
],
229163
"$db": "database0"

testdata/index-management/createSearchIndexes.yml

Lines changed: 7 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,8 @@ tests:
3030
expectError:
3131
# This test always errors in a non-Atlas environment. The test functions as a unit test by asserting
3232
# that the driver constructs and sends the correct command.
33-
# The expected error message was changed in SERVER-83003. Check for the substring "Atlas" shared by both error messages.
3433
isError: true
35-
errorContains: Atlas
34+
errorContains: Search index commands are only supported with Atlas
3635
expectEvents:
3736
- client: *client0
3837
events:
@@ -48,61 +47,37 @@ tests:
4847
- name: createSearchIndexes
4948
object: *collection0
5049
arguments:
51-
models: [ { definition: &definition { mappings: { dynamic: true } } , type: 'search' } ]
50+
models: [ { definition: &definition { mappings: { dynamic: true } } } ]
5251
expectError:
5352
# This test always errors in a non-Atlas environment. The test functions as a unit test by asserting
5453
# that the driver constructs and sends the correct command.
55-
# The expected error message was changed in SERVER-83003. Check for the substring "Atlas" shared by both error messages.
5654
isError: true
57-
errorContains: Atlas
55+
errorContains: Search index commands are only supported with Atlas
5856
expectEvents:
5957
- client: *client0
6058
events:
6159
- commandStartedEvent:
6260
command:
6361
createSearchIndexes: *collection0
64-
indexes: [ { definition: *definition, type: 'search'} ]
62+
indexes: [ { definition: *definition } ]
6563
$db: *database0
6664

6765
- description: "name provided for an index definition"
6866
operations:
6967
- name: createSearchIndexes
7068
object: *collection0
7169
arguments:
72-
models: [ { definition: &definition { mappings: { dynamic: true } } , name: 'test index' , type: 'search' } ]
70+
models: [ { definition: &definition { mappings: { dynamic: true } } , name: 'test index' } ]
7371
expectError:
7472
# This test always errors in a non-Atlas environment. The test functions as a unit test by asserting
7573
# that the driver constructs and sends the correct command.
76-
# The expected error message was changed in SERVER-83003. Check for the substring "Atlas" shared by both error messages.
7774
isError: true
78-
errorContains: Atlas
75+
errorContains: Search index commands are only supported with Atlas
7976
expectEvents:
8077
- client: *client0
8178
events:
8279
- commandStartedEvent:
8380
command:
8481
createSearchIndexes: *collection0
85-
indexes: [ { definition: *definition, name: 'test index', type: 'search' } ]
86-
$db: *database0
87-
88-
- description: "create a vector search index"
89-
operations:
90-
- name: createSearchIndexes
91-
object: *collection0
92-
arguments:
93-
models: [ { definition: &definition { fields: [ {"type": "vector", "path": "plot_embedding", "numDimensions": 1536, "similarity": "euclidean"} ] },
94-
name: 'test index' , type: 'vectorSearch' } ]
95-
expectError:
96-
# This test always errors in a non-Atlas environment. The test functions as a unit test by asserting
97-
# that the driver constructs and sends the correct command.
98-
# The expected error message was changed in SERVER-83003. Check for the substring "Atlas" shared by both error messages.
99-
isError: true
100-
errorContains: Atlas
101-
expectEvents:
102-
- client: *client0
103-
events:
104-
- commandStartedEvent:
105-
command:
106-
createSearchIndexes: *collection0
107-
indexes: [ { definition: *definition, name: 'test index', type: 'vectorSearch' } ]
82+
indexes: [ { definition: *definition, name: 'test index' } ]
10883
$db: *database0

testdata/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": "Atlas"
52+
"errorContains": "Search index commands are only supported with Atlas"
5353
}
5454
}
5555
],

0 commit comments

Comments
 (0)