This is an automated email from the ASF dual-hosted git repository. jmanno pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/accumulo.git
The following commit(s) were added to refs/heads/main by this push: new 92c812c Fix history test inside ShellServerIT (#2097) 92c812c is described below commit 92c812cc5655a0ff0a9c7fa7e578de2586d58d5c Author: Jeffrey Manno <jeffreymann...@gmail.com> AuthorDate: Thu May 13 06:23:33 2021 -0400 Fix history test inside ShellServerIT (#2097) * thoroughly check all features of the 'history' command works. * create a direct write-to-history function. Previously, things were not being written to the history file due to how the execution works for this IT --- .../org/apache/accumulo/test/ShellServerIT.java | 30 ++++++++++++++++------ 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/test/src/main/java/org/apache/accumulo/test/ShellServerIT.java b/test/src/main/java/org/apache/accumulo/test/ShellServerIT.java index 081e984..66d8784 100644 --- a/test/src/main/java/org/apache/accumulo/test/ShellServerIT.java +++ b/test/src/main/java/org/apache/accumulo/test/ShellServerIT.java @@ -285,6 +285,11 @@ public class ShellServerIT extends SharedMiniClusterBase { output.get().contains(s)); shell.resetExitCode(); } + + void writeToHistory(String cmd) { + input.set(cmd); + reader.readLine(); + } } private static final NoOpErrorMessageCallback noop = new NoOpErrorMessageCallback(); @@ -1431,18 +1436,27 @@ public class ShellServerIT extends SharedMiniClusterBase { } } - // TODO - evaluate this test is testing what is expected or history is working. @Test public void history() throws Exception { - final String table = name.getMethodName(); + final String table = getUniqueNames(1)[0]; + // test clear history command works + ts.writeToHistory("foo"); + ts.exec("history", true, "foo", true); ts.exec("history -c", true); - ts.exec("createtable " + table); - ts.exec("deletetable -f " + table); - // TODO - this may be passing only because method name is history. - ts.exec("history", true, table, true); - // TODO - what is this testing? - ts.exec("history", true, "history", true); + ts.exec("history", true, "foo", false); + + // Verify commands are not currently in history then write to history file. Does not execute + // table ops. + ts.exec("history", true, table, false); + ts.exec("history", true, "createtable", false); + ts.exec("history", true, "deletetable", false); + ts.writeToHistory("createtable " + table); + ts.writeToHistory("deletetable -f " + table); + + // test that history command prints contents of history file + ts.exec("history", true, "createtable " + table, true); + ts.exec("history", true, "deletetable -f " + table, true); } @SuppressFBWarnings(value = "PATH_TRAVERSAL_IN", justification = "path provided by test")