Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GODRIVER-3359 Sync unified spec tests #1872

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 6 additions & 70 deletions testdata/index-management/createSearchIndex.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,12 @@
"mappings": {
"dynamic": true
}
},
"type": "search"
}
}
},
"expectError": {
"isError": true,
"errorContains": "Atlas"
"errorContains": "Search index commands are only supported with Atlas"
}
}
],
Expand All @@ -74,8 +73,7 @@
"mappings": {
"dynamic": true
}
},
"type": "search"
}
}
],
"$db": "database0"
Expand All @@ -99,13 +97,12 @@
"dynamic": true
}
},
"name": "test index",
"type": "search"
"name": "test index"
}
},
"expectError": {
"isError": true,
"errorContains": "Atlas"
"errorContains": "Search index commands are only supported with Atlas"
}
}
],
Expand All @@ -124,68 +121,7 @@
"dynamic": true
}
},
"name": "test index",
"type": "search"
}
],
"$db": "database0"
}
}
}
]
}
]
},
{
"description": "create a vector search index",
"operations": [
{
"name": "createSearchIndex",
"object": "collection0",
"arguments": {
"model": {
"definition": {
"fields": [
{
"type": "vector",
"path": "plot_embedding",
"numDimensions": 1536,
"similarity": "euclidean"
}
]
},
"name": "test index",
"type": "vectorSearch"
}
},
"expectError": {
"isError": true,
"errorContains": "Atlas"
}
}
],
"expectEvents": [
{
"client": "client0",
"events": [
{
"commandStartedEvent": {
"command": {
"createSearchIndexes": "collection0",
"indexes": [
{
"definition": {
"fields": [
{
"type": "vector",
"path": "plot_embedding",
"numDimensions": 1536,
"similarity": "euclidean"
}
]
},
"name": "test index",
"type": "vectorSearch"
"name": "test index"
}
],
"$db": "database0"
Expand Down
36 changes: 6 additions & 30 deletions testdata/index-management/createSearchIndex.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,61 +26,37 @@ tests:
- name: createSearchIndex
object: *collection0
arguments:
model: { definition: &definition { mappings: { dynamic: true } } , type: 'search' }
model: { definition: &definition { mappings: { dynamic: true } } }
expectError:
# This test always errors in a non-Atlas environment. The test functions as a unit test by asserting
# that the driver constructs and sends the correct command.
# The expected error message was changed in SERVER-83003. Check for the substring "Atlas" shared by both error messages.
isError: true
errorContains: Atlas
errorContains: Search index commands are only supported with Atlas
expectEvents:
- client: *client0
events:
- commandStartedEvent:
command:
createSearchIndexes: *collection0
indexes: [ { definition: *definition, type: 'search'} ]
indexes: [ { definition: *definition } ]
$db: *database0

- description: "name provided for an index definition"
operations:
- name: createSearchIndex
object: *collection0
arguments:
model: { definition: &definition { mappings: { dynamic: true } } , name: 'test index', type: 'search' }
model: { definition: &definition { mappings: { dynamic: true } } , name: 'test index' }
expectError:
# This test always errors in a non-Atlas environment. The test functions as a unit test by asserting
# that the driver constructs and sends the correct command.
# The expected error message was changed in SERVER-83003. Check for the substring "Atlas" shared by both error messages.
isError: true
errorContains: Atlas
errorContains: Search index commands are only supported with Atlas
expectEvents:
- client: *client0
events:
- commandStartedEvent:
command:
createSearchIndexes: *collection0
indexes: [ { definition: *definition, name: 'test index', type: 'search' } ]
$db: *database0

- description: "create a vector search index"
operations:
- name: createSearchIndex
object: *collection0
arguments:
model: { definition: &definition { fields: [ {"type": "vector", "path": "plot_embedding", "numDimensions": 1536, "similarity": "euclidean"} ] }
, name: 'test index', type: 'vectorSearch' }
expectError:
# This test always errors in a non-Atlas environment. The test functions as a unit test by asserting
# that the driver constructs and sends the correct command.
# The expected error message was changed in SERVER-83003. Check for the substring "Atlas" shared by both error messages.
isError: true
errorContains: Atlas
expectEvents:
- client: *client0
events:
- commandStartedEvent:
command:
createSearchIndexes: *collection0
indexes: [ { definition: *definition, name: 'test index', type: 'vectorSearch' } ]
indexes: [ { definition: *definition, name: 'test index' } ]
$db: *database0
80 changes: 7 additions & 73 deletions testdata/index-management/createSearchIndexes.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
},
"expectError": {
"isError": true,
"errorContains": "Atlas"
"errorContains": "Search index commands are only supported with Atlas"
}
}
],
Expand Down Expand Up @@ -83,14 +83,13 @@
"mappings": {
"dynamic": true
}
},
"type": "search"
}
}
]
},
"expectError": {
"isError": true,
"errorContains": "Atlas"
"errorContains": "Search index commands are only supported with Atlas"
}
}
],
Expand All @@ -108,8 +107,7 @@
"mappings": {
"dynamic": true
}
},
"type": "search"
}
}
],
"$db": "database0"
Expand All @@ -134,14 +132,13 @@
"dynamic": true
}
},
"name": "test index",
"type": "search"
"name": "test index"
}
]
},
"expectError": {
"isError": true,
"errorContains": "Atlas"
"errorContains": "Search index commands are only supported with Atlas"
}
}
],
Expand All @@ -160,70 +157,7 @@
"dynamic": true
}
},
"name": "test index",
"type": "search"
}
],
"$db": "database0"
}
}
}
]
}
]
},
{
"description": "create a vector search index",
"operations": [
{
"name": "createSearchIndexes",
"object": "collection0",
"arguments": {
"models": [
{
"definition": {
"fields": [
{
"type": "vector",
"path": "plot_embedding",
"numDimensions": 1536,
"similarity": "euclidean"
}
]
},
"name": "test index",
"type": "vectorSearch"
}
]
},
"expectError": {
"isError": true,
"errorContains": "Atlas"
}
}
],
"expectEvents": [
{
"client": "client0",
"events": [
{
"commandStartedEvent": {
"command": {
"createSearchIndexes": "collection0",
"indexes": [
{
"definition": {
"fields": [
{
"type": "vector",
"path": "plot_embedding",
"numDimensions": 1536,
"similarity": "euclidean"
}
]
},
"name": "test index",
"type": "vectorSearch"
"name": "test index"
}
],
"$db": "database0"
Expand Down
39 changes: 7 additions & 32 deletions testdata/index-management/createSearchIndexes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,8 @@ tests:
expectError:
# This test always errors in a non-Atlas environment. The test functions as a unit test by asserting
# that the driver constructs and sends the correct command.
# The expected error message was changed in SERVER-83003. Check for the substring "Atlas" shared by both error messages.
isError: true
errorContains: Atlas
errorContains: Search index commands are only supported with Atlas
expectEvents:
- client: *client0
events:
Expand All @@ -48,61 +47,37 @@ tests:
- name: createSearchIndexes
object: *collection0
arguments:
models: [ { definition: &definition { mappings: { dynamic: true } } , type: 'search' } ]
models: [ { definition: &definition { mappings: { dynamic: true } } } ]
expectError:
# This test always errors in a non-Atlas environment. The test functions as a unit test by asserting
# that the driver constructs and sends the correct command.
# The expected error message was changed in SERVER-83003. Check for the substring "Atlas" shared by both error messages.
isError: true
errorContains: Atlas
errorContains: Search index commands are only supported with Atlas
expectEvents:
- client: *client0
events:
- commandStartedEvent:
command:
createSearchIndexes: *collection0
indexes: [ { definition: *definition, type: 'search'} ]
indexes: [ { definition: *definition } ]
$db: *database0

- description: "name provided for an index definition"
operations:
- name: createSearchIndexes
object: *collection0
arguments:
models: [ { definition: &definition { mappings: { dynamic: true } } , name: 'test index' , type: 'search' } ]
models: [ { definition: &definition { mappings: { dynamic: true } } , name: 'test index' } ]
expectError:
# This test always errors in a non-Atlas environment. The test functions as a unit test by asserting
# that the driver constructs and sends the correct command.
# The expected error message was changed in SERVER-83003. Check for the substring "Atlas" shared by both error messages.
isError: true
errorContains: Atlas
errorContains: Search index commands are only supported with Atlas
expectEvents:
- client: *client0
events:
- commandStartedEvent:
command:
createSearchIndexes: *collection0
indexes: [ { definition: *definition, name: 'test index', type: 'search' } ]
$db: *database0

- description: "create a vector search index"
operations:
- name: createSearchIndexes
object: *collection0
arguments:
models: [ { definition: &definition { fields: [ {"type": "vector", "path": "plot_embedding", "numDimensions": 1536, "similarity": "euclidean"} ] },
name: 'test index' , type: 'vectorSearch' } ]
expectError:
# This test always errors in a non-Atlas environment. The test functions as a unit test by asserting
# that the driver constructs and sends the correct command.
# The expected error message was changed in SERVER-83003. Check for the substring "Atlas" shared by both error messages.
isError: true
errorContains: Atlas
expectEvents:
- client: *client0
events:
- commandStartedEvent:
command:
createSearchIndexes: *collection0
indexes: [ { definition: *definition, name: 'test index', type: 'vectorSearch' } ]
indexes: [ { definition: *definition, name: 'test index' } ]
$db: *database0
2 changes: 1 addition & 1 deletion testdata/index-management/dropSearchIndex.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
},
"expectError": {
"isError": true,
"errorContains": "Atlas"
"errorContains": "Search index commands are only supported with Atlas"
}
}
],
Expand Down
Loading
Loading