Skip to content

Commit f26d98c

Browse files
committed
Fix: failing unittest connection.WL14263 unable to load ldap plugin
Test connection.WL14263.test_authentication_ldap_sasl_client must be skipped if authentication_ldap_sasl does not support SCRAM-SHA-256.
1 parent 9768ffc commit f26d98c

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

tests/__init__.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -996,6 +996,7 @@ def is_plugin_available(plugin_name, config_vars=None, in_server=None):
996996
server = in_server if in_server else MYSQL_SERVERS[0]
997997
plugin_config_vars = config_vars if config_vars else []
998998
server_cnf = server._cnf
999+
server_cnf_bkp = server._cnf
9991000
config = get_mysql_config(server.name)
10001001

10011002
ext = "dll" if os.name == "nt" else "so"
@@ -1029,14 +1030,14 @@ def is_plugin_available(plugin_name, config_vars=None, in_server=None):
10291030
cnx.close()
10301031
return available
10311032
except:
1032-
pass
1033+
LOGGER.warning("# Unable to load plugin '{}'.".format(plugin_name))
10331034
finally:
10341035
server.stop()
10351036
server.wait_down()
1036-
server.start(my_cnf=server_cnf)
1037+
server.start(my_cnf=server_cnf_bkp)
10371038
server.wait_up()
10381039
sleep(1)
1039-
return available
1040+
return available
10401041

10411042
def check_tls_versions_support(tls_versions):
10421043
"""Check whether we can connect with given TLS version

tests/test_connection.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2837,12 +2837,14 @@ def test_clear_text_pass(self):
28372837
self.assertRaises(InterfaceError, self.cnx.__class__, **conn_args)
28382838

28392839

2840-
@unittest.skipIf(tests.MYSQL_VERSION < (5, 7),
2840+
plugin_opts = (("authentication_ldap_sasl_auth_method_name", "SCRAM-SHA-256"),)
2841+
@unittest.skipIf(tests.MYSQL_VERSION < (8, 2, 22),
28412842
"Authentication with ldap_simple not supported")
28422843
#Skip if remote ldap server is not reachable.
28432844
@unittest.skipIf(not tests.is_host_reachable("100.103.19.5"),
28442845
"ldap server is not reachable")
2845-
@unittest.skipIf(not tests.is_plugin_available("authentication_ldap_sasl"),
2846+
@unittest.skipIf(not tests.is_plugin_available("authentication_ldap_sasl",
2847+
plugin_opts),
28462848
"Plugin authentication_ldap_simple not available")
28472849
class WL14263(tests.MySQLConnectorTests):
28482850
"""WL#14110: Add support for SCRAM-SHA-256

0 commit comments

Comments
 (0)