XComp commented on a change in pull request #18751:
URL: https://github.com/apache/flink/pull/18751#discussion_r809895153
##########
File path:
flink-runtime/src/test/java/org/apache/flink/runtime/checkpoint/CheckpointIDCounterTestBase.java
##########
@@ -33,9 +33,7 @@
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
-import static org.hamcrest.Matchers.greaterThanOrEqualTo;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThat;
+import static org.assertj.core.api.Assertions.assertThat;
Review comment:
May we also switch to junit5 as part of this effort?
##########
File path:
flink-runtime/src/test/java/org/apache/flink/runtime/checkpoint/ZooKeeperCheckpointIDCounterITCase.java
##########
@@ -36,16 +37,21 @@
*/
public class ZooKeeperCheckpointIDCounterITCase extends
CheckpointIDCounterTestBase {
- private static final ZooKeeperTestEnvironment ZooKeeper = new
ZooKeeperTestEnvironment(1);
+ private static ZooKeeperTestEnvironment zookeeper;
+
+ @BeforeClass
+ public static void setUp() throws Exception {
Review comment:
> [hotfix][tests] Allow ZooKeeperCheckpointIDCounterITCase to loop
Out of curiosity: Is this required to run the Intellij run-until-failure
functionality? 🤔 I couldn't reproduce it. In what sense is the new code
different from the old version?
##########
File path:
flink-runtime/src/test/java/org/apache/flink/runtime/checkpoint/CheckpointIDCounterTestBase.java
##########
@@ -116,23 +114,21 @@ public void testConcurrentGetAndIncrement() throws
Exception {
// Get the counts
for (Future<List<Long>> result : resultFutures) {
List<Long> counts = result.get();
+ assertStrictlyMonotonous(counts);
all.addAll(counts);
}
// Verify
Collections.sort(all);
- assertEquals(expectedTotal, all.size());
+ assertThat(all.size()).isEqualTo(expectedTotal);
- long current = 0;
- for (long val : all) {
- // Incrementing counts
- assertEquals(++current, val);
- }
+ assertStrictlyMonotonous(all);
// The final count
- assertEquals(expectedTotal + 1, counter.get());
- assertEquals(expectedTotal + 1, counter.getAndIncrement());
+ final long lastCheckpointId = all.get(all.size() - 1);
+ assertThat(lastCheckpointId).isLessThan(counter.get());
+ assertThat(lastCheckpointId).isLessThan(counter.getAndIncrement());
Review comment:
```suggestion
assertThat(all).last(LONG).isLessThan(counter.get());
assertThat(all).last(LONG).isLessThan(counter.getAndIncrement());
```
just playing around with the assertj API a bit here. Doesn't need to be
applied. 8)
--
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]