This is an automated email from the ASF dual-hosted git repository.

nizhikov pushed a commit to branch ignite-ducktape
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/ignite-ducktape by this push:
     new ccd1d4d  IGNITE-14600 SSL test for thin client (#9071)
ccd1d4d is described below

commit ccd1d4d5bc70dbfa9d56519fb7a3b96b94b18a6a
Author: eadha <[email protected]>
AuthorDate: Tue May 11 15:44:09 2021 +0300

    IGNITE-14600 SSL test for thin client (#9071)
---
 .../services/utils/ignite_configuration/__init__.py  | 20 +++++++++++++++++---
 .../utils/templates/thin_client_config.xml.j2        | 10 ++++++++++
 .../tests/ignitetest/tests/thin_client_test.py       |  2 ++
 3 files changed, 29 insertions(+), 3 deletions(-)

diff --git 
a/modules/ducktests/tests/ignitetest/services/utils/ignite_configuration/__init__.py
 
b/modules/ducktests/tests/ignitetest/services/utils/ignite_configuration/__init__.py
index 18b93c1..5f6d433 100644
--- 
a/modules/ducktests/tests/ignitetest/services/utils/ignite_configuration/__init__.py
+++ 
b/modules/ducktests/tests/ignitetest/services/utils/ignite_configuration/__init__.py
@@ -79,7 +79,9 @@ class IgniteConfiguration(NamedTuple):
         if ssl_params:
             return self._replace(ssl_params=ssl_params,
                                  
connector_configuration=ConnectorConfiguration(ssl_enabled=True,
-                                                                               
 ssl_params=ssl_params))
+                                                                               
 ssl_params=ssl_params),
+                                 
client_connector_configuration=ClientConnectorConfiguration(ssl_enabled=True,
+                                                                               
              ssl_params=ssl_params))
         return self
 
     def __prepare_discovery(self, cluster, node):
@@ -124,13 +126,25 @@ class IgniteThinClientConfiguration(NamedTuple):
     """
     addresses: str = None
     version: IgniteVersion = DEV_BRANCH
+    ssl_params: SslParams = None
 
-    # pylint: disable=unused-argument
+    def __prepare_ssl(self, test_globals, shared_root):
+        """
+        Updates ssl configuration from globals.
+        """
+        ssl_params = None
+        if self.ssl_params is None and is_ssl_enabled(test_globals):
+            ssl_params = get_ssl_params(test_globals, shared_root, 
IGNITE_CLIENT_ALIAS)
+        if ssl_params:
+            return self._replace(ssl_params=ssl_params)
+        return self
+
+    # pylint: disable=unused-argument,protected-access
     def prepare_for_env(self, cluster, node):
         """
         Updates configuration based on current environment.
         """
-        return self
+        return self.__prepare_ssl(cluster.globals, cluster.shared_root)
 
     @property
     def service_type(self):
diff --git 
a/modules/ducktests/tests/ignitetest/services/utils/templates/thin_client_config.xml.j2
 
b/modules/ducktests/tests/ignitetest/services/utils/templates/thin_client_config.xml.j2
index 14ec921..e58b02a 100644
--- 
a/modules/ducktests/tests/ignitetest/services/utils/templates/thin_client_config.xml.j2
+++ 
b/modules/ducktests/tests/ignitetest/services/utils/templates/thin_client_config.xml.j2
@@ -15,6 +15,8 @@
  limitations under the License.
 #}
 
+{% import 'ssl_params_macro.j2' as ssl_params_util %}
+
 <?xml version="1.0" encoding="UTF-8"?>
 <beans xmlns="http://www.springframework.org/schema/beans";
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
@@ -25,5 +27,13 @@
                 <value>{{ config.addresses }}</value>
             </list>
         </property>
+
+        {% if config.ssl_params %}
+        <property name="sslMode" value="REQUIRED"/>
+        <property name="sslClientCertificateKeyStorePath" value="{{ 
config.ssl_params.key_store_path }}"/>
+        <property name="sslClientCertificateKeyStorePassword" value="{{ 
config.ssl_params.key_store_password }}"/>
+        <property name="sslTrustCertificateKeyStorePath" value="{{ 
config.ssl_params.trust_store_path }}"/>
+        <property name="sslTrustCertificateKeyStorePassword" value="{{ 
config.ssl_params.trust_store_password }}"/>
+        {% endif %}
     </bean>
 </beans>
diff --git a/modules/ducktests/tests/ignitetest/tests/thin_client_test.py 
b/modules/ducktests/tests/ignitetest/tests/thin_client_test.py
index d7e3eae..65d4f91 100644
--- a/modules/ducktests/tests/ignitetest/tests/thin_client_test.py
+++ b/modules/ducktests/tests/ignitetest/tests/thin_client_test.py
@@ -32,6 +32,8 @@ class ThinClientTest(IgniteTest):
     """
     cluster - cluster size.
     JAVA_CLIENT_CLASS_NAME - running classname.
+    to use with ssl enabled:
+    export GLOBALS='{"ssl":{"enabled":true}}' .
     """
 
     JAVA_CLIENT_CLASS_NAME = 
"org.apache.ignite.internal.ducktest.tests.thin_client_test.ThinClientSelfTestApplication"

Reply via email to