iaorekhov-1980 commented on code in PR #60275:
URL: https://github.com/apache/doris/pull/60275#discussion_r2769416439


##########
fe/fe-core/src/test/java/org/apache/doris/mysql/authenticate/ldap/LdapClientTest.java:
##########
@@ -95,4 +97,28 @@ public void testGetGroups() {
         };
         Assert.assertEquals(1, ldapClient.getGroups("zhangsan").size());
     }
+
+    @Test
+    public void testSecuredProtocolIsUsed() {
+        //testing default case with not specified property ldap_use_ssl or it 
is specified as false
+        String insecureUrl = LdapConfig.getConnectionURL(
+                NetUtils.getHostPortInAccessibleFormat(LdapConfig.ldap_host, 
LdapConfig.ldap_port));
+
+        Assert.assertNotNull("connection URL should not be null", insecureUrl);
+        Assert.assertTrue("with ldap_use_ssl = false or not specified URL 
should start with ldap, but received: " + insecureUrl,
+                          insecureUrl.startsWith("ldap://";));
+
+        //testing new case with specified property ldap_use_ssl as true
+        LdapConfig.ldap_use_ssl = true;
+        String secureUrl = LdapConfig.getConnectionURL(
+                NetUtils.getHostPortInAccessibleFormat(LdapConfig.ldap_host, 
LdapConfig.ldap_port));
+        Assert.assertNotNull("connection URL should not be null", secureUrl);
+        Assert.assertTrue("with ldap_use_ssl = true URL should start with 
ldaps, but received: " + secureUrl,
+                          secureUrl.startsWith("ldaps://"));
+    }

Review Comment:
   It is correct comment.
   I've introduce the change to specify ldap_use_ssl property as false in setUp 
method to avoid any issue with concurrent execution of tests in commit 
https://github.com/apache/doris/pull/60275/commits/89ad517796e64d2835b7e4ba9f7d4c84b141d428



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to