You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by is...@apache.org on 2022/08/09 08:15:55 UTC

[ignite-python-thin-client] branch master updated: IGNITE-17494 use_ssl is not set when auth used (#55)

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

isapego pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite-python-thin-client.git


The following commit(s) were added to refs/heads/master by this push:
     new bc5a52c  IGNITE-17494 use_ssl is not set when auth used (#55)
bc5a52c is described below

commit bc5a52c1c9b70136a63240da9749cabcb5c14c0e
Author: Igor Sapego <is...@apache.org>
AuthorDate: Tue Aug 9 11:15:51 2022 +0300

    IGNITE-17494 use_ssl is not set when auth used (#55)
---
 pyignite/connection/connection.py |  3 ---
 tests/security/test_auth.py       | 29 +++++++++++++++++++++++++----
 2 files changed, 25 insertions(+), 7 deletions(-)

diff --git a/pyignite/connection/connection.py b/pyignite/connection/connection.py
index 3d86f01..4596e23 100644
--- a/pyignite/connection/connection.py
+++ b/pyignite/connection/connection.py
@@ -48,9 +48,6 @@ class BaseConnection:
 
         check_ssl_params(ssl_params)
 
-        if self.username and self.password and 'use_ssl' not in ssl_params:
-            ssl_params['use_ssl'] = True
-
         self.ssl_params = ssl_params
         self._failed = False
 
diff --git a/tests/security/test_auth.py b/tests/security/test_auth.py
index 83ac780..f4ca29b 100644
--- a/tests/security/test_auth.py
+++ b/tests/security/test_auth.py
@@ -46,8 +46,7 @@ def cleanup():
     clear_ignite_work_dir()
 
 
-def test_auth_success(with_ssl, ssl_params, caplog):
-    ssl_params['use_ssl'] = with_ssl
+def check_auth_success(ssl_params, caplog):
     listener = AccumulatingConnectionListener()
     client = Client(username=DEFAULT_IGNITE_USERNAME, password=DEFAULT_IGNITE_PASSWORD,
                     event_listeners=[listener], **ssl_params)
@@ -60,9 +59,18 @@ def test_auth_success(with_ssl, ssl_params, caplog):
         __assert_successful_connect_events(conn, listener)
 
 
-@pytest.mark.asyncio
-async def test_auth_success_async(with_ssl, ssl_params, caplog):
+def test_auth_success_no_explicit_ssl(with_ssl, ssl_params, caplog):
+    if with_ssl:
+        ssl_params['use_ssl'] = with_ssl
+    check_auth_success(ssl_params, caplog)
+
+
+def test_auth_success(with_ssl, ssl_params, caplog):
     ssl_params['use_ssl'] = with_ssl
+    check_auth_success(ssl_params, caplog)
+
+
+async def check_auth_success_async(ssl_params, caplog):
     listener = AccumulatingConnectionListener()
     client = AioClient(username=DEFAULT_IGNITE_USERNAME, password=DEFAULT_IGNITE_PASSWORD,
                        event_listeners=[listener], **ssl_params)
@@ -75,6 +83,19 @@ async def test_auth_success_async(with_ssl, ssl_params, caplog):
         __assert_successful_connect_events(conn, listener)
 
 
+@pytest.mark.asyncio
+async def test_auth_success_no_explicit_ssl_async(with_ssl, ssl_params, caplog):
+    if with_ssl:
+        ssl_params['use_ssl'] = with_ssl
+    await check_auth_success_async(ssl_params, caplog)
+
+
+@pytest.mark.asyncio
+async def test_auth_success_async(with_ssl, ssl_params, caplog):
+    ssl_params['use_ssl'] = with_ssl
+    await check_auth_success_async(ssl_params, caplog)
+
+
 def __assert_successful_connect_log(conn, caplog):
     assert any(re.match(rf'Connecting to node\(address={conn.host},\s+port={conn.port}', r.message)
                for r in caplog.records)