Skip to content

Commit

Permalink
refine test
Browse files Browse the repository at this point in the history
  • Loading branch information
xyuanlu committed Sep 20, 2023
1 parent e90f4a5 commit 5fdae9b
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ public void beforeClass() throws Exception {

@Test
public void testEvacuate() throws Exception {
System.out.println("START TestInstanceOperation.testEvacuate() at " + new Date(System.currentTimeMillis()));
// EV should contain all participants, check resources one by one
Map<String, ExternalView> assignment = getEV();
for (String resource : _allDBs) {
Expand Down Expand Up @@ -133,7 +134,7 @@ public void testEvacuate() throws Exception {

@Test(dependsOnMethods = "testEvacuate")
public void testRevertEvacuation() throws Exception {

System.out.println("START TestInstanceOperation.testRevertEvacuation() at " + new Date(System.currentTimeMillis()));
// revert an evacuate instance
String instanceToEvacuate = _participants.get(0).getInstanceName();
_gSetupTool.getClusterManagementTool()
Expand All @@ -151,6 +152,7 @@ public void testRevertEvacuation() throws Exception {

@Test(dependsOnMethods = "testRevertEvacuation")
public void testAddingNodeWithEvacuationTag() throws Exception {
System.out.println("START TestInstanceOperation.testAddingNodeWithEvacuationTag() at " + new Date(System.currentTimeMillis()));
// first disable and instance, and wait for all replicas to be moved out
String mockNewInstance = _participants.get(0).getInstanceName();
_gSetupTool.getClusterManagementTool()
Expand Down Expand Up @@ -200,6 +202,7 @@ public void testAddingNodeWithEvacuationTag() throws Exception {

@Test(dependsOnMethods = "testAddingNodeWithEvacuationTag")
public void testEvacuateAndCancelBeforeBootstrapFinish() throws Exception {
System.out.println("START TestInstanceOperation.testEvacuateAndCancelBeforeBootstrapFinish() at " + new Date(System.currentTimeMillis()));
// add a resource where downward state transition is slow
createResourceWithDelayedRebalance(CLUSTER_NAME, "TEST_DB3_DELAYED_CRUSHED", "MasterSlave", PARTITIONS, REPLICA,
REPLICA - 1, 200000, CrushEdRebalanceStrategy.class.getName());
Expand Down Expand Up @@ -261,6 +264,7 @@ public void testEvacuateAndCancelBeforeBootstrapFinish() throws Exception {

@Test(dependsOnMethods = "testEvacuateAndCancelBeforeBootstrapFinish")
public void testEvacuateAndCancelBeforeDropFinish() throws Exception {
System.out.println("START TestInstanceOperation.testEvacuateAndCancelBeforeDropFinish() at " + new Date(System.currentTimeMillis()));

// set DROP ST delay to a large number
_stateModelDelay = 10000L;
Expand Down Expand Up @@ -297,6 +301,7 @@ public void testEvacuateAndCancelBeforeDropFinish() throws Exception {

@Test(dependsOnMethods = "testEvacuateAndCancelBeforeDropFinish")
public void testMarkEvacuationAfterEMM() throws Exception {
System.out.println("START TestInstanceOperation.testMarkEvacuationAfterEMM() at " + new Date(System.currentTimeMillis()));
_stateModelDelay = 1000L;
Assert.assertFalse(_gSetupTool.getClusterManagementTool().isInMaintenanceMode(CLUSTER_NAME));
_gSetupTool.getClusterManagementTool().manuallyEnableMaintenanceMode(CLUSTER_NAME, true, null,
Expand Down Expand Up @@ -341,6 +346,7 @@ public void testMarkEvacuationAfterEMM() throws Exception {

@Test(dependsOnMethods = "testMarkEvacuationAfterEMM")
public void testEvacuationWithOfflineInstancesInCluster() throws Exception {
System.out.println("START TestInstanceOperation.testEvacuationWithOfflineInstancesInCluster() at " + new Date(System.currentTimeMillis()));
_participants.get(1).syncStop();
_participants.get(2).syncStop();

Expand All @@ -362,7 +368,7 @@ public void testEvacuationWithOfflineInstancesInCluster() throws Exception {
v -> v.equals("MASTER") || v.equals("LEADER") || v.equals("SLAVE") || v.equals("FOLLOWER") || v.equals(
"STANDBY"))
.forEach(v -> activeReplicaCount.getAndIncrement());
Assert.assertTrue(activeReplicaCount.get() >= REPLICA-1);
TestHelper.verify(() -> (activeReplicaCount.get() >= REPLICA - 1), 30000);
Assert.assertFalse(ev.getStateMap(partition).containsKey(evacuateInstanceName) && ev.getStateMap(partition)
.get(evacuateInstanceName)
.equals("MASTER") && ev.getStateMap(partition)
Expand Down

0 comments on commit 5fdae9b

Please sign in to comment.