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 38da5ce0dd Add retry and logging to CloseScannerIT (#3996)
38da5ce0dd is described below

commit 38da5ce0dd12be8780514c0671b4baabeebc20a9
Author: Dom G <domgargu...@apache.org>
AuthorDate: Tue Dec 5 08:03:01 2023 -0500

    Add retry and logging to CloseScannerIT (#3996)
---
 .../org/apache/accumulo/test/CloseScannerIT.java   | 26 +++++++++++++++-------
 1 file changed, 18 insertions(+), 8 deletions(-)

diff --git a/test/src/main/java/org/apache/accumulo/test/CloseScannerIT.java 
b/test/src/main/java/org/apache/accumulo/test/CloseScannerIT.java
index 9f0bd56bb1..96b4b930c2 100644
--- a/test/src/main/java/org/apache/accumulo/test/CloseScannerIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/CloseScannerIT.java
@@ -18,22 +18,27 @@
  */
 package org.apache.accumulo.test;
 
-import static org.junit.jupiter.api.Assertions.assertTrue;
-
 import java.util.List;
 
 import org.apache.accumulo.core.client.Accumulo;
 import org.apache.accumulo.core.client.AccumuloClient;
+import org.apache.accumulo.core.client.AccumuloException;
+import org.apache.accumulo.core.client.AccumuloSecurityException;
 import org.apache.accumulo.core.client.IsolatedScanner;
 import org.apache.accumulo.core.client.Scanner;
 import org.apache.accumulo.core.data.Range;
 import org.apache.accumulo.core.security.Authorizations;
 import org.apache.accumulo.harness.AccumuloClusterHarness;
 import org.apache.accumulo.test.functional.ReadWriteIT;
+import org.apache.accumulo.test.util.Wait;
 import org.junit.jupiter.api.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 public class CloseScannerIT extends AccumuloClusterHarness {
 
+  private static final Logger LOG = 
LoggerFactory.getLogger(CloseScannerIT.class);
+
   static final int ROWS = 1000;
   static final int COLS = 1000;
 
@@ -61,14 +66,19 @@ public class CloseScannerIT extends AccumuloClusterHarness {
         } // when the scanner is closed, all open sessions should be closed
       }
 
-      List<String> tservers = client.instanceOperations().getTabletServers();
-      int activeScans = 0;
-      for (String tserver : tservers) {
-        activeScans += 
client.instanceOperations().getActiveScans(tserver).size();
-      }
+      Wait.waitFor(() -> getActiveScansCount(client) < 1, 5000, 250,
+          "Found active scans after closing all scanners. Expected to find no 
scans");
+    }
+  }
 
-      assertTrue(activeScans < 3);
+  private static int getActiveScansCount(AccumuloClient client)
+      throws AccumuloException, AccumuloSecurityException {
+    List<String> tservers = client.instanceOperations().getTabletServers();
+    int scanCount = 0;
+    for (String tserver : tservers) {
+      scanCount += client.instanceOperations().getActiveScans(tserver).size();
     }
+    return scanCount;
   }
 
   private static Scanner createScanner(AccumuloClient client, String 
tableName, int i)

Reply via email to