Skip to content
This repository has been archived by the owner on Jan 24, 2024. It is now read-only.

Commit

Permalink
Fix the testAvroProduceAndConsumeWithAuth
Browse files Browse the repository at this point in the history
  • Loading branch information
BewareMyPower committed Apr 23, 2023
1 parent 6d3ac79 commit d4aaf9c
Showing 1 changed file with 6 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -711,18 +711,13 @@ public static Object[][] tokenPrefix() {
// this test creates the schema registry topic, and this may interfere with other tests
@Test(timeOut = 30000, priority = 1000, dataProvider = "tokenPrefix")
public void testAvroProduceAndConsumeWithAuth(boolean withTokenPrefix) throws Exception {

if (conf.isKafkaEnableMultiTenantMetadata()) {
// ensure that the KOP metadata namespace exists and that the user can write to it
// because we require "produce" permissions on the Schema Registry Topic
// while working in Multi Tenant mode
if (!admin.namespaces().getNamespaces(TENANT).contains(TENANT + "/" + conf.getKafkaMetadataNamespace())) {
admin.namespaces().createNamespace(TENANT + "/" + conf.getKafkaMetadataNamespace());
}
admin.namespaces()
.grantPermissionOnNamespace(TENANT + "/" + conf.getKafkaMetadataNamespace(), SIMPLE_USER,
Sets.newHashSet(AuthAction.produce, AuthAction.consume));
final String tenant = (conf.isKafkaEnableMultiTenantMetadata() ? TENANT : conf.getKafkaMetadataTenant());
if (!admin.namespaces().getNamespaces(tenant).contains(tenant + "/" + conf.getKopSchemaRegistryNamespace())) {
admin.namespaces().createNamespace(tenant + "/" + conf.getKopSchemaRegistryNamespace());
}
admin.namespaces()
.grantPermissionOnNamespace(tenant + "/" + conf.getKopSchemaRegistryNamespace(), SIMPLE_USER,
Sets.newHashSet(AuthAction.produce, AuthAction.consume));

String topic = "SchemaRegistryTest-testAvroProduceAndConsumeWithAuth" + withTokenPrefix;
IndexedRecord avroRecord = createAvroRecord();
Expand Down

0 comments on commit d4aaf9c

Please sign in to comment.