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



##########
File path: test/src/main/java/org/apache/accumulo/test/ShellServerIT.java
##########
@@ -345,21 +345,33 @@ public static void tearDownAfterClass() {
       traceProcess.destroy();
     }
 
+    logUndeletedTables();
     SharedMiniClusterBase.stopMiniCluster();
   }
 
-  @After
-  public void deleteTables() throws Exception {
+  /**
+   * Tests should be cleaning up tables as they complete - this checks at the 
end of this test and
+   * prints diagnostic messages if a table remains.
+   */
+  private static void logUndeletedTables() {
     try (AccumuloClient c = 
Accumulo.newClient().from(getClientProps()).build()) {
       for (String table : c.tableOperations().list()) {
-        if (!table.startsWith(Namespace.ACCUMULO.name() + ".") && 
!table.equals("trace"))
-          try {
-            c.tableOperations().delete(table);
-          } catch (TableNotFoundException e) {
-            // don't care
-          }
+        if (!table.startsWith(Namespace.ACCUMULO.name() + ".") && 
!table.equals("trace")) {
+          log.warn("Clean up of Table left after test: {}", table);
+        }
       }

Review comment:
       If the `getUniqueNames()` method is used for the table names and 
namespaces for each test, then this `@After` method could be modified to clean 
up only the most recently run method's tables, rather than clean up each test 
separately in each test method body. Doing it that way would keep the cleanup 
code minimal, while not deleting tables that might be in use by another test.




-- 
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