HBASE-7235 TestMasterObserver is flaky

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1415005 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Enis Soztutar 2012-11-29 00:12:57 +00:00
parent b79c62dcbd
commit eded2c4881
1 changed files with 16 additions and 2 deletions

View File

@ -47,6 +47,7 @@ import org.apache.hadoop.hbase.protobuf.RequestConverter;
import org.apache.hadoop.hbase.protobuf.ProtobufUtil;
import org.apache.hadoop.hbase.regionserver.HRegionServer;
import org.apache.hadoop.hbase.util.Bytes;
import org.apache.hadoop.hbase.util.Threads;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
@ -796,7 +797,7 @@ public class TestMasterObserver {
// modify table
htd.setMaxFileSize(512 * 1024 * 1024);
admin.modifyTable(TEST_TABLE, htd);
modifyTableSync(admin, TEST_TABLE, htd);
// preModifyTable can't bypass default action.
assertTrue("Test table should have been modified",
cp.wasModifyTableCalled());
@ -847,7 +848,7 @@ public class TestMasterObserver {
// modify table
htd.setMaxFileSize(512 * 1024 * 1024);
admin.modifyTable(TEST_TABLE, htd);
modifyTableSync(admin, TEST_TABLE, htd);
assertTrue("Test table should have been modified",
cp.wasModifyTableCalled());
// add a column family
@ -906,6 +907,19 @@ public class TestMasterObserver {
cp.wasDeleteTableHandlerCalled());
}
private void modifyTableSync(HBaseAdmin admin, byte[] tableName, HTableDescriptor htd)
throws IOException {
admin.modifyTable(tableName, htd);
//wait until modify table finishes
for (int t = 0; t < 100; t++) { //10 sec timeout
HTableDescriptor td = admin.getTableDescriptor(htd.getName());
if (td.equals(htd)) {
break;
}
Threads.sleep(100);
}
}
@Test
public void testRegionTransitionOperations() throws Exception {
MiniHBaseCluster cluster = UTIL.getHBaseCluster();