Skip to content

Commit 108a783

Browse files
test(mongodb): keep the integration helper in step with the Atlas-legal name
engine_index() hardcoded '{TEST_INDEX}:{engine_name}', duplicating the production rule rather than calling it -- which is both why it broke here and part of why the colon survived to a real Atlas run in the first place. It has to duplicate: the engine lives in a bin target, so an integration test cannot import derive_search_index_name. The comment now says so, and says why the separator must not be 'fixed' back to ':' -- mongodb-atlas-local accepts a colon that hosted Atlas rejects, so this suite can never be the thing that catches it. The unit test search_index_names_are_atlas_legal is. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
1 parent a1d400a commit 108a783

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

tests/integration_mongodb.rs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,20 @@ fn engine_collection(engine_name: &str) -> String {
128128

129129
/// The search index the ENGINE builds for config `engine_name` when the run is
130130
/// given `MONGODB_INDEX_NAME=TEST_INDEX` (#306).
131+
///
132+
/// The separator is `_`, mirroring `derive_search_index_name`: MongoDB Atlas
133+
/// rejects a `:` in a search index name with
134+
/// `BadValue: invalid index name`, even though the
135+
/// `mongodb/mongodb-atlas-local` image these tests run against accepts it. That
136+
/// permissiveness gap is why the colon survived to a real Atlas run, so keep
137+
/// this helper in step with production and do not "fix" it back to `:`.
138+
///
139+
/// It has to duplicate the production rule rather than call it: the engine lives
140+
/// in a bin target, so an integration test cannot import `derive_search_index_name`.
141+
/// The unit test `search_index_names_are_atlas_legal` is what actually guards the
142+
/// character set.
131143
fn engine_index(engine_name: &str) -> String {
132-
format!("{TEST_INDEX}:{engine_name}")
144+
format!("{TEST_INDEX}_{engine_name}")
133145
}
134146

135147
/// Count documents in a specific collection of the test database, server-side.

0 commit comments

Comments
 (0)