RED-5504 - Prevent using exact same database schema/buckets/index for multiple tenants
- add junit test
This commit is contained in:
parent
58accbd54d
commit
308811f942
@ -68,4 +68,48 @@ public class TenantsTest extends AbstractPersistenceServerServiceTest {
|
|||||||
assertThat(e.status()).isEqualTo(409);
|
assertThat(e.status()).isEqualTo(409);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testCreateTenantWithDuplicateStorageS3() {
|
||||||
|
|
||||||
|
var tenantRequest = TenantRequest.builder()
|
||||||
|
.tenantId("redaction2")
|
||||||
|
.displayName("Redaction default2")
|
||||||
|
.guid(UUID.randomUUID().toString())
|
||||||
|
.databaseConnection(DatabaseConnection.builder()
|
||||||
|
.driver("postgresql")
|
||||||
|
.host("localhost")
|
||||||
|
.port("port")
|
||||||
|
.database("redaction")
|
||||||
|
.schema("myschema2")
|
||||||
|
.username("redaction")
|
||||||
|
.password("redaction")
|
||||||
|
.build())
|
||||||
|
.searchConnection(SearchConnection.builder()
|
||||||
|
.hosts(Set.of("elasticsearchHost2"))
|
||||||
|
.port(9200)
|
||||||
|
.scheme("https2")
|
||||||
|
.username("elastic")
|
||||||
|
.numberOfShards("1")
|
||||||
|
.numberOfReplicas("5")
|
||||||
|
.build())
|
||||||
|
.s3StorageConnection(S3StorageConnection.builder()
|
||||||
|
.key("key")
|
||||||
|
.secret("secret")
|
||||||
|
.signerType("signerType")
|
||||||
|
.bucketName("bucketName")
|
||||||
|
.region("eu")
|
||||||
|
.endpoint("endpoint")
|
||||||
|
.build())
|
||||||
|
.redUsers(List.of(RedUser.builder().username("user").password("password").redRoles(ApplicationRoles.ROLE_DATA.keySet()).build(),
|
||||||
|
RedUser.builder().username("manageradmin1@test.com").password("secret").redRoles(ApplicationRoles.ROLE_DATA.keySet()).build(),
|
||||||
|
RedUser.builder().username("manageradmin2@test.com").password("secret").redRoles(ApplicationRoles.ROLE_DATA.keySet()).build()))
|
||||||
|
.build();
|
||||||
|
|
||||||
|
try {
|
||||||
|
tenantsClient.createTenant(tenantRequest);
|
||||||
|
} catch(FeignException e) {
|
||||||
|
assertThat(e.status()).isEqualTo(409);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user