HBASE-21258 Add resetting of flags for RS Group pre/post hooks in TestRSGroups

Amending-Author: Andrew Purtell <apurtell@apache.org>
This commit is contained in:
tedyu 2018-10-01 15:07:59 -07:00 committed by Andrew Purtell
parent 81bd854f77
commit 50ae53c536
No known key found for this signature in database
GPG Key ID: 8597754DD5365CCD
1 changed files with 19 additions and 7 deletions

View File

@ -123,7 +123,7 @@ public class TestRSGroups extends TestRSGroupsBase {
init = true;
afterMethod();
}
observer.resetFlags();
}
@After
@ -149,7 +149,7 @@ public class TestRSGroups extends TestRSGroupsBase {
} catch (Exception ex) {
// ignore
}
assertTrue(observer.preMoveServersCalled);
TEST_UTIL.waitFor(WAIT_TIMEOUT, new Waiter.Predicate<Exception>() {
@Override
public boolean evaluate() throws Exception {
@ -222,9 +222,6 @@ public class TestRSGroups extends TestRSGroupsBase {
String groupName = tablePrefix+"_foo";
LOG.info("testNamespaceConstraint");
rsGroupAdmin.addRSGroup(groupName);
assertTrue(observer.preAddRSGroupCalled);
assertTrue(observer.postAddRSGroupCalled);
admin.createNamespace(NamespaceDescriptor.create(nsName)
.addConfiguration(RSGroupInfo.NAMESPACE_DESC_PROP_GROUP, groupName)
.build());
@ -245,8 +242,6 @@ public class TestRSGroups extends TestRSGroupsBase {
//test add non-existent group
admin.deleteNamespace(nsName);
rsGroupAdmin.removeRSGroup(groupName);
assertTrue(observer.preRemoveRSGroupCalled);
assertTrue(observer.postRemoveRSGroupCalled);
try {
admin.createNamespace(NamespaceDescriptor.create(nsName)
.addConfiguration(RSGroupInfo.NAMESPACE_DESC_PROP_GROUP, "foo")
@ -283,6 +278,23 @@ public class TestRSGroups extends TestRSGroupsBase {
boolean preMoveServersAndTables = false;
boolean postMoveServersAndTables = false;
void resetFlags() {
preBalanceRSGroupCalled = false;
postBalanceRSGroupCalled = false;
preMoveServersCalled = false;
postMoveServersCalled = false;
preMoveTablesCalled = false;
postMoveTablesCalled = false;
preAddRSGroupCalled = false;
postAddRSGroupCalled = false;
preRemoveRSGroupCalled = false;
postRemoveRSGroupCalled = false;
preRemoveServersCalled = false;
postRemoveServersCalled = false;
preMoveServersAndTables = false;
postMoveServersAndTables = false;
}
@Override
public void preMoveServersAndTables(final ObserverContext<MasterCoprocessorEnvironment> ctx,
Set<Address> servers, Set<TableName> tables, String targetGroup) throws IOException {