Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: BI-0 Remove SSL certificate error message matching for MySQL connector tests #751

Merged
merged 3 commits into from
Dec 17, 2024
Merged
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
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import re
from typing import Callable

import pytest
Expand Down Expand Up @@ -72,12 +71,9 @@ def check_data_source_templates(
assert dsrc_tmpl.title

@pytest.mark.parametrize(
"ssl_ca_filename, error_message",
"ssl_ca_filename",
[
(
"invalid-ca.pem",
r"\[SSL: CERTIFICATE_VERIFY_FAILED\] certificate verify failed: self-signed certificate in certificate chain",
),
"invalid-ca.pem", # [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self-signed certificate in certificate chain
# TODO: add cases for
# [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: IP address mismatch, certificate is not valid for ...
# [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: invalid CA certificate
Expand All @@ -88,7 +84,6 @@ def test_bad_ssl_ca(
saved_connection: ConnectionMySQL,
sync_conn_executor_factory: Callable[[], MySQLConnExecutor],
ssl_ca_filename: str,
error_message: str,
) -> None:
def sync_conn_executor_factory_for_conn(connection: ConnectionBase) -> MySQLConnExecutor:
return sync_conn_executor_factory()
Expand All @@ -104,7 +99,5 @@ def sync_conn_executor_factory_for_conn(connection: ConnectionBase) -> MySQLConn
ssl_ca = response.text

saved_connection.data.ssl_ca = ssl_ca
with pytest.raises(DatabaseOperationalError) as exc_info:
with pytest.raises(DatabaseOperationalError):
saved_connection.test(conn_executor_factory=sync_conn_executor_factory_for_conn)

assert re.search(error_message, exc_info.value.db_message)