Skip to content

Commit

Permalink
GODRIVER-3074 Sync index management tests (#1510)
Browse files Browse the repository at this point in the history
  • Loading branch information
prestonvasquez authored and qingyang-hu committed Feb 12, 2024
1 parent 3b7204d commit fa0fae8
Show file tree
Hide file tree
Showing 13 changed files with 445 additions and 30 deletions.
7 changes: 7 additions & 0 deletions mongo/integration/unified/unified_spec_runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,16 @@ var (
// GODRIVER-1773: This test runs a "find" with limit=4 and batchSize=3. It expects batchSize values of three for
// the "find" and one for the "getMore", but we send three for both.
"A successful find event with a getmore and the server kills the cursor (<= 4.4)": "See GODRIVER-1773",

// TODO(GODRIVER-2843): Fix and unskip these test cases.
"Find operation with snapshot": "Test fails frequently. See GODRIVER-2843",
"Write commands with snapshot session do not affect snapshot reads": "Test fails frequently. See GODRIVER-2843",

// TODO(GODRIVER-3043): Avoid Appending Write/Read Concern in Atlas Search
// Index Helper Commands.
"dropSearchIndex ignores read and write concern": "Sync GODRIVER-3074, but skip testing bug GODRIVER-3043",
"listSearchIndexes ignores read and write concern": "Sync GODRIVER-3074, but skip testing bug GODRIVER-3043",
"updateSearchIndex ignores the read and write concern": "Sync GODRIVER-3074, but skip testing bug GODRIVER-3043",
}

logMessageValidatorTimeout = 10 * time.Millisecond
Expand Down
6 changes: 3 additions & 3 deletions testdata/index-management/createSearchIndex.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
},
"expectError": {
"isError": true,
"errorContains": "Search index commands are only supported with Atlas"
"errorContains": "Atlas"
}
}
],
Expand Down Expand Up @@ -102,7 +102,7 @@
},
"expectError": {
"isError": true,
"errorContains": "Search index commands are only supported with Atlas"
"errorContains": "Atlas"
}
}
],
Expand Down Expand Up @@ -133,4 +133,4 @@
]
}
]
}
}
8 changes: 5 additions & 3 deletions testdata/index-management/createSearchIndex.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@ 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: Search index commands are only supported with Atlas
errorContains: Atlas
expectEvents:
- client: *client0
events:
Expand All @@ -50,13 +51,14 @@ 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: Search index commands are only supported with Atlas
errorContains: Atlas
expectEvents:
- client: *client0
events:
- commandStartedEvent:
command:
createSearchIndexes: *collection0
indexes: [ { definition: *definition, name: 'test index' } ]
$db: *database0
$db: *database0
8 changes: 4 additions & 4 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": "Search index commands are only supported with Atlas"
"errorContains": "Atlas"
}
}
],
Expand Down Expand Up @@ -89,7 +89,7 @@
},
"expectError": {
"isError": true,
"errorContains": "Search index commands are only supported with Atlas"
"errorContains": "Atlas"
}
}
],
Expand Down Expand Up @@ -138,7 +138,7 @@
},
"expectError": {
"isError": true,
"errorContains": "Search index commands are only supported with Atlas"
"errorContains": "Atlas"
}
}
],
Expand Down Expand Up @@ -169,4 +169,4 @@
]
}
]
}
}
11 changes: 7 additions & 4 deletions testdata/index-management/createSearchIndexes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@ 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: Search index commands are only supported with Atlas
errorContains: Atlas
expectEvents:
- client: *client0
events:
Expand All @@ -51,8 +52,9 @@ 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: Search index commands are only supported with Atlas
errorContains: Atlas
expectEvents:
- client: *client0
events:
Expand All @@ -71,13 +73,14 @@ 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: Search index commands are only supported with Atlas
errorContains: Atlas
expectEvents:
- client: *client0
events:
- commandStartedEvent:
command:
createSearchIndexes: *collection0
indexes: [ { definition: *definition, name: 'test index' } ]
$db: *database0
$db: *database0
4 changes: 2 additions & 2 deletions 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": "Search index commands are only supported with Atlas"
"errorContains": "Atlas"
}
}
],
Expand All @@ -71,4 +71,4 @@
]
}
]
}
}
5 changes: 3 additions & 2 deletions testdata/index-management/dropSearchIndex.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,14 @@ 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: Search index commands are only supported with Atlas
errorContains: Atlas
expectEvents:
- client: *client0
events:
- commandStartedEvent:
command:
dropSearchIndex: *collection0
name: *indexName
$db: *database0
$db: *database0
8 changes: 4 additions & 4 deletions testdata/index-management/listSearchIndexes.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"object": "collection0",
"expectError": {
"isError": true,
"errorContains": "Search index commands are only supported with Atlas"
"errorContains": "Atlas"
}
}
],
Expand Down Expand Up @@ -81,7 +81,7 @@
},
"expectError": {
"isError": true,
"errorContains": "Search index commands are only supported with Atlas"
"errorContains": "Atlas"
}
}
],
Expand Down Expand Up @@ -122,7 +122,7 @@
},
"expectError": {
"isError": true,
"errorContains": "Search index commands are only supported with Atlas"
"errorContains": "Atlas"
}
}
],
Expand Down Expand Up @@ -153,4 +153,4 @@
]
}
]
}
}
11 changes: 7 additions & 4 deletions testdata/index-management/listSearchIndexes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@ 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: Search index commands are only supported with Atlas
errorContains: Atlas
expectEvents:
- client: *client0
events:
Expand All @@ -48,8 +49,9 @@ 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: Search index commands are only supported with Atlas
errorContains: Atlas
expectEvents:
- client: *client0
events:
Expand All @@ -71,8 +73,9 @@ 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: Search index commands are only supported with Atlas
errorContains: Atlas
expectEvents:
- client: *client0
events:
Expand All @@ -82,4 +85,4 @@ tests:
cursor: { batchSize: 10 }
pipeline:
- $listSearchIndexes: { name: *indexName }
$db: *database0
$db: *database0
Loading

0 comments on commit fa0fae8

Please sign in to comment.