Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix][broker] fix can not revoke permission after update topic partition #17393

Merged
merged 2 commits into from
Sep 5, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
add unittest for revoke permission of topic after update topic partition
  • Loading branch information
fanjianye committed Aug 31, 2022
commit 7e4e13487d0d1e893c9636085914b2f4b48428ea
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,8 @@ public void testProxyAuthorization() throws Exception {
* 2. Update the topic partition number to 4.
* 3. Use new producer/consumer with client role to process the topic.
* 4. Broker should authorize producer/consumer normally.
* 5. revoke produce/consumer permission of topic
* 6. new producer/consumer should not be authorized
* </pre>
*/
@Test
Expand Down Expand Up @@ -297,6 +299,26 @@ public void testUpdatePartitionNumAndReconnect() throws Exception {
Assert.assertEquals(messageSet, receivedMessageSet);
consumer.close();
producer.close();

// revoke produce/consume permission
admin.topics().revokePermissions(topicName, CLIENT_ROLE);
nodece marked this conversation as resolved.
Show resolved Hide resolved

// produce/consume the topic should fail
try {
consumer = proxyClient.newConsumer()
.topic(topicName)
.subscriptionName(subscriptionName).subscribe();
Assert.fail("Should not pass");
} catch (PulsarClientException.AuthorizationException ex) {
// ok
}
try {
producer = proxyClient.newProducer(Schema.BYTES)
.topic(topicName).create();
Assert.fail("Should not pass");
} catch (PulsarClientException.AuthorizationException ex) {
// ok
}
log.info("-- Exiting {} test --", methodName);
}

Expand Down