Skip to content

Commit 1ea46ab

Browse files
authored
Merge pull request #501 from aws/shanslyu/fixAssertion
fix assertion for unit tests on mac
2 parents d451934 + a603fff commit 1ea46ab

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/test/java/software/amazon/documentdb/jdbc/sshtunnel/DocumentDbSshTunnelClientTest.java

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,8 @@ void testInvalidSshHostnameConnectionTimeout() throws Exception {
112112
SQLException.class,
113113
() -> new DocumentDbSshTunnelClient(properties));
114114
Assertions.assertTrue(e.toString().startsWith(
115-
"java.sql.SQLException: java.net.ConnectException: Connection timed out"));
115+
"java.sql.SQLException: java.net.ConnectException: Connection timed out") ||
116+
e.toString().startsWith("java.sql.SQLException: java.net.ConnectException: Operation timed out"));
116117
}
117118

118119
@Test
@@ -124,8 +125,15 @@ void testInvalidSshUserAuthFail() throws Exception {
124125
final Exception e = Assertions.assertThrows(
125126
SQLException.class,
126127
() -> new DocumentDbSshTunnelClient(properties));
127-
Assertions.assertEquals("java.sql.SQLException: Auth fail for methods 'publickey,gssapi-keyex,gssapi-with-mic'",
128-
e.toString());
128+
129+
final String os = System.getProperty("os.name");
130+
if (os.toLowerCase().startsWith("mac")) {
131+
Assertions.assertEquals("java.sql.SQLException: Auth fail for methods 'publickey'",
132+
e.toString());
133+
} else {
134+
Assertions.assertEquals("java.sql.SQLException: Auth fail for methods 'publickey,gssapi-keyex,gssapi-with-mic'",
135+
e.toString());
136+
}
129137
}
130138

131139
@Test

0 commit comments

Comments
 (0)