chia7712 commented on code in PR #22184:
URL: https://github.com/apache/kafka/pull/22184#discussion_r3610101508


##########
test-common/test-common-runtime/src/test/java/org/apache/kafka/common/test/TestKitNodeTest.java:
##########
@@ -32,14 +32,21 @@ public class TestKitNodeTest {
     @ParameterizedTest
     @EnumSource(SecurityProtocol.class)
     public void testSecurityProtocol(SecurityProtocol securityProtocol) {
-        if (securityProtocol != SecurityProtocol.PLAINTEXT && securityProtocol 
!= SecurityProtocol.SASL_PLAINTEXT && securityProtocol != 
SecurityProtocol.SASL_SSL) {
-            assertEquals("Currently only support PLAINTEXT / SASL_PLAINTEXT / 
SASL_SSL security protocol",
-                assertThrows(IllegalArgumentException.class,
-                    () -> new 
TestKitNodes.Builder().setBrokerSecurityProtocol(securityProtocol).build()).getMessage());
-            assertEquals("Currently only support PLAINTEXT / SASL_PLAINTEXT / 
SASL_SSL security protocol",
-                assertThrows(IllegalArgumentException.class,
-                    () -> new 
TestKitNodes.Builder().setControllerSecurityProtocol(securityProtocol).build()).getMessage());
-        }
+        // All security protocols are supported when broker and controller 
configurations are consistent
+        new TestKitNodes.Builder()
+            .setBrokerSecurityProtocol(securityProtocol)
+            .setControllerSecurityProtocol(securityProtocol)
+            .build();
+    }
+
+    @Test
+    public void testMixedSslSecurityProtocolIsNotSupported() {
+        assertEquals("Mixed broker and controller SSL security protocol 
configurations are not yet supported",

Review Comment:
   It seems `ClusterInstance` assumes both protocols are identical. We could 
revisit this test and check things in the follow-up.



##########
test-common/test-common-runtime/src/test/java/org/apache/kafka/common/test/junit/ClusterTestExtensionsTest.java:
##########
@@ -595,4 +599,41 @@ private static void testSecurityProtocol(ClusterInstance 
clusterInstance) throws
             assertInstanceOf(SaslAuthenticationException.class, 
exception.getCause());
         }
     }
+
+    @ClusterTest(
+        types = {Type.KRAFT, Type.CO_KRAFT},
+        brokerSecurityProtocol = SecurityProtocol.SSL,
+        controllerSecurityProtocol = SecurityProtocol.SSL,
+        serverProperties = {
+            @ClusterConfigProperty(key = 
GroupCoordinatorConfig.OFFSETS_TOPIC_PARTITIONS_CONFIG, value = "1"),
+            @ClusterConfigProperty(key = 
GroupCoordinatorConfig.OFFSETS_TOPIC_REPLICATION_FACTOR_CONFIG, value = "1")
+        }
+    )
+    public void testSsl(ClusterInstance clusterInstance) throws 
InterruptedException, ExecutionException {
+        KafkaBroker broker = 
clusterInstance.brokers().values().iterator().next();
+        ControllerServer controller = 
clusterInstance.controllers().values().iterator().next();
+        Function<SocketServer, String> endpoints = socketServer -> 
Collections.list(socketServer.dataPlaneAcceptors().keys())

Review Comment:
   ```java
   socketServer.dataPlaneAcceptors().keySet()
   ```



##########
test-common/test-common-runtime/src/main/java/org/apache/kafka/common/test/TestKitNodes.java:
##########
@@ -162,10 +162,19 @@ public TestKitNodes build() {
             if (numDisksPerBroker <= 0) {
                 throw new IllegalArgumentException("Invalid value for 
numDisksPerBroker");
             }
-            // TODO: remove this assertion after 
https://issues.apache.org/jira/browse/KAFKA-16680 is finished
-            if ((brokerSecurityProtocol != SecurityProtocol.PLAINTEXT && 
brokerSecurityProtocol != SecurityProtocol.SASL_PLAINTEXT && 
brokerSecurityProtocol != SecurityProtocol.SASL_SSL) ||
-                (controllerSecurityProtocol != SecurityProtocol.PLAINTEXT && 
controllerSecurityProtocol != SecurityProtocol.SASL_PLAINTEXT && 
brokerSecurityProtocol != SecurityProtocol.SASL_SSL)) {
-                throw new IllegalArgumentException("Currently only support 
PLAINTEXT / SASL_PLAINTEXT / SASL_SSL security protocol");
+            var supportedProtocols = List.of(
+                    SecurityProtocol.PLAINTEXT,
+                    SecurityProtocol.SASL_PLAINTEXT,
+                    SecurityProtocol.SASL_SSL,
+                    SecurityProtocol.SSL
+            );
+            if (!supportedProtocols.contains(brokerSecurityProtocol) || 
!supportedProtocols.contains(controllerSecurityProtocol)) {

Review Comment:
   All protocols are supported now, so those checks are unnecessary now.



-- 
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]

Reply via email to