lhotari commented on code in PR #22594:
URL: https://github.com/apache/pulsar/pull/22594#discussion_r1580497194
##########
pulsar-broker/src/test/java/org/apache/pulsar/broker/admin/NamespaceAuthZTest.java:
##########
@@ -1028,4 +1019,43 @@ public void testPackageAPI() throws Exception {
superUserAdmin.namespaces().revokePermissionsOnNamespace(namespace, subject);
}
}
+
+ @Test
+ @SneakyThrows
+ public void testOffloadThresholdInSeconds() {
+ final String namespace = "public/default";
+ final String subject = UUID.randomUUID().toString();
+ final String token = Jwts.builder()
+ .claim("sub", subject).signWith(SECRET_KEY).compact();
+ @Cleanup final PulsarAdmin subAdmin = PulsarAdmin.builder()
+ .serviceHttpUrl(getPulsarService().getWebServiceAddress())
+ .authentication(new AuthenticationToken(token))
+ .build();
+ Assert.assertThrows(PulsarAdminException.NotAuthorizedException.class,
+ () ->
subAdmin.namespaces().getOffloadThresholdInSeconds(namespace));
+
+ Assert.assertThrows(PulsarAdminException.NotAuthorizedException.class,
+ () ->
subAdmin.namespaces().setOffloadThresholdInSeconds(namespace, 10000));
+ }
+
+ @Test
+ @SneakyThrows
+ public void testMaxSubscriptionsPerTopic() {
+ final String namespace = "public/default";
+ final String subject = UUID.randomUUID().toString();
+ final String token = Jwts.builder()
+ .claim("sub", subject).signWith(SECRET_KEY).compact();
+ @Cleanup final PulsarAdmin subAdmin = PulsarAdmin.builder()
+ .serviceHttpUrl(getPulsarService().getWebServiceAddress())
+ .authentication(new AuthenticationToken(token))
+ .build();
+ Assert.assertThrows(PulsarAdminException.NotAuthorizedException.class,
+ () ->
subAdmin.namespaces().getMaxSubscriptionsPerTopic(namespace));
+
+ Assert.assertThrows(PulsarAdminException.NotAuthorizedException.class,
+ () ->
subAdmin.namespaces().setMaxSubscriptionsPerTopic(namespace, 100));
+
+ Assert.assertThrows(PulsarAdminException.NotAuthorizedException.class,
+ () ->
subAdmin.namespaces().removeMaxSubscriptionsPerTopic(namespace));
+ }
Review Comment:
Are these part of some other change?
--
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]