Skip to content

Commit 5a8e42f

Browse files
authored
GG-35312 use_ssl is not set when auth used (#61)
1 parent 1335fd1 commit 5a8e42f

File tree

2 files changed

+25
-7
lines changed

2 files changed

+25
-7
lines changed

pygridgain/connection/connection.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,6 @@ def __init__(self, client, host: str = None, port: int = None, username: str = N
5252

5353
check_ssl_params(ssl_params)
5454

55-
if self.username and self.password and 'use_ssl' not in ssl_params:
56-
ssl_params['use_ssl'] = True
57-
5855
self.ssl_params = ssl_params
5956
self._failed = False
6057

tests/security/test_auth.py

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,7 @@ def cleanup():
4747
clear_ignite_work_dir()
4848

4949

50-
def test_auth_success(with_ssl, ssl_params, caplog):
51-
ssl_params['use_ssl'] = with_ssl
50+
def check_auth_success(ssl_params, caplog):
5251
listener = AccumulatingConnectionListener()
5352
client = Client(username=DEFAULT_IGNITE_USERNAME, password=DEFAULT_IGNITE_PASSWORD,
5453
event_listeners=[listener], **ssl_params)
@@ -61,9 +60,18 @@ def test_auth_success(with_ssl, ssl_params, caplog):
6160
__assert_successful_connect_events(conn, listener)
6261

6362

64-
@pytest.mark.asyncio
65-
async def test_auth_success_async(with_ssl, ssl_params, caplog):
63+
def test_auth_success_no_explicit_ssl(with_ssl, ssl_params, caplog):
64+
if with_ssl:
65+
ssl_params['use_ssl'] = with_ssl
66+
check_auth_success(ssl_params, caplog)
67+
68+
69+
def test_auth_success(with_ssl, ssl_params, caplog):
6670
ssl_params['use_ssl'] = with_ssl
71+
check_auth_success(ssl_params, caplog)
72+
73+
74+
async def check_auth_success_async(ssl_params, caplog):
6775
listener = AccumulatingConnectionListener()
6876
client = AioClient(username=DEFAULT_IGNITE_USERNAME, password=DEFAULT_IGNITE_PASSWORD,
6977
event_listeners=[listener], **ssl_params)
@@ -76,6 +84,19 @@ async def test_auth_success_async(with_ssl, ssl_params, caplog):
7684
__assert_successful_connect_events(conn, listener)
7785

7886

87+
@pytest.mark.asyncio
88+
async def test_auth_success_no_explicit_ssl_async(with_ssl, ssl_params, caplog):
89+
if with_ssl:
90+
ssl_params['use_ssl'] = with_ssl
91+
await check_auth_success_async(ssl_params, caplog)
92+
93+
94+
@pytest.mark.asyncio
95+
async def test_auth_success_async(with_ssl, ssl_params, caplog):
96+
ssl_params['use_ssl'] = with_ssl
97+
await check_auth_success_async(ssl_params, caplog)
98+
99+
79100
def __assert_successful_connect_log(conn, caplog):
80101
assert any(re.match(rf'Connecting to node\(address={conn.host},\s+port={conn.port}', r.message)
81102
for r in caplog.records)

0 commit comments

Comments
 (0)