dlmarion commented on code in PR #2801:
URL: https://github.com/apache/accumulo/pull/2801#discussion_r916702466


##########
test/src/main/java/org/apache/accumulo/test/shell/ShellServerIT.java:
##########
@@ -2139,6 +2139,100 @@ public void testFateCommandWithSlowCompaction() throws 
Exception {
     if (orgProps != null) {
       System.setProperty("accumulo.properties", orgProps);
     }
+  }
+
+  @Test
+  public void testFateSummaryCommandWithSlowCompaction() throws Exception {
+    String namespace = "ns1";
+    final String table = namespace + "." + getUniqueNames(1)[0];
 
+    String orgProps = System.getProperty("accumulo.properties");
+
+    System.setProperty("accumulo.properties",
+        "file://" + 
getCluster().getConfig().getAccumuloPropsFile().getCanonicalPath());
+    // compact
+    ts.exec("createnamespace " + namespace);
+    ts.exec("createtable " + table);
+    ts.exec("addsplits h m r w -t " + table);
+    ts.exec("offline -t " + table);
+    ts.exec("online h m r w -t " + table);
+
+    // setup SlowIterator to sleep for 10 seconds
+    ts.exec("config -t " + table
+        + " -s 
table.iterator.majc.slow=1,org.apache.accumulo.test.functional.SlowIterator");
+    ts.exec("config -t " + table + " -s 
table.iterator.majc.slow.opt.sleepTime=10000");
+
+    // make two files
+    ts.exec("insert a1 b c v_a1");
+    ts.exec("insert a2 b c v_a2");
+    ts.exec("flush -w");
+    ts.exec("insert x1 b c v_x1");
+    ts.exec("insert x2 b c v_x2");
+    ts.exec("flush -w");
+
+    // no transactions running
+
+    String cmdOut =
+        ts.exec("fate -summary -np json -t NEW IN_PROGRESS FAILED", true, 
"reportTime", true);
+    // strip command included in shell output
+    String jsonOut = cmdOut.substring(cmdOut.indexOf("{"));
+    SummaryReport report = SummaryReport.fromJson(jsonOut);
+
+    // validate blank report
+    assertNotNull(report);
+    assertNotEquals(0, report.getReportTime());
+    assertEquals(Set.of("NEW", "IN_PROGRESS", "FAILED"), 
report.getStatusFilterNames());
+    assertEquals(Map.of(), report.getStatusCounts());
+    assertEquals(Map.of(), report.getStepCounts());
+    assertEquals(Map.of(), report.getCmdCounts());
+    assertEquals(Set.of(), report.getFateDetails());
+
+    ts.exec("fate -summary -np", true, "Report Time:", true);
+
+    // merge two files into one
+    ts.exec("compact -t " + table);
+    Thread.sleep(1_000);
+    // start 2nd transaction
+    ts.exec("compact -t " + table);
+    Thread.sleep(3_000);
+
+    // 2 compactions should be running so parse the output to get one of the 
transaction ids
+    log.debug("Calling fate summary");
+    ts.exec("fate -summary -np", true, "Report Time:", true);

Review Comment:
   I see, the calls are different.
   
   > The first call basically checks the output is created - the call succeeds 
and has a report time. 
   
   The output is not captured nor checked. You are relying on it throwing an 
exception to fail the 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.

To unsubscribe, e-mail: [email protected]

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

Reply via email to