merlimat commented on code in PR #15932:
URL: https://github.com/apache/pulsar/pull/15932#discussion_r889600730
##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/TenantsBase.java:
##########
@@ -124,6 +124,12 @@ public void createTenant(@Suspended final AsyncResponse
asyncResponse,
validateSuperUserAccessAsync()
.thenCompose(__ -> validatePoliciesReadOnlyAccessAsync())
.thenCompose(__ -> validateClustersAsync(tenantInfo))
+ .thenCompose(__ -> tenantResources().tenantExistsAsync(tenant))
+ .thenAccept(exist -> {
+ if (exist) {
+ throw new RestException(Status.CONFLICT, "Tenant
already exist");
+ }
+ })
Review Comment:
We should also add a unit test to ensure the exception is the expected one
(and that later on, the behavior will not be broken).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]