Skip to content

Commit c2e6eb4

Browse files
kkloberdanzrcsanchez97
authored andcommitted
Server update caused a break in waterfall (#934)
Recently, the server changed behavior where creating a collection that already exists will not trigger an exception. Instead, replace this test with a check that the collection was indeed created. See Jira ticket below. Jira: https://jira.mongodb.org/browse/SERVER-60064
1 parent 3ac4859 commit c2e6eb4

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/mongocxx/test/database.cpp

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -401,12 +401,21 @@ TEST_CASE("Database integration tests", "[database]") {
401401
obtained_collection.drop();
402402
}
403403

404-
SECTION("but raises exception when collection already exists") {
404+
SECTION("verify that collection is created server side") {
405405
database[collection_name].drop();
406406

407407
database.create_collection(collection_name);
408408

409-
REQUIRE_THROWS(database.create_collection(collection_name));
409+
auto cursor = database.list_collections();
410+
bool found = false;
411+
for (const auto& coll : cursor) {
412+
auto name = bsoncxx::string::to_string(coll["name"].get_string().value);
413+
if (name == std::string(collection_name)) {
414+
found = true;
415+
break;
416+
}
417+
}
418+
REQUIRE(found);
410419
}
411420
}
412421

0 commit comments

Comments
 (0)