RocMarshal commented on code in PR #18983:
URL: https://github.com/apache/flink/pull/18983#discussion_r865949498
##########
flink-yarn/src/test/java/org/apache/flink/yarn/YarnFileStageTestS3ITCase.java:
##########
@@ -173,36 +175,44 @@ private void testRecursiveUploadForYarn(String scheme,
String pathSuffix) throws
}
}
- @Test
- @RetryOnFailure(times = 3)
- public void testRecursiveUploadForYarnS3n() throws Exception {
+ @TestTemplate
+ @RetryOnException(times = 3, exception = Exception.class)
+ public void testRecursiveUploadForYarnS3n(@TempDir File tempFolder) throws
Exception {
// skip test on Hadoop 3:
https://issues.apache.org/jira/browse/HADOOP-14738
- Assume.assumeTrue(
- "This test is skipped for Hadoop versions above 3",
-
VersionUtil.compareVersions(System.getProperty("hadoop.version"), "3.0.0") < 0);
+ assumeTrue(
+
VersionUtil.compareVersions(System.getProperty("hadoop.version"), "3.0.0") < 0,
+ "This test is skipped for Hadoop versions above 3");
try {
Class.forName("org.apache.hadoop.fs.s3native.NativeS3FileSystem");
} catch (ClassNotFoundException e) {
// not in the classpath, cannot run this test
String msg = "Skipping test because NativeS3FileSystem is not in
the class path";
log.info(msg);
- assumeNoException(msg, e);
+ assumingThat(
+ true,
+ () -> {
+ throw e;
+ });
}
Review Comment:
Done.
##########
flink-yarn/src/test/java/org/apache/flink/yarn/TaskExecutorProcessSpecContainerResourcePriorityAdapterTest.java:
##########
@@ -206,40 +199,49 @@ public void testExternalResource() {
final Map<String, Long> resultExternalResources =
ResourceInformationReflector.INSTANCE.getExternalResources(resource);
- assertThat(resultExternalResources.size(), is(1));
- assertThat(
-
resultExternalResources.get(SUPPORTED_EXTERNAL_RESOURCE_CONFIG_KEY),
- is(SUPPORTED_EXTERNAL_RESOURCE_MAX));
+ assertThat(resultExternalResources).hasSize(1);
+
assertThat(resultExternalResources.get(SUPPORTED_EXTERNAL_RESOURCE_CONFIG_KEY))
+ .isEqualTo(SUPPORTED_EXTERNAL_RESOURCE_MAX);
}
- @Test(expected = IllegalStateException.class)
- public void testExternalResourceFailExceedMax() {
+ @Test
+ void testExternalResourceFailExceedMax() {
assumeTrue(isExternalResourceSupported());
-
- getAdapterWithExternalResources(
- SUPPORTED_EXTERNAL_RESOURCE_NAME,
SUPPORTED_EXTERNAL_RESOURCE_CONFIG_KEY)
- .getPriorityAndResource(
-
TASK_EXECUTOR_PROCESS_SPEC_WITH_EXTERNAL_RESOURCE_EXCEED_MAX);
+ assertThatThrownBy(
+ () ->
+ getAdapterWithExternalResources(
+
SUPPORTED_EXTERNAL_RESOURCE_NAME,
+
SUPPORTED_EXTERNAL_RESOURCE_CONFIG_KEY)
+ .getPriorityAndResource(
+
TASK_EXECUTOR_PROCESS_SPEC_WITH_EXTERNAL_RESOURCE_EXCEED_MAX))
+ .isInstanceOf(IllegalStateException.class);
}
- @Test(expected = IllegalStateException.class)
- public void testExternalResourceFailResourceTypeNotSupported() {
+ @Test
+ void testExternalResourceFailResourceTypeNotSupported() {
assumeTrue(isExternalResourceSupported());
-
- getAdapterWithExternalResources(
- UNSUPPORTED_EXTERNAL_RESOURCE_NAME,
- UNSUPPORTED_EXTERNAL_RESOURCE_CONFIG_KEY)
- .getPriorityAndResource(
-
TASK_EXECUTOR_PROCESS_SPEC_WITH_UNSUPPORTED_EXTERNAL_RESOURCE);
+ assertThatThrownBy(
+ () ->
+ getAdapterWithExternalResources(
+
UNSUPPORTED_EXTERNAL_RESOURCE_NAME,
+
UNSUPPORTED_EXTERNAL_RESOURCE_CONFIG_KEY)
+ .getPriorityAndResource(
+
TASK_EXECUTOR_PROCESS_SPEC_WITH_UNSUPPORTED_EXTERNAL_RESOURCE))
+ .isInstanceOf(IllegalStateException.class);
}
- @Test(expected = IllegalStateException.class)
- public void testExternalResourceFailHadoopVersionNotSupported() {
- assumeFalse(isExternalResourceSupported());
+ @Test
+ void testExternalResourceFailHadoopVersionNotSupported() {
- getAdapterWithExternalResources(
- SUPPORTED_EXTERNAL_RESOURCE_NAME,
SUPPORTED_EXTERNAL_RESOURCE_CONFIG_KEY)
-
.getPriorityAndResource(TASK_EXECUTOR_PROCESS_SPEC_WITH_EXTERNAL_RESOURCE);
+ assumeFalse(isExternalResourceSupported());
+ assertThatThrownBy(
+ () ->
+ getAdapterWithExternalResources(
Review Comment:
Done.
##########
flink-yarn/src/test/java/org/apache/flink/yarn/TaskExecutorProcessSpecContainerResourcePriorityAdapterTest.java:
##########
@@ -206,40 +199,49 @@ public void testExternalResource() {
final Map<String, Long> resultExternalResources =
ResourceInformationReflector.INSTANCE.getExternalResources(resource);
- assertThat(resultExternalResources.size(), is(1));
- assertThat(
-
resultExternalResources.get(SUPPORTED_EXTERNAL_RESOURCE_CONFIG_KEY),
- is(SUPPORTED_EXTERNAL_RESOURCE_MAX));
+ assertThat(resultExternalResources).hasSize(1);
+
assertThat(resultExternalResources.get(SUPPORTED_EXTERNAL_RESOURCE_CONFIG_KEY))
+ .isEqualTo(SUPPORTED_EXTERNAL_RESOURCE_MAX);
}
- @Test(expected = IllegalStateException.class)
- public void testExternalResourceFailExceedMax() {
+ @Test
+ void testExternalResourceFailExceedMax() {
assumeTrue(isExternalResourceSupported());
-
- getAdapterWithExternalResources(
- SUPPORTED_EXTERNAL_RESOURCE_NAME,
SUPPORTED_EXTERNAL_RESOURCE_CONFIG_KEY)
- .getPriorityAndResource(
-
TASK_EXECUTOR_PROCESS_SPEC_WITH_EXTERNAL_RESOURCE_EXCEED_MAX);
+ assertThatThrownBy(
+ () ->
+ getAdapterWithExternalResources(
+
SUPPORTED_EXTERNAL_RESOURCE_NAME,
+
SUPPORTED_EXTERNAL_RESOURCE_CONFIG_KEY)
+ .getPriorityAndResource(
+
TASK_EXECUTOR_PROCESS_SPEC_WITH_EXTERNAL_RESOURCE_EXCEED_MAX))
+ .isInstanceOf(IllegalStateException.class);
}
- @Test(expected = IllegalStateException.class)
- public void testExternalResourceFailResourceTypeNotSupported() {
+ @Test
+ void testExternalResourceFailResourceTypeNotSupported() {
assumeTrue(isExternalResourceSupported());
-
- getAdapterWithExternalResources(
- UNSUPPORTED_EXTERNAL_RESOURCE_NAME,
- UNSUPPORTED_EXTERNAL_RESOURCE_CONFIG_KEY)
- .getPriorityAndResource(
-
TASK_EXECUTOR_PROCESS_SPEC_WITH_UNSUPPORTED_EXTERNAL_RESOURCE);
+ assertThatThrownBy(
+ () ->
+ getAdapterWithExternalResources(
Review Comment:
Done.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]