ACCUMULO-378 Stabilize the test some more.
Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/274c185a Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/274c185a Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/274c185a Branch: refs/heads/ACCUMULO-378 Commit: 274c185a0f960ad818ebfd69e048aed15172da7c Parents: 32479af Author: Josh Elser <els...@apache.org> Authored: Fri May 2 16:06:22 2014 -0400 Committer: Josh Elser <els...@apache.org> Committed: Fri May 2 16:06:22 2014 -0400 ---------------------------------------------------------------------- .../test/replication/ReplicationWithGCIT.java | 33 +++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/accumulo/blob/274c185a/test/src/test/java/org/apache/accumulo/test/replication/ReplicationWithGCIT.java ---------------------------------------------------------------------- diff --git a/test/src/test/java/org/apache/accumulo/test/replication/ReplicationWithGCIT.java b/test/src/test/java/org/apache/accumulo/test/replication/ReplicationWithGCIT.java index 449827b..33da8a0 100644 --- a/test/src/test/java/org/apache/accumulo/test/replication/ReplicationWithGCIT.java +++ b/test/src/test/java/org/apache/accumulo/test/replication/ReplicationWithGCIT.java @@ -388,7 +388,9 @@ public class ReplicationWithGCIT extends ConfigurableMacIT { Text expectedColqual = ReplicationTarget.toText(new ReplicationTarget("cluster1", "4")); Assert.assertEquals(expectedColqual, e.getKey().getColumnQualifier()); notFound = false; - } catch (NoSuchElementException e) {} catch (IllegalArgumentException e) { + } catch (NoSuchElementException e) { + + } catch (IllegalArgumentException e) { s = ReplicationTable.getScanner(conn); for (Entry<Key,Value> content : s) { log.info(content.getKey().toStringNoTruncate() + " => " + content.getValue()); @@ -441,6 +443,34 @@ public class ReplicationWithGCIT extends ConfigurableMacIT { for (@SuppressWarnings("unused") Entry<Key,Value> entry : s) {} + // Wait for a bit since the GC has to run (should be running after a one second delay) + Thread.sleep(5000); + + // Need to make sure we get the entries in metadata + boolean foundResults = false; + for (int i = 0; i < 5 && !foundResults; i++) { + s = conn.createScanner(MetadataTable.NAME, Authorizations.EMPTY); + s.setRange(ReplicationSection.getRange()); + if (Iterables.size(s) > 0) { + foundResults = true; + } + Thread.sleep(1000); + } + + Assert.assertTrue("Did not find any replication entries in the metadata table", foundResults); + + // Then we need to get those records over to the replication table + foundResults = false; + for (int i = 0; i < 5 && !foundResults; i++) { + s = ReplicationTable.getScanner(conn); + if (Iterables.size(s) > 0) { + foundResults = true; + } + Thread.sleep(1000); + } + + Assert.assertTrue("Did nto find any replication entries in the replication table", foundResults); + /** * After recovery completes, we should have unreplicated, closed Status messages. The close happens at the beginning of log recovery. */ @@ -458,6 +488,7 @@ public class ReplicationWithGCIT extends ConfigurableMacIT { builder.setBegin(Long.MAX_VALUE).setEnd(status.getEnd()).setClosed(status.getClosed()).setInfiniteEnd(status.getInfiniteEnd()); + log.info("Writing update to replication to " + k); Mutation m = new Mutation(k.getRow()); m.put(k.getColumnFamily(), k.getColumnQualifier(), ProtobufUtil.toValue(builder.build())); bw.addMutation(m);