ACCUMULO-3139 Some extra test stabilizations for BalanceAfterCommsFailureIT
Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/d0f95f85 Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/d0f95f85 Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/d0f95f85 Branch: refs/heads/master Commit: d0f95f85a484e190ddaeb753ab141ce7c3d84ff1 Parents: 4cf467b Author: Josh Elser <els...@apache.org> Authored: Wed Sep 17 17:07:30 2014 -0400 Committer: Josh Elser <els...@apache.org> Committed: Wed Sep 17 17:07:30 2014 -0400 ---------------------------------------------------------------------- .../test/functional/BalanceAfterCommsFailureIT.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/accumulo/blob/d0f95f85/test/src/test/java/org/apache/accumulo/test/functional/BalanceAfterCommsFailureIT.java ---------------------------------------------------------------------- diff --git a/test/src/test/java/org/apache/accumulo/test/functional/BalanceAfterCommsFailureIT.java b/test/src/test/java/org/apache/accumulo/test/functional/BalanceAfterCommsFailureIT.java index f062c8f..39e7e70 100644 --- a/test/src/test/java/org/apache/accumulo/test/functional/BalanceAfterCommsFailureIT.java +++ b/test/src/test/java/org/apache/accumulo/test/functional/BalanceAfterCommsFailureIT.java @@ -35,6 +35,7 @@ import org.apache.accumulo.core.master.thrift.MasterClientService; import org.apache.accumulo.core.master.thrift.MasterMonitorInfo; import org.apache.accumulo.core.master.thrift.TableInfo; import org.apache.accumulo.core.master.thrift.TabletServerStatus; +import org.apache.accumulo.core.security.Authorizations; import org.apache.accumulo.core.security.Credentials; import org.apache.accumulo.fate.util.UtilWaitThread; import org.apache.accumulo.minicluster.ServerType; @@ -45,6 +46,8 @@ import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.io.Text; import org.junit.Test; +import com.google.common.collect.Iterables; + public class BalanceAfterCommsFailureIT extends ConfigurableMacIT { @Override @@ -87,6 +90,8 @@ public class BalanceAfterCommsFailureIT extends ConfigurableMacIT { splits.add(new Text(split)); } c.tableOperations().addSplits("test", splits); + // Ensure all of the tablets are actually assigned + assertEquals(0, Iterables.size(c.createScanner("test", Authorizations.EMPTY))); UtilWaitThread.sleep(10 * 1000); checkBalance(c); } @@ -111,8 +116,10 @@ public class BalanceAfterCommsFailureIT extends ConfigurableMacIT { } counts.add(count); } - assertTrue(counts.size() > 1); - for (int i = 1; i < counts.size(); i++) - assertTrue(Math.abs(counts.get(0) - counts.get(i)) <= counts.size()); + assertTrue("Expected to have at least two TabletServers", counts.size() > 1); + for (int i = 1; i < counts.size(); i++) { + int diff = Math.abs(counts.get(0) - counts.get(i)); + assertTrue("Expected difference in tablets to be less than or equal to " + counts.size() + " but was " + diff, diff <= counts.size()); + } } }