Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions pyignite/connection/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,6 @@ def __init__(self, client, host: str = None, port: int = None, username: str = N

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

Expand Down
29 changes: 25 additions & 4 deletions tests/security/test_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand Down