Skip to content
Merged
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
3 changes: 3 additions & 0 deletions core/operations/management/bucket_create.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,9 @@ bucket_create_request::make_response(error_context::http&& ctx, const encoded_re
if (errors != nullptr) {
std::vector<std::string> error_list{};
for (const auto& [code, message] : errors->get_object()) {
if (message.get_string().find("Bucket with given name already exists") != std::string::npos) {
response.ctx.ec = errc::management::bucket_exists;
}
error_list.emplace_back(message.get_string());
}
if (!error_list.empty()) {
Expand Down
8 changes: 8 additions & 0 deletions test/test_integration_management.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,14 @@ TEST_CASE("integration: bucket management", "[integration]")
REQUIRE(bucket_settings.compression_mode == resp.bucket.compression_mode);
REQUIRE(bucket_settings.replica_indexes == resp.bucket.replica_indexes);
}

{
couchbase::core::operations::management::bucket_create_request req;
req.bucket = bucket_settings;
auto resp = test::utils::execute(integration.cluster, req);
REQUIRE(resp.ctx.ec == couchbase::errc::management::bucket_exists);
}

std::uint64_t old_quota_mb{ 0 };
{
couchbase::core::operations::management::bucket_get_all_request req{};
Expand Down