Skip to content

Commit

Permalink
[apache/helix] -- Updated timeouts to use shorter timeouts [test]
Browse files Browse the repository at this point in the history
  • Loading branch information
himanshukandwal committed Dec 19, 2023
1 parent b2e6195 commit ff3012b
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 10 deletions.
7 changes: 3 additions & 4 deletions .github/workflows/Helix-Manual-CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,12 @@ jobs:
- name: Run All Tests
run: mvn -B -V -e -ntp "-Dstyle.color=always" ${{ github.event.inputs.mvnOpts }} ${{ github.event.inputs.goals }}
- name: Test Report
uses: mikepenz/action-junit-report@v3
uses: dorny/test-reporter@v1
if: always()
with:
name: Tests Results
path: './**/target/surefire-reports/junitreports/TEST-*.xml'
include_passed: true
detailed_summary: true
path: './**/target/surefire-reports/TEST-TestSuite.xml'
reporter: java-junit
- name: Upload unit test results
if: failure()
uses: actions/upload-artifact@v2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

import org.apache.helix.controller.HierarchicalDataHolder;
import org.apache.helix.zookeeper.api.client.HelixZkClient;
import org.apache.helix.zookeeper.impl.factory.SharedZkClientFactory;
import org.testng.AssertJUnit;
import org.testng.annotations.Test;

Expand All @@ -32,8 +33,9 @@ public class TestHierarchicalDataStore extends ZkUnitTestBase {
@Test(groups = { "unitTest"
})

public void testHierarchicalDataStore() throws InterruptedException {
_zkClient = TestHelper.createZkClient(ZK_ADDR);
public void testHierarchicalDataStore() {
_zkClient = SharedZkClientFactory.getInstance()
.buildZkClient(new HelixZkClient.ZkConnectionConfig(ZK_ADDR));

String path = "/tmp/testHierarchicalDataStore";
FileFilter filter = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
* under the License.
*/

import java.time.Duration;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
Expand Down Expand Up @@ -53,8 +52,6 @@
import org.testng.annotations.Test;

public class TestRebalancePipeline extends ZkUnitTestBase {

private static final Long MSG_PURGE_DELAY = Duration.ofSeconds(1).toMillis();
private final String _className = getShortClassName();

@Test
Expand Down Expand Up @@ -198,6 +195,8 @@ public void testMsgTriggeredRebalance() throws Exception {
0, 1
});

long msgPurgeDelay = MessageGenerationPhase.DEFAULT_OBSELETE_MSG_PURGE_DELAY;

ClusterControllerManager controller =
new ClusterControllerManager(ZK_ADDR, clusterName, "controller_0");
controller.syncStart();
Expand Down Expand Up @@ -225,6 +224,7 @@ public void testMsgTriggeredRebalance() throws Exception {
"SLAVE", true);

// Controller has timeout > 1sec, so within 1s, controller should not have GCed message
Assert.assertTrue(msgPurgeDelay > 1000);
Assert.assertFalse(TestHelper.verify(() -> {
for (LiveInstance liveInstance : liveInstances) {
List<String> messages =
Expand All @@ -237,7 +237,7 @@ public void testMsgTriggeredRebalance() throws Exception {
}, TestHelper.WAIT_DURATION));

// After another purge delay, controller should cleanup messages and continue to rebalance
Thread.sleep(MSG_PURGE_DELAY);
Thread.sleep(msgPurgeDelay);
// Manually trigger another rebalance by touching current state
List<Message> allMsgs = new ArrayList<>();
setCurrentState(clusterName, "localhost_0", resourceName, resourceName + "_0",
Expand All @@ -259,6 +259,7 @@ public void testMsgTriggeredRebalance() throws Exception {
// controller will clean it up
setCurrentState(clusterName, "localhost_0", resourceName, resourceName + "_0", liveInstances.get(0).getEphemeralOwner(),
"MASTER", true);
Thread.sleep(msgPurgeDelay);
// touch current state to trigger rebalance
setCurrentState(clusterName, "localhost_0", resourceName, resourceName + "_0", liveInstances.get(0).getEphemeralOwner(),
"MASTER", false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
* under the License.
*/

import java.time.Duration;
import java.util.Arrays;

import com.google.common.collect.Sets;
Expand Down Expand Up @@ -113,6 +114,7 @@ public void testEntireCluster() {
public void testResourceSubset() {
// Ensure that this passes even when one resource is down
_admin.enableInstance(_clusterName, "localhost_12918", false);
TestHelper.sleepQuietly(Duration.ofMillis(1000));
_admin.enableCluster(_clusterName, false);
_admin.enableInstance(_clusterName, "localhost_12918", true);
BestPossAndExtViewZkVerifier verifier = new BestPossAndExtViewZkVerifier(ZK_ADDR,
Expand Down

0 comments on commit ff3012b

Please sign in to comment.