ACCUMULO-2694 Ensure that the newly created table is assigned before continuing.
A table can be successfully created, but its tablets not yet assigned. There was a race condition in the test where getMasterMonitorInfo was called before the tablets for the TEST_TABLE were created. This made it appear that the table did not exist. We can mitigate the race condition by trying to read from our TEST_TABLE before returning from the setup method. This ensures that the tablet for our table is online and we should get the expected state from the test. Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/e2dc5502 Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/e2dc5502 Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/e2dc5502 Branch: refs/heads/master Commit: e2dc5502712f9b2bbb8c3dd1090810d40385d131 Parents: 533983f Author: Josh Elser <els...@apache.org> Authored: Mon Aug 4 11:48:23 2014 -0400 Committer: Josh Elser <els...@apache.org> Committed: Mon Aug 4 11:48:23 2014 -0400 ---------------------------------------------------------------------- .../minicluster/impl/MiniAccumuloClusterImplTest.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/accumulo/blob/e2dc5502/minicluster/src/test/java/org/apache/accumulo/minicluster/impl/MiniAccumuloClusterImplTest.java ---------------------------------------------------------------------- diff --git a/minicluster/src/test/java/org/apache/accumulo/minicluster/impl/MiniAccumuloClusterImplTest.java b/minicluster/src/test/java/org/apache/accumulo/minicluster/impl/MiniAccumuloClusterImplTest.java index 32b20b0..2bab291 100644 --- a/minicluster/src/test/java/org/apache/accumulo/minicluster/impl/MiniAccumuloClusterImplTest.java +++ b/minicluster/src/test/java/org/apache/accumulo/minicluster/impl/MiniAccumuloClusterImplTest.java @@ -21,13 +21,18 @@ import java.util.Arrays; import java.util.Collection; import java.util.List; import java.util.Map; +import java.util.Map.Entry; +import org.apache.accumulo.core.client.Scanner; import org.apache.accumulo.core.client.admin.TableOperations; -import org.apache.accumulo.core.master.thrift.MasterMonitorInfo; +import org.apache.accumulo.core.data.Key; +import org.apache.accumulo.core.data.Value; import org.apache.accumulo.core.master.thrift.MasterGoalState; +import org.apache.accumulo.core.master.thrift.MasterMonitorInfo; import org.apache.accumulo.core.master.thrift.MasterState; import org.apache.accumulo.core.metadata.MetadataTable; import org.apache.accumulo.core.metadata.RootTable; +import org.apache.accumulo.core.security.Authorizations; import org.apache.accumulo.minicluster.ServerType; import org.apache.commons.io.FileUtils; import org.apache.log4j.Level; @@ -69,6 +74,9 @@ public class MiniAccumuloClusterImplTest { TableOperations tableops = accumulo.getConnector("root","superSecret").tableOperations(); tableops.create(TEST_TABLE); testTableID = tableops.tableIdMap().get(TEST_TABLE); + + Scanner s = accumulo.getConnector("root", "superSecret").createScanner(TEST_TABLE, Authorizations.EMPTY); + for (@SuppressWarnings("unused") Entry<Key,Value> e : s) {} } @Test(timeout = 10000)