From 0604bf4936125efc453f5e05ce86c18a1a7d138c Mon Sep 17 00:00:00 2001 From: Filipe Silva Date: Fri, 27 May 2022 15:41:23 +0100 Subject: [PATCH] Fix for AuthenticationTest.testWl14650() failures when running in Docker. Change-Id: I24eb516341400300de874327113ccc619f073b62 --- build.xml | 2 +- .../testsuite/simple/AuthenticationTest.java | 26 +++++++------------ 2 files changed, 10 insertions(+), 18 deletions(-) diff --git a/build.xml b/build.xml index 6e31439c8..d7e3ae866 100644 --- a/build.xml +++ b/build.xml @@ -1241,7 +1241,7 @@ See also com.mysql.cj.conf.PropertyDefinitions.SYSP_* variables for other test o - + diff --git a/src/test/java/testsuite/simple/AuthenticationTest.java b/src/test/java/testsuite/simple/AuthenticationTest.java index 3d4a0e02e..d7e3e6913 100644 --- a/src/test/java/testsuite/simple/AuthenticationTest.java +++ b/src/test/java/testsuite/simple/AuthenticationTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2021, Oracle and/or its affiliates. + * Copyright (c) 2020, 2022, Oracle and/or its affiliates. * * This program is free software; you can redistribute it and/or modify it under * the terms of the GNU General Public License, version 2.0, as published by the @@ -605,19 +605,16 @@ public void testWl14650() throws Exception { // TS.1.2: 2FA fail - 1st password wrong. props.setProperty(PropertyKey.password1.getKeyName(), "wrongpwd"); - assertThrows(SQLException.class, "Access denied for user 'wl14650_2fa'@'localhost' \\(using password: YES\\)", - () -> getConnectionWithProps(url1, props)); + assertThrows(SQLException.class, "Access denied for user 'wl14650_2fa'@.* \\(using password: YES\\)", () -> getConnectionWithProps(url1, props)); // TS.1.3: 2FA fail - 2nd password wrong. props.setProperty(PropertyKey.password1.getKeyName(), "testpwd1"); props.setProperty(PropertyKey.password2.getKeyName(), "wrongpwd"); - assertThrows(SQLException.class, "Access denied for user 'wl14650_2fa'@'localhost' \\(using password: YES\\)", - () -> getConnectionWithProps(url1, props)); + assertThrows(SQLException.class, "Access denied for user 'wl14650_2fa'@.* \\(using password: YES\\)", () -> getConnectionWithProps(url1, props)); // TS.1.4: 2FA fail - missing required password. props.remove(PropertyKey.password2.getKeyName()); - assertThrows(SQLException.class, "Access denied for user 'wl14650_2fa'@'localhost' \\(using password: YES\\)", - () -> getConnectionWithProps(url1, props)); + assertThrows(SQLException.class, "Access denied for user 'wl14650_2fa'@.* \\(using password: YES\\)", () -> getConnectionWithProps(url1, props)); // TS.2.1: 3FA successful. props.setProperty(PropertyKey.USER.getKeyName(), "wl14650_3fa"); @@ -635,25 +632,21 @@ public void testWl14650() throws Exception { // TS.2.2: 2FA fail - 1st password wrong. props.setProperty(PropertyKey.password1.getKeyName(), "wrongpwd"); - assertThrows(SQLException.class, "Access denied for user 'wl14650_3fa'@'localhost' \\(using password: YES\\)", - () -> getConnectionWithProps(url1, props)); + assertThrows(SQLException.class, "Access denied for user 'wl14650_3fa'@.* \\(using password: YES\\)", () -> getConnectionWithProps(url1, props)); // TS.2.3: 2FA fail - 2nd password wrong. props.setProperty(PropertyKey.password1.getKeyName(), "testpwd1"); props.setProperty(PropertyKey.password2.getKeyName(), "wrongpwd"); - assertThrows(SQLException.class, "Access denied for user 'wl14650_3fa'@'localhost' \\(using password: YES\\)", - () -> getConnectionWithProps(url1, props)); + assertThrows(SQLException.class, "Access denied for user 'wl14650_3fa'@.* \\(using password: YES\\)", () -> getConnectionWithProps(url1, props)); // TS.2.4: 2FA fail - 3rd password wrong. props.setProperty(PropertyKey.password2.getKeyName(), "testpwd2"); props.setProperty(PropertyKey.password3.getKeyName(), "wrongpwd"); - assertThrows(SQLException.class, "Access denied for user 'wl14650_3fa'@'localhost' \\(using password: YES\\)", - () -> getConnectionWithProps(url1, props)); + assertThrows(SQLException.class, "Access denied for user 'wl14650_3fa'@.* \\(using password: YES\\)", () -> getConnectionWithProps(url1, props)); // TS.2.5: 2FA fail - missing required password. props.remove(PropertyKey.password3.getKeyName()); - assertThrows(SQLException.class, "Access denied for user 'wl14650_3fa'@'localhost' \\(using password: YES\\)", - () -> getConnectionWithProps(url1, props)); + assertThrows(SQLException.class, "Access denied for user 'wl14650_3fa'@.* \\(using password: YES\\)", () -> getConnectionWithProps(url1, props)); // TS.3/TS.4/TS.5: new password options don't pollute original ones. props.setProperty(PropertyKey.USER.getKeyName(), "wl14650_1fa"); @@ -732,8 +725,7 @@ public void testWl14650() throws Exception { final StringBuilder urlBuilder7 = new StringBuilder("jdbc:mysql://").append(getHostFromTestsuiteUrl()).append(":").append(getPortFromTestsuiteUrl()) .append("/"); final String url7 = urlBuilder7.toString(); - assertThrows(SQLException.class, "Access denied for user 'wl14650_1fa'@'localhost' \\(using password: YES\\)", - () -> getConnectionWithProps(url7, props)); + assertThrows(SQLException.class, "Access denied for user 'wl14650_1fa'@.* \\(using password: YES\\)", () -> getConnectionWithProps(url7, props)); } finally { if (installPluginInRuntime) { this.stmt.executeUpdate("UNINSTALL PLUGIN cleartext_plugin_server");