ctubbsii commented on a change in pull request #2097:
URL: https://github.com/apache/accumulo/pull/2097#discussion_r631208892



##########
File path: test/src/main/java/org/apache/accumulo/test/ShellServerIT.java
##########
@@ -1431,18 +1436,20 @@ public void help() throws Exception {
     }
   }
 
-  // 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];
 
-    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.
+    // test clear history command works
+    ts.writeToHistory("foo");
+    ts.exec("history -c", true, "foo", false);
+
+    // write to history file. Does not execute functions
+    ts.writeToHistory("createtable " + table);

Review comment:
       This could verify that the table name and these commands are not present 
first:
   
   ```suggestion
       // write to history file. Does not execute functions
       ts.exec("history", true, table, false);
       ts.exec("history", true, "createtable", false);
       ts.exec("history", true, "deletetable", false);
       ts.writeToHistory("createtable " + table);
   ```

##########
File path: test/src/main/java/org/apache/accumulo/test/ShellServerIT.java
##########
@@ -1431,18 +1436,20 @@ public void help() throws Exception {
     }
   }
 
-  // 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];
 
-    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.
+    // test clear history command works
+    ts.writeToHistory("foo");
+    ts.exec("history -c", true, "foo", false);

Review comment:
       This didn't first verify that "foo" was present, or that it was removed 
afterwards:
   
   ```suggestion
       ts.exec("history", true, "foo", true);
       ts.exec("history -c", true);
       ts.exec("history", true, "foo", false);
   ```

##########
File path: test/src/main/java/org/apache/accumulo/test/ShellServerIT.java
##########
@@ -1431,18 +1436,20 @@ public void help() throws Exception {
     }
   }
 
-  // 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];
 
-    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.
+    // test clear history command works
+    ts.writeToHistory("foo");
+    ts.exec("history -c", true, "foo", false);
+
+    // write to history file. Does not execute functions
+    ts.writeToHistory("createtable " + table);
+    ts.writeToHistory("deletetable -f " + table);
+
+    // test that history command prints contents of history file
     ts.exec("history", true, table, true);
-    // TODO - what is this testing?
-    ts.exec("history", true, "history", true);

Review comment:
       I think this was just a basic test ensuring that exec caused the command 
to be added to the history. If that doesn't work in the test case, because of 
the way the test is written, that's fine to remove this, so long as executing 
commands in the shell still appends to the history.

##########
File path: test/src/main/java/org/apache/accumulo/test/ShellServerIT.java
##########
@@ -1431,18 +1436,20 @@ public void help() throws Exception {
     }
   }
 
-  // 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];
 
-    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.
+    // test clear history command works
+    ts.writeToHistory("foo");
+    ts.exec("history -c", true, "foo", false);
+
+    // write to history file. Does not execute functions
+    ts.writeToHistory("createtable " + table);
+    ts.writeToHistory("deletetable -f " + table);
+
+    // test that history command prints contents of history file
     ts.exec("history", true, table, true);

Review comment:
       This could be more thorough in checking that the createtable and 
deletetable commands were added:
   
   ```suggestion
       ts.exec("history", true, "createtable " + table, true);
       ts.exec("history", true, "deletetable -f " + table, true);
   ```




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to