keith-turner commented on code in PR #6209:
URL: https://github.com/apache/accumulo/pull/6209#discussion_r2926610064
##########
test/src/main/java/org/apache/accumulo/test/MultipleManagerStartupWaitIT.java:
##########
@@ -0,0 +1,88 @@
+package org.apache.accumulo.test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+import java.util.List;
+import java.util.Set;
+import java.util.concurrent.atomic.AtomicReference;
+
+import org.apache.accumulo.core.Constants;
+import org.apache.accumulo.core.client.admin.servers.ServerId;
+import org.apache.accumulo.core.conf.Property;
+import org.apache.accumulo.core.data.ResourceGroupId;
+import org.apache.accumulo.miniclusterImpl.MiniAccumuloConfigImpl;
+import org.apache.accumulo.test.functional.ConfigurableMacBase;
+import org.apache.accumulo.test.util.Wait;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.zookeeper.KeeperException;
+import org.junit.jupiter.api.Test;
+
+public class MultipleManagerStartupWaitIT extends ConfigurableMacBase {
+
+ @Override
+ protected void configure(MiniAccumuloConfigImpl cfg, Configuration
hadoopCoreSite) {
+ // Set this lower so that locks timeout faster
+ cfg.setProperty(Property.INSTANCE_ZK_TIMEOUT, "5s");
+ cfg.setProperty(Property.MANAGER_STARTUP_MANAGER_AVAIL_MIN_COUNT, "2");
+ cfg.setProperty(Property.MANAGER_STARTUP_MANAGER_AVAIL_MAX_WAIT, "10s");
+ super.configure(cfg, hadoopCoreSite);
+ }
+
+ @Override
+ public void setUp() throws Exception {
+ // Overriding setup here so that the cluster
+ // is not started. We are going to start in
+ // manually in the test method
+ }
+
+ private List<String> getAssistantManagers() throws KeeperException,
InterruptedException {
+ String zAsstMgrPath = Constants.ZMANAGER_ASSISTANT_LOCK + "/" +
ResourceGroupId.DEFAULT;
+ return
getCluster().getServerContext().getZooSession().getChildren(zAsstMgrPath, null);
+ }
+
+ @Test
+ public void testManagerWait() throws Exception {
+
+ AtomicReference<Throwable> startError = new AtomicReference<>();
+ Thread clusterThread = new Thread(() -> {
+ try {
+ super.setUp();
+ } catch (Exception e) {
+ startError.set(e);
+ }
+ });
+ clusterThread.start();
+
+ // Wait a few seconds for processes to start and
+ // for ServerContext to be created
+ Thread.sleep(10_000);
Review Comment:
Is this sleep needed w/ the wait for on the next line? Will the wait for
error w/o the sleep? If so maybe could make the wait for code just catch
errors and log at debug instead of sleeping.
--
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]