Skip to content

Commit 0a0aeb2

Browse files
test(tls): pin use_tls=False to client config, not negotiated cipher
test_insecure_connection asserted Ssl_cipher == '', but a MySQL 8 server with TLS configured (the datajoint/mysql:8.0 test image) can negotiate TLS during connection setup even when the client requests no SSL. Whether the cipher ends up empty depends on the resolved client stack, so the assertion passed on the py3.13 solve but failed on the py3.10/py3.14 matrix added in this PR. Assert what DataJoint actually controls: use_tls=False sends no client-side SSL config and the connection is usable.
1 parent 2aeda24 commit 0a0aeb2

1 file changed

Lines changed: 15 additions & 3 deletions

File tree

tests/integration/test_tls.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,21 @@ def test_ssl_auto_detect(db_creds_test, connection_test, caplog):
3838

3939

4040
def test_insecure_connection(db_creds_test, connection_test):
41-
"""When use_tls=False, SSL should not be used."""
42-
result = dj.conn(use_tls=False, reset=True, **db_creds_test).query("SHOW STATUS LIKE 'Ssl_cipher';").fetchone()[1]
43-
assert result == ""
41+
"""When use_tls=False, DataJoint must not configure client-side TLS.
42+
43+
Note: this pins what DataJoint controls, not the negotiated cipher. A
44+
MySQL 8 server with TLS configured may still negotiate TLS during
45+
connection setup (e.g. to protect the auth handshake) even when the client
46+
requests no SSL, so ``Ssl_cipher`` is not guaranteed to be empty and must
47+
not be asserted on — doing so made this test depend on the resolved client
48+
stack rather than on DataJoint behavior.
49+
"""
50+
conn = dj.conn(use_tls=False, reset=True, **db_creds_test)
51+
# DataJoint sent no client-side SSL configuration.
52+
assert conn.conn_info.get("ssl_input") is False
53+
assert "ssl" not in conn.conn_info
54+
# The connection is usable without client TLS.
55+
assert conn.query("SELECT 1").fetchone()[0] == 1
4456

4557

4658
@requires_ssl

0 commit comments

Comments
 (0)