HBASE-9610 TestThriftServer.testAll failing

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1526281 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2013-09-25 20:08:49 +00:00
parent 31bbc77410
commit e08500578c
1 changed files with 31 additions and 11 deletions

View File

@ -156,6 +156,27 @@ public class TestThriftServer {
}
}
/**
* TODO: These counts are supposed to be zero but sometimes they are not, they are equal to the
* passed in maybe. Investigate why. My guess is they are set by the test that runs just
* previous to this one. Sometimes they are cleared. Sometimes not.
* @param name
* @param maybe
* @param metrics
* @return
*/
private int getCurrentCount(final String name, final int maybe, final ThriftMetrics metrics) {
int currentCount = 0;
try {
metricsHelper.assertCounter(name, maybe, metrics.getSource());
LOG.info("Shouldn't this be null? name=" + name + ", equals=" + maybe);
currentCount = maybe;
} catch (AssertionError e) {
// Ignore
}
return currentCount;
}
/**
* Tests if the metrics for thrift handler work correctly
*/
@ -164,18 +185,17 @@ public class TestThriftServer {
Configuration conf = UTIL.getConfiguration();
ThriftMetrics metrics = getMetrics(conf);
Hbase.Iface handler = getHandlerForMetricsTest(metrics, conf);
try {
metricsHelper.assertCounter("createTable_num_ops", 2, metrics.getSource());
LOG.info("SHOULD NOT BE HERE");
} catch (AssertionError e) {
// DEBUGGING
LOG.info("Got expected assertion error");
}
int currentCountCreateTable = getCurrentCount("createTable_num_ops", 2, metrics);
int currentCountDeleteTable = getCurrentCount("deleteTable_num_ops", 2, metrics);
int currentCountDisableTable = getCurrentCount("disableTable_num_ops", 2, metrics);
createTestTables(handler);
dropTestTables(handler);
metricsHelper.assertCounter("createTable_num_ops", 2, metrics.getSource());
metricsHelper.assertCounter("deleteTable_num_ops", 2, metrics.getSource());
metricsHelper.assertCounter("disableTable_num_ops", 2, metrics.getSource());
dropTestTables(handler);;
metricsHelper.assertCounter("createTable_num_ops", currentCountCreateTable + 2,
metrics.getSource());
metricsHelper.assertCounter("deleteTable_num_ops", currentCountDeleteTable + 2,
metrics.getSource());
metricsHelper.assertCounter("disableTable_num_ops", currentCountDisableTable + 2,
metrics.getSource());
handler.getTableNames(); // This will have an artificial delay.
// 3 to 6 seconds (to account for potential slowness), measured in nanoseconds