|
37 | 37 | import java.util.Collection; |
38 | 38 | import java.util.List; |
39 | 39 | import java.util.concurrent.TimeoutException; |
| 40 | +import java.util.regex.Pattern; |
40 | 41 |
|
41 | 42 | import org.junit.jupiter.params.ParameterizedTest; |
42 | 43 | import org.junit.jupiter.params.provider.EnumSource; |
43 | 44 | import org.junit.jupiter.params.provider.MethodSource; |
44 | 45 | import org.slf4j.Logger; |
45 | 46 | import org.slf4j.LoggerFactory; |
| 47 | + |
46 | 48 | import org.apache.hadoop.conf.Configuration; |
47 | 49 | import org.apache.hadoop.fs.Path; |
48 | 50 | import org.apache.hadoop.hdfs.client.HdfsClientConfigKeys; |
@@ -152,8 +154,8 @@ public void testConnectTimeout(TimeoutSource src) throws Exception { |
152 | 154 | fs.listFiles(new Path("/"), false); |
153 | 155 | fail("expected timeout"); |
154 | 156 | } catch (SocketTimeoutException e) { |
155 | | - GenericTestUtils.assertExceptionContains(fs.getUri().getAuthority() |
156 | | - + ": connect timed out",e); |
| 157 | + GenericTestUtils.assertExceptionMatches(Pattern.compile( |
| 158 | + ".*" + Pattern.quote(fs.getUri().getAuthority()) + ": [Cc]onnect timed out"), e); |
157 | 159 | } |
158 | 160 | } |
159 | 161 |
|
@@ -190,8 +192,8 @@ public void testAuthUrlConnectTimeout(TimeoutSource src) throws Exception { |
190 | 192 | fs.getDelegationToken("renewer"); |
191 | 193 | fail("expected timeout"); |
192 | 194 | } catch (SocketTimeoutException e) { |
193 | | - GenericTestUtils.assertExceptionContains(fs.getUri().getAuthority() + |
194 | | - ": connect timed out", e); |
| 195 | + GenericTestUtils.assertExceptionMatches(Pattern.compile( |
| 196 | + ".*" + Pattern.quote(fs.getUri().getAuthority()) + ": [Cc]onnect timed out"), e); |
195 | 197 | } |
196 | 198 | } |
197 | 199 |
|
@@ -230,8 +232,8 @@ public void testRedirectConnectTimeout(TimeoutSource src) throws Exception { |
230 | 232 | fail("expected timeout"); |
231 | 233 | } catch (SocketTimeoutException e) { |
232 | 234 | assumeBacklogConsumed(); |
233 | | - GenericTestUtils.assertExceptionContains( |
234 | | - fs.getUri().getAuthority() + ": connect timed out", e); |
| 235 | + GenericTestUtils.assertExceptionMatches(Pattern.compile( |
| 236 | + ".*" + Pattern.quote(fs.getUri().getAuthority()) + ": [Cc]onnect timed out"), e); |
235 | 237 | } |
236 | 238 | } |
237 | 239 |
|
@@ -272,8 +274,8 @@ public void testTwoStepWriteConnectTimeout(TimeoutSource src) throws Exception { |
272 | 274 | fail("expected timeout"); |
273 | 275 | } catch (SocketTimeoutException e) { |
274 | 276 | assumeBacklogConsumed(); |
275 | | - GenericTestUtils.assertExceptionContains( |
276 | | - fs.getUri().getAuthority() + ": connect timed out", e); |
| 277 | + GenericTestUtils.assertExceptionMatches(Pattern.compile( |
| 278 | + ".*" + Pattern.quote(fs.getUri().getAuthority()) + ": [Cc]onnect timed out"), e); |
277 | 279 | } finally { |
278 | 280 | IOUtils.cleanupWithLogger(LOG, os); |
279 | 281 | } |
|
0 commit comments