Skip to content

Commit

Permalink
Modify test to make it work for new design
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeljmarshall committed Apr 4, 2024
1 parent 85e8409 commit f00c937
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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));
Expand Down

0 comments on commit f00c937

Please sign in to comment.