This is an automated email from the ASF dual-hosted git repository.

domgarguilo 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 51c9957466 Improve logging of failing tests (#3924)
51c9957466 is described below

commit 51c9957466452f096cbfac39f63c81e3328b4556
Author: Dom G <domgargu...@apache.org>
AuthorDate: Fri Nov 3 11:48:56 2023 -0400

    Improve logging of failing tests (#3924)
---
 .../accumulo/test/functional/FunctionalTestUtils.java      |  7 +++++--
 .../accumulo/test/functional/HalfClosedTabletIT.java       |  5 +++++
 .../java/org/apache/accumulo/test/lock/ServiceLockIT.java  | 14 ++++++++------
 3 files changed, 18 insertions(+), 8 deletions(-)

diff --git 
a/test/src/main/java/org/apache/accumulo/test/functional/FunctionalTestUtils.java
 
b/test/src/main/java/org/apache/accumulo/test/functional/FunctionalTestUtils.java
index 7995ba4d58..175533f0c9 100644
--- 
a/test/src/main/java/org/apache/accumulo/test/functional/FunctionalTestUtils.java
+++ 
b/test/src/main/java/org/apache/accumulo/test/functional/FunctionalTestUtils.java
@@ -133,14 +133,17 @@ public class FunctionalTestUtils {
       }
 
       if (tabletFileCounts.size() < minTablets || tabletFileCounts.size() > 
maxTablets) {
-        throw new Exception("Did not find expected number of tablets " + 
tabletFileCounts.size());
+        throw new Exception("table " + tableName + " has unexpected number of 
tablets. Found: "
+            + tabletFileCounts.size() + ". expected " + minTablets + " < 
numTablets < "
+            + maxTablets);
       }
 
       Set<Entry<Text,Integer>> es = tabletFileCounts.entrySet();
       for (Entry<Text,Integer> entry : es) {
         if (entry.getValue() > maxRFiles || entry.getValue() < minRFiles) {
           throw new Exception(
-              "tablet " + entry.getKey() + " has " + entry.getValue() + " data 
files");
+              "tablet " + entry.getKey() + " has unexpected number of data 
files. Found: "
+                  + entry.getValue() + ". expected " + minTablets + " < 
numFiles < " + maxTablets);
         }
       }
     }
diff --git 
a/test/src/main/java/org/apache/accumulo/test/functional/HalfClosedTabletIT.java
 
b/test/src/main/java/org/apache/accumulo/test/functional/HalfClosedTabletIT.java
index c06a23da72..3502c01f75 100644
--- 
a/test/src/main/java/org/apache/accumulo/test/functional/HalfClosedTabletIT.java
+++ 
b/test/src/main/java/org/apache/accumulo/test/functional/HalfClosedTabletIT.java
@@ -52,6 +52,8 @@ import org.apache.hadoop.io.Text;
 import org.junit.jupiter.api.AfterAll;
 import org.junit.jupiter.api.BeforeAll;
 import org.junit.jupiter.api.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import com.google.common.collect.Sets;
 
@@ -63,6 +65,8 @@ import com.google.common.collect.Sets;
 //
 public class HalfClosedTabletIT extends SharedMiniClusterBase {
 
+  public static final Logger log = 
LoggerFactory.getLogger(HalfClosedTabletIT.class);
+
   public static class HalfClosedTabletITConfiguration implements 
MiniClusterConfigurationCallback {
 
     @Override
@@ -269,6 +273,7 @@ public class HalfClosedTabletIT extends 
SharedMiniClusterBase {
       FunctionalTestUtils.checkRFiles(c, tableName, minTablets, maxTablets, 
minRFiles, maxRFiles);
       return true;
     } catch (Exception e) {
+      log.info(e.getMessage());
       return false;
     }
   }
diff --git 
a/test/src/main/java/org/apache/accumulo/test/lock/ServiceLockIT.java 
b/test/src/main/java/org/apache/accumulo/test/lock/ServiceLockIT.java
index 1a994e8b42..3244414c7e 100644
--- a/test/src/main/java/org/apache/accumulo/test/lock/ServiceLockIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/lock/ServiceLockIT.java
@@ -20,6 +20,7 @@ package org.apache.accumulo.test.lock;
 
 import static java.nio.charset.StandardCharsets.UTF_8;
 import static 
org.apache.accumulo.harness.AccumuloITBase.ZOOKEEPER_TESTING_SERVER;
+import static org.junit.jupiter.api.Assertions.assertAll;
 import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertFalse;
 import static org.junit.jupiter.api.Assertions.assertNotNull;
@@ -637,12 +638,13 @@ public class ServiceLockIT {
         String first = children.get(0);
         int workerWithLock = parseLockWorkerName(first);
         LockWorker worker = workers.get(workerWithLock);
-        assertTrue(worker.holdsLock());
-        workers.forEach(w -> {
-          if (w != worker) {
-            assertFalse(w.holdsLock());
-          }
-        });
+        assertAll(() -> assertTrue(worker.holdsLock(),
+            "Expected worker, " + worker + " did not hold lock"), () -> 
workers.forEach(w -> {
+              if (w != worker) {
+                assertFalse(w.holdsLock(),
+                    "Expected worker, " + worker + " to hold lock. Instead " + 
w + " holds lock");
+              }
+            }));
         worker.unlock();
         Thread.sleep(100); // need to wait here so that the watchers fire.
       }

Reply via email to