[FLINK-39124][test] Migrate remaining flink-tests to JUnit 5#27669
[FLINK-39124][test] Migrate remaining flink-tests to JUnit 5#27669RocMarshal merged 6 commits intoapache:masterfrom
Conversation
049115c to
e29e50e
Compare
flink-tests/src/test/java/org/apache/flink/test/accumulators/AccumulatorErrorITCase.java
Outdated
Show resolved
Hide resolved
flink-tests/src/test/java/org/apache/flink/test/accumulators/AccumulatorErrorITCase.java
Outdated
Show resolved
Hide resolved
flink-tests/src/test/java/org/apache/flink/test/accumulators/AccumulatorITCase.java
Outdated
Show resolved
Hide resolved
flink-tests/src/test/java/org/apache/flink/test/example/client/LocalExecutorITCase.java
Outdated
Show resolved
Hide resolved
e29e50e to
b4c720f
Compare
flink-tests/src/test/java/org/apache/flink/test/accumulators/AccumulatorITCase.java
Outdated
Show resolved
Hide resolved
| @@ -84,12 +84,12 @@ public String map(String value) throws Exception { | |||
| env.execute(); | |||
| fail("this should fail due to null values."); | |||
| } catch (JobExecutionException e) { | |||
| assertTrue(findThrowable(e, NullPointerException.class).isPresent()); | |||
| assertThat(findThrowable(e, NullPointerException.class)).isPresent(); | |||
| } | |||
| } | |||
There was a problem hiding this comment.
can we replace it with something like
assertThatThrownBy(env::execute)
.isInstanceOf(JobExecutionException.class)
.hasRootCauseInstanceOf(NullPointerException.class);same for other try catches in this PR
There was a problem hiding this comment.
Thank you, I've updated this and each other instance I found in the updated files. I also tried to look for other cases where improvement could be made.
| .contains("broken serialization.")) | ||
| .isPresent()); | ||
| } | ||
| @Disabled("TODO: This needs to be investigated why no exception is thrown.") |
There was a problem hiding this comment.
During rewriting this test, I found that these test cases don't even check if the exception is thrown. Only the 2nd test passes, so I've disabled the others.
15db675 to
c1efa84
Compare
|
FYI, It would be better to merge it after #27902. |
| IntCounter simpleCounter = getRuntimeContext().getIntCounter("simple-counter"); | ||
| simpleCounter.add(1); | ||
| Assert.assertEquals(simpleCounter.getLocalValue().intValue(), 1); | ||
| assertThat(simpleCounter.getLocalValue().intValue()).isEqualTo(1); |
There was a problem hiding this comment.
| assertThat(simpleCounter.getLocalValue().intValue()).isEqualTo(1); | |
| assertThat(simpleCounter.getLocalValue().intValue()).isOne(); |
There was a problem hiding this comment.
Thank you for the comments! I've applied your suggestions, and rebased on the latest master, which already contains #27902
Sorry about that bug!
flink-tests/src/test/java/org/apache/flink/test/misc/MiscellaneousIssuesITCase.java
Outdated
Show resolved
Hide resolved
...ests/src/test/java/org/apache/flink/test/recovery/TaskManagerDisconnectOnShutdownITCase.java
Outdated
Show resolved
Hide resolved
...s/src/test/java/org/apache/flink/test/runtime/TaskManagerLoadingDynamicPropertiesITCase.java
Outdated
Show resolved
Hide resolved
flink-tests/src/test/java/org/apache/flink/test/state/SavepointStateBackendSwitchTestBase.java
Outdated
Show resolved
Hide resolved
c1efa84 to
bed5fc4
Compare
|
Reopen for triggering CI. |
|
@flinkbot run azure |
|
Hi, @mateczagany The CI was failed. |
|
@flinkbot run azure |
|
Hi, @mateczagany |
What is the purpose of the change
Migrate some of the tests in module flink-tests from JUnit4 to JUnit5.
Brief change log
assertThat()@SuppressWarningswhere it was unnecessaryVerifying this change
Does this pull request potentially affect one of the following parts:
@Public(Evolving): noDocumentation