Skip to content

Commit

Permalink
Server update caused a break in waterfall (#934)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
kkloberdanz authored and rcsanchez97 committed Mar 7, 2023
1 parent 3ac4859 commit c2e6eb4
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/mongocxx/test/database.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -401,12 +401,21 @@ TEST_CASE("Database integration tests", "[database]") {
obtained_collection.drop();
}

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

database.create_collection(collection_name);

REQUIRE_THROWS(database.create_collection(collection_name));
auto cursor = database.list_collections();
bool found = false;
for (const auto& coll : cursor) {
auto name = bsoncxx::string::to_string(coll["name"].get_string().value);
if (name == std::string(collection_name)) {
found = true;
break;
}
}
REQUIRE(found);
}
}

Expand Down

0 comments on commit c2e6eb4

Please sign in to comment.