From 7a0c319b23c93809fc4aab72917c9c1828e18f7c Mon Sep 17 00:00:00 2001 From: matthias Date: Wed, 1 Jan 2025 23:22:45 +0100 Subject: [PATCH 1/4] refactor: use junit timeout exceptions and remove time constrains from individual statements --- .../ignite/raft/jraft/core/ItNodeTest.java | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/modules/raft/src/integrationTest/java/org/apache/ignite/raft/jraft/core/ItNodeTest.java b/modules/raft/src/integrationTest/java/org/apache/ignite/raft/jraft/core/ItNodeTest.java index e0e0cee115b..d4f1c929ca5 100644 --- a/modules/raft/src/integrationTest/java/org/apache/ignite/raft/jraft/core/ItNodeTest.java +++ b/modules/raft/src/integrationTest/java/org/apache/ignite/raft/jraft/core/ItNodeTest.java @@ -164,6 +164,7 @@ import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestInfo; +import org.junit.jupiter.api.Timeout; import org.junit.jupiter.api.extension.ExtendWith; /** @@ -2706,12 +2707,12 @@ public void testAppendEntriesWhenFollowerIsInErrorState() throws Exception { } @Test - @Disabled("https://issues.apache.org/jira/browse/IGNITE-21792") + @Timeout(value = 10_000, unit = TimeUnit.MILLISECONDS) //todo change to at least 20_000 to get the added timeout from before! public void testFollowerStartStopFollowing() throws Exception { // start five nodes List peers = TestUtils.generatePeers(testInfo, 5); - cluster = new TestCluster("unitest", dataPath, peers, ELECTION_TIMEOUT_MILLIS, testInfo); + cluster = new TestCluster("unittest", dataPath, peers, ELECTION_TIMEOUT_MILLIS, testInfo); for (TestPeer peer : peers) assertTrue(cluster.start(peer)); @@ -2726,8 +2727,7 @@ public void testFollowerStartStopFollowing() throws Exception { List firstFollowers = cluster.getFollowers(); assertEquals(4, firstFollowers.size()); for (Node node : firstFollowers) { - assertTrue( - waitForCondition(() -> ((MockStateMachine) node.getOptions().getFsm()).getOnStartFollowingTimes() == 1, 5_000)); + assertEquals(1, ((MockStateMachine) node.getOptions().getFsm()).getOnStartFollowingTimes()); assertEquals(0, ((MockStateMachine) node.getOptions().getFsm()).getOnStopFollowingTimes()); } @@ -2742,8 +2742,7 @@ public void testFollowerStartStopFollowing() throws Exception { List secondFollowers = cluster.getFollowers(); assertEquals(3, secondFollowers.size()); for (Node node : secondFollowers) { - assertTrue( - waitForCondition(() -> ((MockStateMachine) node.getOptions().getFsm()).getOnStartFollowingTimes() == 2, 5_000)); + assertEquals(2, ((MockStateMachine) node.getOptions().getFsm()).getOnStartFollowingTimes()); assertEquals(1, ((MockStateMachine) node.getOptions().getFsm()).getOnStopFollowingTimes()); } @@ -2760,14 +2759,12 @@ public void testFollowerStartStopFollowing() throws Exception { for (int i = 0; i < 3; i++) { Node follower = thirdFollowers.get(i); if (follower.getNodeId().getPeerId().equals(secondLeader.getNodeId().getPeerId())) { - assertTrue( - waitForCondition(() -> ((MockStateMachine) follower.getOptions().getFsm()).getOnStartFollowingTimes() == 2, 5_000)); - assertEquals(1, - ((MockStateMachine) follower.getOptions().getFsm()).getOnStopFollowingTimes()); + assertEquals(2, ((MockStateMachine) follower.getOptions().getFsm()).getOnStartFollowingTimes()); + assertEquals(1, ((MockStateMachine) follower.getOptions().getFsm()).getOnStopFollowingTimes()); continue; } - assertTrue(waitForCondition(() -> ((MockStateMachine) follower.getOptions().getFsm()).getOnStartFollowingTimes() == 3, 5_000)); + assertEquals(3, ((MockStateMachine) follower.getOptions().getFsm()).getOnStartFollowingTimes()); assertEquals(2, ((MockStateMachine) follower.getOptions().getFsm()).getOnStopFollowingTimes()); } From 64cc5c787da4c6dadbe924a122ef9fe520cc4d47 Mon Sep 17 00:00:00 2001 From: matthias Date: Thu, 2 Jan 2025 00:47:37 +0100 Subject: [PATCH 2/4] temp: add test action to test flakiness in a ci environment --- .github/workflows/flaky_detection.yml | 52 +++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 .github/workflows/flaky_detection.yml diff --git a/.github/workflows/flaky_detection.yml b/.github/workflows/flaky_detection.yml new file mode 100644 index 00000000000..bc674079fe6 --- /dev/null +++ b/.github/workflows/flaky_detection.yml @@ -0,0 +1,52 @@ +name: Flaky detection + +on: [workflow_dispatch] + +jobs: + build: + + runs-on: ubuntu-latest + permissions: + contents: read + + steps: + - uses: actions/checkout@v4 + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: '17' + distribution: 'temurin' + # Configure Gradle for optimal use in GitHub Actions, including caching of downloaded dependencies. + # See: https://github.com/gradle/actions/blob/main/setup-gradle/README.md + - name: Setup Gradle + uses: gradle/actions/setup-gradle@af1da67850ed9a4cedd57bfd976089dd991e2582 # v4.0.0 + + - name: Test 1 + run: ./gradlew :ignite-raft:test + + - name: Test 2 + run: ./gradlew :ignite-raft:test + + - name: Test 3 + run: ./gradlew :ignite-raft:test + + - name: Test 4 + run: ./gradlew :ignite-raft:test + + - name: Test 5 + run: ./gradlew :ignite-raft:test + + - name: Test 6 + run: ./gradlew :ignite-raft:test + + - name: Test 7 + run: ./gradlew :ignite-raft:test + + - name: Test 8 + run: ./gradlew :ignite-raft:test + + - name: Test 9 + run: ./gradlew :ignite-raft:test + + - name: Test 10 + run: ./gradlew :ignite-raft:test From 74f54b743b70964b2ca6fe20ed4e3d9faec7308b Mon Sep 17 00:00:00 2001 From: matthias Date: Thu, 2 Jan 2025 01:07:15 +0100 Subject: [PATCH 3/4] remove flaky detection action and increase timeout just to be safe use the old timeout added together + 5 seconds --- .../java/org/apache/ignite/raft/jraft/core/ItNodeTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/raft/src/integrationTest/java/org/apache/ignite/raft/jraft/core/ItNodeTest.java b/modules/raft/src/integrationTest/java/org/apache/ignite/raft/jraft/core/ItNodeTest.java index d4f1c929ca5..1446576666c 100644 --- a/modules/raft/src/integrationTest/java/org/apache/ignite/raft/jraft/core/ItNodeTest.java +++ b/modules/raft/src/integrationTest/java/org/apache/ignite/raft/jraft/core/ItNodeTest.java @@ -2707,7 +2707,7 @@ public void testAppendEntriesWhenFollowerIsInErrorState() throws Exception { } @Test - @Timeout(value = 10_000, unit = TimeUnit.MILLISECONDS) //todo change to at least 20_000 to get the added timeout from before! + @Timeout(value = 25_000, unit = TimeUnit.MILLISECONDS) public void testFollowerStartStopFollowing() throws Exception { // start five nodes List peers = TestUtils.generatePeers(testInfo, 5); From 88cd09394ead0c5c25b035efe25f9d1cf55a6f56 Mon Sep 17 00:00:00 2001 From: matthias Date: Thu, 2 Jan 2025 01:07:37 +0100 Subject: [PATCH 4/4] remove flaky detection action --- .github/workflows/flaky_detection.yml | 52 --------------------------- 1 file changed, 52 deletions(-) delete mode 100644 .github/workflows/flaky_detection.yml diff --git a/.github/workflows/flaky_detection.yml b/.github/workflows/flaky_detection.yml deleted file mode 100644 index bc674079fe6..00000000000 --- a/.github/workflows/flaky_detection.yml +++ /dev/null @@ -1,52 +0,0 @@ -name: Flaky detection - -on: [workflow_dispatch] - -jobs: - build: - - runs-on: ubuntu-latest - permissions: - contents: read - - steps: - - uses: actions/checkout@v4 - - name: Set up JDK 17 - uses: actions/setup-java@v4 - with: - java-version: '17' - distribution: 'temurin' - # Configure Gradle for optimal use in GitHub Actions, including caching of downloaded dependencies. - # See: https://github.com/gradle/actions/blob/main/setup-gradle/README.md - - name: Setup Gradle - uses: gradle/actions/setup-gradle@af1da67850ed9a4cedd57bfd976089dd991e2582 # v4.0.0 - - - name: Test 1 - run: ./gradlew :ignite-raft:test - - - name: Test 2 - run: ./gradlew :ignite-raft:test - - - name: Test 3 - run: ./gradlew :ignite-raft:test - - - name: Test 4 - run: ./gradlew :ignite-raft:test - - - name: Test 5 - run: ./gradlew :ignite-raft:test - - - name: Test 6 - run: ./gradlew :ignite-raft:test - - - name: Test 7 - run: ./gradlew :ignite-raft:test - - - name: Test 8 - run: ./gradlew :ignite-raft:test - - - name: Test 9 - run: ./gradlew :ignite-raft:test - - - name: Test 10 - run: ./gradlew :ignite-raft:test