From f00c9375aa823517b14439e8f0507d37e6c14e74 Mon Sep 17 00:00:00 2001 From: Michael Marshall Date: Thu, 4 Apr 2024 18:14:17 -0500 Subject: [PATCH] Modify test to make it work for new design --- .../client/api/AuthorizationProducerConsumerTest.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pulsar-broker/src/test/java/org/apache/pulsar/client/api/AuthorizationProducerConsumerTest.java b/pulsar-broker/src/test/java/org/apache/pulsar/client/api/AuthorizationProducerConsumerTest.java index 1091a41b5ce5b..f547052344d72 100644 --- a/pulsar-broker/src/test/java/org/apache/pulsar/client/api/AuthorizationProducerConsumerTest.java +++ b/pulsar-broker/src/test/java/org/apache/pulsar/client/api/AuthorizationProducerConsumerTest.java @@ -371,7 +371,10 @@ public void testSubscriberPermission() throws Exception { public void testSubscriberPermissionRequired() throws Exception { log.info("-- Starting {} test --", methodName); + // Simplify test by skipping configuration of topic level policies + conf.setTopicLevelPoliciesEnabled(false); conf.setAuthorizationProvider(PulsarAuthorizationProvider.class.getName()); + conf.setGrantImplicitPermissionOnSubscription(false); setup(); final String tenantRole = "tenant-role"; @@ -401,17 +404,14 @@ public void testSubscriberPermissionRequired() throws Exception { superAdmin.clusters().createCluster("test", ClusterData.builder().serviceUrl(brokerUrl.toString()).build()); - // Initialize cluster and configure namespace to require permission on subscription + // Initialize cluster and create namespace and topic superAdmin.tenants().createTenant("my-property", new TenantInfoImpl(Sets.newHashSet(tenantRole), Sets.newHashSet("test"))); superAdmin.namespaces().createNamespace(namespace, Sets.newHashSet("test")); - assertFalse(superAdmin.namespaces().getPermissionOnSubscriptionRequired(namespace), "Defaults to false."); - superAdmin.namespaces().setPermissionOnSubscriptionRequired(namespace, true); tenantAdmin.topics().createNonPartitionedTopic(topicName); tenantAdmin.topics().grantPermission(topicName, subscriptionRole, Collections.singleton(AuthAction.consume)); assertNull(superAdmin.namespaces().getPublishRate(namespace)); - assertTrue(superAdmin.namespaces().getPermissionOnSubscriptionRequired(namespace)); replacePulsarClient(PulsarClient.builder() .serviceUrl(pulsar.getBrokerServiceUrl()) .authentication(authentication));