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

ivandasch pushed a commit to branch ignite-2.13
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/ignite-2.13 by this push:
     new e6fcb27f716 IGNITE-16793 Fix unexpected JVM termination during 
ZookeeperDiscoverySpiTestSuite1 execution (#9939)
e6fcb27f716 is described below

commit e6fcb27f716d779eeba5369a637f2b7e67b621ad
Author: Shishkov Ilya <[email protected]>
AuthorDate: Wed Apr 6 12:25:41 2022 +0300

    IGNITE-16793 Fix unexpected JVM termination during 
ZookeeperDiscoverySpiTestSuite1 execution (#9939)
    
    (cherry picked from commit 7a16e8397081d125b1852d6099c87dbb75cdfa70)
---
 .../zk/ZookeeperDiscoverySpiTestUtil.java          | 28 +++++++++++++++++++---
 1 file changed, 25 insertions(+), 3 deletions(-)

diff --git 
a/modules/zookeeper/src/test/java/org/apache/ignite/spi/discovery/zk/ZookeeperDiscoverySpiTestUtil.java
 
b/modules/zookeeper/src/test/java/org/apache/ignite/spi/discovery/zk/ZookeeperDiscoverySpiTestUtil.java
index 93bbba809ea..f5b7dda8213 100644
--- 
a/modules/zookeeper/src/test/java/org/apache/ignite/spi/discovery/zk/ZookeeperDiscoverySpiTestUtil.java
+++ 
b/modules/zookeeper/src/test/java/org/apache/ignite/spi/discovery/zk/ZookeeperDiscoverySpiTestUtil.java
@@ -19,6 +19,7 @@ package org.apache.ignite.spi.discovery.zk;
 
 import java.io.File;
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import org.apache.curator.test.InstanceSpec;
@@ -30,6 +31,12 @@ import org.jetbrains.annotations.Nullable;
  * Utility to run regular Ignite tests with {@link 
org.apache.ignite.spi.discovery.zk.ZookeeperDiscoverySpi}.
  */
 public class ZookeeperDiscoverySpiTestUtil {
+    /** Property name for Zookeeper's election port bind retry attempts count. 
*/
+    public static final String ZK_ELECTION_PORT_BIND_RETRY = 
"electionPortBindRetry";
+
+    /** Property name for Zookeeper's 'enable admin server' flag. */
+    public static final String ZK_ENABLE_ADMIN_SERVER = "admin.enableServer";
+
     /**
      * @param instances Number of instances in cluster.
      * @return Test cluster.
@@ -61,14 +68,29 @@ public class ZookeeperDiscoverySpiTestUtil {
                     throw new IgniteException("Failed to create directory for 
test Zookeeper server: " + file.getAbsolutePath());
             }
 
-            Map<String, Object> props = customProps != null ? customProps[i] : 
null;
-
-            specs.add(new InstanceSpec(file, -1, -1, -1, true, -1, -1, 500, 
props));
+            specs.add(new InstanceSpec(file, -1, -1, -1, true, -1, -1, 500,
+                optimizeProperties(customProps, i)));
         }
 
         return new TestingCluster(specs);
     }
 
+    /**
+     *
+     */
+    private static Map<String, Object> optimizeProperties(Map<String, 
Object>[] customProps, int idx) {
+        Map<String, Object> props = customProps != null && customProps[idx] != 
null ? customProps[idx] : new HashMap<>();
+
+        // In container environment, especially in Kubernetes, this value 
should be increased or set to 0
+        // (infinite retry) to overcome issues related to DNS name resolving.
+        props.putIfAbsent(ZK_ELECTION_PORT_BIND_RETRY, "0");
+
+        // Disable the AdminServer
+        props.putIfAbsent(ZK_ENABLE_ADMIN_SERVER, "false");
+
+        return props;
+    }
+
     /**
      * @param file File or directory to delete.
      */

Reply via email to