FrankYang0529 commented on code in PR #17424:
URL: https://github.com/apache/kafka/pull/17424#discussion_r1806631792
##########
core/src/test/scala/unit/kafka/security/authorizer/AuthorizerTest.scala:
##########
@@ -786,291 +614,17 @@ class AuthorizerTest extends QuorumTestHarness with
BaseAuthorizerTest {
}
assertEquals(Set(acl3, acl4),
deleteResults(0).aclBindingDeleteResults.asScala.map(_.aclBinding).toSet)
assertEquals(Set(acl1),
deleteResults(1).aclBindingDeleteResults.asScala.map(_.aclBinding).toSet)
- if (quorum.equals(ZK)) {
- assertEquals(Set.empty,
deleteResults(2).aclBindingDeleteResults.asScala.map(_.aclBinding).toSet)
- } else {
- // standard authorizer first finds the acls that match filters and then
delete them.
- // So filters[2] will match acl3 even though it is also matching
filters[0] and will be deleted by it
- assertEquals(Set(acl3),
deleteResults(2).aclBindingDeleteResults.asScala.map(_.aclBinding).toSet)
- }
+ // standard authorizer first finds the acls that match filters and then
delete them.
+ // So filters[2] will match acl3 even though it is also matching
filters[0] and will be deleted by it
+ assertEquals(Set(acl3),
deleteResults(2).aclBindingDeleteResults.asScala.map(_.aclBinding).toSet)
assertEquals(Set.empty,
deleteResults(3).aclBindingDeleteResults.asScala.map(_.aclBinding).toSet)
}
- @Test
- def testThrowsOnAddPrefixedAclIfInterBrokerProtocolVersionTooLow(): Unit = {
- givenAuthorizerWithProtocolVersion(Option(IBP_2_0_IV0))
- val e = assertThrows(classOf[ApiException],
- () => addAcls(authorizer1, Set(denyReadAcl), new ResourcePattern(TOPIC,
"z_other", PREFIXED)))
- assertTrue(e.getCause.isInstanceOf[UnsupportedVersionException],
s"Unexpected exception $e")
- }
-
- @Test
Review Comment:
Hi @mimaison, thanks for catching this. In `AuthorizerTest`,
`StandardAuthorizer` uses `MockAclMutator`, so this test can't pass. I tried to
migrate the case to `AuthorizerIntegrationTest`, but the implementation of
validating acl is different between `AclAuthorizer#validateAclBinding` and
`AclControlManager#validateNewAcl`. Do you think that we should add `/` check
for it? Thanks.
https://github.com/apache/kafka/blob/b917b85e62373ca66ef249c86b102b5ef8ee7195/core/src/main/scala/kafka/security/authorizer/AclAuthorizer.scala#L122-L127
https://github.com/apache/kafka/blob/b917b85e62373ca66ef249c86b102b5ef8ee7195/metadata/src/main/java/org/apache/kafka/controller/AclControlManager.java#L127-L163
--
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]