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

ctubbsii pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/accumulo.git

commit 1636a87f66ff3e22d3fa74b56b67c583b6cd2d72
Merge: 47b498e1e6 39c753e514
Author: Christopher Tubbs <ctubb...@apache.org>
AuthorDate: Mon Dec 2 16:11:37 2024 -0500

    Merge branch '3.1'

 .../test/conf/store/PropCacheCaffeineImplZkIT.java | 57 +++++++--------
 .../test/conf/store/PropStoreZooKeeperIT.java      | 59 +++++++--------
 .../accumulo/test/conf/store/ZooBasedConfigIT.java | 57 ++++++---------
 .../accumulo/test/fate/meta/ZooMutatorIT.java      |  5 --
 .../apache/accumulo/test/lock/ServiceLockIT.java   | 84 +++-------------------
 .../test/zookeeper/ZooKeeperTestingServer.java     | 84 +++++++++-------------
 6 files changed, 116 insertions(+), 230 deletions(-)

diff --cc test/src/main/java/org/apache/accumulo/test/lock/ServiceLockIT.java
index 86f31b5afb,11e1a29e7a..202c592ba8
--- a/test/src/main/java/org/apache/accumulo/test/lock/ServiceLockIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/lock/ServiceLockIT.java
@@@ -38,18 -38,14 +38,14 @@@ import java.util.concurrent.CountDownLa
  import java.util.concurrent.atomic.AtomicInteger;
  import java.util.concurrent.locks.LockSupport;
  
 +import org.apache.accumulo.core.Constants;
- import org.apache.accumulo.core.data.InstanceId;
  import org.apache.accumulo.core.fate.zookeeper.ZooReaderWriter;
- import org.apache.accumulo.core.fate.zookeeper.ZooSession;
- import org.apache.accumulo.core.fate.zookeeper.ZooUtil;
  import org.apache.accumulo.core.lock.ServiceLock;
  import org.apache.accumulo.core.lock.ServiceLock.AccumuloLockWatcher;
  import org.apache.accumulo.core.lock.ServiceLock.LockLossReason;
 -import org.apache.accumulo.core.lock.ServiceLock.ServiceLockPath;
  import org.apache.accumulo.core.lock.ServiceLockData;
 -import org.apache.accumulo.core.lock.ServiceLockData.ServiceDescriptor;
  import org.apache.accumulo.core.lock.ServiceLockData.ThriftService;
 +import org.apache.accumulo.core.lock.ServiceLockPaths.ServiceLockPath;
- import org.apache.accumulo.test.util.Wait;
  import org.apache.accumulo.test.zookeeper.ZooKeeperTestingServer;
  import org.apache.zookeeper.CreateMode;
  import org.apache.zookeeper.KeeperException;
@@@ -73,13 -67,6 +67,12 @@@ import com.google.common.util.concurren
  @Tag(ZOOKEEPER_TESTING_SERVER)
  public class ServiceLockIT {
  
 +  private static class TestServiceLockPath extends ServiceLockPath {
- 
 +    protected TestServiceLockPath(String path) {
 +      super(path);
 +    }
 +  }
 +
    @TempDir
    private static File tempDir;
  
@@@ -385,14 -348,10 +354,10 @@@
    @Test
    @Timeout(10)
    public void testUnexpectedEvent() throws Exception {
 -    var parent = ServiceLock
 -        .path("/zltestUnexpectedEvent-" + this.hashCode() + "-l" + 
pdCount.incrementAndGet());
 +    var parent = new TestServiceLockPath(
 +        "/zltestUnexpectedEvent-" + this.hashCode() + "-l" + 
pdCount.incrementAndGet());
  
-     ConnectedWatcher watcher = new ConnectedWatcher();
-     try (ZooKeeper zk = new ZooKeeper(szk.getConn(), 30000, watcher)) {
-       ZooUtil.digestAuth(zk, "secret");
- 
-       Wait.waitFor(() -> !watcher.isConnected(), 30_000, 200);
+     try (var zk = szk.newClient()) {
  
        zk.create(parent.toString(), new byte[0], ZooDefs.Ids.OPEN_ACL_UNSAFE, 
CreateMode.PERSISTENT);
  
@@@ -431,18 -390,10 +396,10 @@@
    @Test
    @Timeout(60)
    public void testLockSerial() throws Exception {
 -    var parent = ServiceLock.path("/zlretryLockSerial");
 +    var parent = new TestServiceLockPath("/zlretryLockSerial");
  
-     ConnectedWatcher watcher1 = new ConnectedWatcher();
-     ConnectedWatcher watcher2 = new ConnectedWatcher();
-     try (ZooKeeperWrapper zk1 = new ZooKeeperWrapper(szk.getConn(), 30000, 
watcher1);
-         ZooKeeperWrapper zk2 = new ZooKeeperWrapper(szk.getConn(), 30000, 
watcher2)) {
- 
-       ZooUtil.digestAuth(zk1, "secret");
-       ZooUtil.digestAuth(zk2, "secret");
- 
-       Wait.waitFor(() -> !watcher1.isConnected(), 30_000, 200);
-       Wait.waitFor(() -> !watcher2.isConnected(), 30_000, 200);
+     try (ZooKeeperWrapper zk1 = szk.newClient(ZooKeeperWrapper::new);
+         ZooKeeperWrapper zk2 = szk.newClient(ZooKeeperWrapper::new)) {
  
        // Create the parent node
        zk1.createOnce(parent.toString(), new byte[0], 
ZooDefs.Ids.OPEN_ACL_UNSAFE,
@@@ -592,15 -538,9 +544,9 @@@
    @Test
    @Timeout(60)
    public void testLockParallel() throws Exception {
 -    var parent = ServiceLock.path("/zlParallel");
 +    var parent = new TestServiceLockPath("/zlParallel");
  
-     ConnectedWatcher watcher = new ConnectedWatcher();
-     try (ZooKeeperWrapper zk = new ZooKeeperWrapper(szk.getConn(), 30000, 
watcher)) {
-       ZooUtil.digestAuth(zk, "secret");
- 
-       while (!watcher.isConnected()) {
-         Thread.sleep(50);
-       }
+     try (ZooKeeperWrapper zk = szk.newClient(ZooKeeperWrapper::new)) {
        // Create the parent node
        zk.createOnce(parent.toString(), new byte[0], 
ZooDefs.Ids.OPEN_ACL_UNSAFE,
            CreateMode.PERSISTENT);
@@@ -700,14 -636,10 +642,10 @@@
    @Test
    @Timeout(10)
    public void testChangeData() throws Exception {
 -    var parent =
 -        ServiceLock.path("/zltestChangeData-" + this.hashCode() + "-l" + 
pdCount.incrementAndGet());
 +    var parent = new TestServiceLockPath(
 +        "/zltestChangeData-" + this.hashCode() + "-l" + 
pdCount.incrementAndGet());
-     ConnectedWatcher watcher = new ConnectedWatcher();
-     try (ZooKeeper zk = new ZooKeeper(szk.getConn(), 30000, watcher)) {
-       ZooUtil.digestAuth(zk, "secret");
- 
-       Wait.waitFor(() -> !watcher.isConnected(), 30_000, 200);
  
+     try (var zk = szk.newClient()) {
        zk.create(parent.toString(), new byte[0], ZooDefs.Ids.OPEN_ACL_UNSAFE, 
CreateMode.PERSISTENT);
  
        ServiceLock zl = getZooLock(parent, UUID.randomUUID());

Reply via email to