This is an automated email from the ASF dual-hosted git repository.
FrankChen021 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/druid.git
The following commit(s) were added to refs/heads/master by this push:
new ad6899ebf64 fix: Added all possible exceptions to
MySQLInputSourceDatabaseConnectorTest (#18734)
ad6899ebf64 is described below
commit ad6899ebf644957b606ef67a716400a024290e15
Author: Edwin Ing <[email protected]>
AuthorDate: Sat May 9 23:37:44 2026 -0700
fix: Added all possible exceptions to MySQLInputSourceDatabaseConnectorTest
(#18734)
* Added all possible exceptions to tests
* Added dependency to pom.xml
---
extensions-core/mysql-metadata-storage/pom.xml | 6 ++++++
.../MySQLInputSourceDatabaseConnectorTest.java | 22 +++++++++++++++++++---
2 files changed, 25 insertions(+), 3 deletions(-)
diff --git a/extensions-core/mysql-metadata-storage/pom.xml
b/extensions-core/mysql-metadata-storage/pom.xml
index 6938770dbdf..c961d8d97b8 100644
--- a/extensions-core/mysql-metadata-storage/pom.xml
+++ b/extensions-core/mysql-metadata-storage/pom.xml
@@ -121,6 +121,12 @@
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.hamcrest</groupId>
+ <artifactId>hamcrest</artifactId>
+ <version>2.2</version>
+ <scope>test</scope>
+ </dependency>
</dependencies>
</project>
diff --git
a/extensions-core/mysql-metadata-storage/src/test/java/org/apache/druid/metadata/input/MySQLInputSourceDatabaseConnectorTest.java
b/extensions-core/mysql-metadata-storage/src/test/java/org/apache/druid/metadata/input/MySQLInputSourceDatabaseConnectorTest.java
index 1ed7214aa96..a735ce61047 100644
---
a/extensions-core/mysql-metadata-storage/src/test/java/org/apache/druid/metadata/input/MySQLInputSourceDatabaseConnectorTest.java
+++
b/extensions-core/mysql-metadata-storage/src/test/java/org/apache/druid/metadata/input/MySQLInputSourceDatabaseConnectorTest.java
@@ -29,6 +29,7 @@ import
org.apache.druid.metadata.MetadataStorageConnectorConfig;
import org.apache.druid.metadata.storage.mysql.MySQLConnectorDriverConfig;
import org.apache.druid.metadata.storage.mysql.MySQLMetadataStorageModule;
import org.apache.druid.server.initialization.JdbcAccessSecurityConfig;
+import org.hamcrest.CoreMatchers;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Rule;
@@ -167,7 +168,12 @@ public class MySQLInputSourceDatabaseConnectorTest
JdbcAccessSecurityConfig securityConfig =
newSecurityConfigEnforcingAllowList(ImmutableSet.of(""));
- expectedException.expectMessage("The property [password] is not in the
allowed list");
+ expectedException.expectMessage(
+ CoreMatchers.anyOf(
+ CoreMatchers.containsString("The property [password] is not in the
allowed list"),
+ CoreMatchers.containsString("The property [user] is not in the
allowed list")
+ )
+ );
expectedException.expect(IllegalArgumentException.class);
new MySQLInputSourceDatabaseConnector(
@@ -241,7 +247,12 @@ public class MySQLInputSourceDatabaseConnectorTest
JdbcAccessSecurityConfig securityConfig =
newSecurityConfigEnforcingAllowList(ImmutableSet.of("none", "nonenone"));
- expectedException.expectMessage("The property [password] is not in the
allowed list");
+ expectedException.expectMessage(
+ CoreMatchers.anyOf(
+ CoreMatchers.containsString("The property [password] is not in the
allowed list"),
+ CoreMatchers.containsString("The property [user] is not in the
allowed list")
+ )
+ );
expectedException.expect(IllegalArgumentException.class);
new MySQLInputSourceDatabaseConnector(
@@ -291,7 +302,12 @@ public class MySQLInputSourceDatabaseConnectorTest
JdbcAccessSecurityConfig securityConfig =
newSecurityConfigEnforcingAllowList(ImmutableSet.of("user", "nonenone"));
- expectedException.expectMessage("The property [password] is not in the
allowed list");
+ expectedException.expectMessage(
+ CoreMatchers.anyOf(
+ CoreMatchers.containsString("The property [password] is not in the
allowed list"),
+ CoreMatchers.containsString("The property [keyonly] is not in the
allowed list")
+ )
+ );
expectedException.expect(IllegalArgumentException.class);
new MySQLInputSourceDatabaseConnector(
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]