Skip to content

Commit bc5a52c

Browse files
authored
IGNITE-17494 use_ssl is not set when auth used (#55)
1 parent bf5ac4f commit bc5a52c

2 files changed

Lines changed: 25 additions & 7 deletions

File tree

pyignite/connection/connection.py

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

4949
check_ssl_params(ssl_params)
5050

51-
if self.username and self.password and 'use_ssl' not in ssl_params:
52-
ssl_params['use_ssl'] = True
53-
5451
self.ssl_params = ssl_params
5552
self._failed = False
5653

tests/security/test_auth.py

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

4848

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

6261

63-
@pytest.mark.asyncio
64-
async def test_auth_success_async(with_ssl, ssl_params, caplog):
62+
def test_auth_success_no_explicit_ssl(with_ssl, ssl_params, caplog):
63+
if with_ssl:
64+
ssl_params['use_ssl'] = with_ssl
65+
check_auth_success(ssl_params, caplog)
66+
67+
68+
def test_auth_success(with_ssl, ssl_params, caplog):
6569
ssl_params['use_ssl'] = with_ssl
70+
check_auth_success(ssl_params, caplog)
71+
72+
73+
async def check_auth_success_async(ssl_params, caplog):
6674
listener = AccumulatingConnectionListener()
6775
client = AioClient(username=DEFAULT_IGNITE_USERNAME, password=DEFAULT_IGNITE_PASSWORD,
6876
event_listeners=[listener], **ssl_params)
@@ -75,6 +83,19 @@ async def test_auth_success_async(with_ssl, ssl_params, caplog):
7583
__assert_successful_connect_events(conn, listener)
7684

7785

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

0 commit comments

Comments
 (0)