ACCUMULO-4394 Fix up ShellServerIT#addauths The first loop did not set success=true upon success and would always iterate 9 times. We don't have to limit the number of attempts, instead rely on the junit timeout rule and run for as long as allowed.
Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/d79776d7 Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/d79776d7 Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/d79776d7 Branch: refs/heads/1.7 Commit: d79776d78d47570915a6195e1734807160ae566d Parents: dcc5dff Author: Josh Elser <els...@apache.org> Authored: Mon Aug 1 16:20:16 2016 -0400 Committer: Josh Elser <els...@apache.org> Committed: Mon Aug 1 16:20:16 2016 -0400 ---------------------------------------------------------------------- .../org/apache/accumulo/test/ShellServerIT.java | 26 ++++++-------------- 1 file changed, 8 insertions(+), 18 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/accumulo/blob/d79776d7/test/src/test/java/org/apache/accumulo/test/ShellServerIT.java ---------------------------------------------------------------------- diff --git a/test/src/test/java/org/apache/accumulo/test/ShellServerIT.java b/test/src/test/java/org/apache/accumulo/test/ShellServerIT.java index 77496ce..95066a5 100644 --- a/test/src/test/java/org/apache/accumulo/test/ShellServerIT.java +++ b/test/src/test/java/org/apache/accumulo/test/ShellServerIT.java @@ -598,7 +598,8 @@ public class ShellServerIT extends SharedMiniClusterIT { // addauths ts.exec("createtable " + table + " -evc"); boolean success = false; - for (int i = 0; i < 9 && !success; i++) { + // Rely on the timeout rule in AccumuloIT + while (!success) { try { ts.exec("insert a b c d -l foo", false, "does not have authorization", true, new ErrorMessageCallback() { @Override @@ -611,34 +612,23 @@ public class ShellServerIT extends SharedMiniClusterIT { } } }); + success = true; } catch (AssertionError e) { - Thread.sleep(200); + Thread.sleep(500); } } - if (!success) { - ts.exec("insert a b c d -l foo", false, "does not have authorization", true, new ErrorMessageCallback() { - @Override - public String getErrorMessage() { - try { - Connector c = getConnector(); - return "Current auths for root are: " + c.securityOperations().getUserAuthorizations("root").toString(); - } catch (Exception e) { - return "Could not check authorizations"; - } - } - }); - } ts.exec("addauths -s foo,bar", true); boolean passed = false; - for (int i = 0; i < 50 && !passed; i++) { + // Rely on the timeout rule in AccumuloIT + while (!passed) { try { ts.exec("getauths", true, "foo", true); ts.exec("getauths", true, "bar", true); passed = true; } catch (Exception e) { - UtilWaitThread.sleep(300); + UtilWaitThread.sleep(500); } catch (AssertionError e) { - UtilWaitThread.sleep(300); + UtilWaitThread.sleep(500); } } assertTrue("Could not successfully see updated authoriations", passed);