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

stoty pushed a commit to branch 5.1
in repository https://gitbox.apache.org/repos/asf/phoenix.git


The following commit(s) were added to refs/heads/5.1 by this push:
     new ae39dff896 PHOENIX-7052 phoenix-pherf ITs fail because they do not use 
the miniCluster ZK quorum
ae39dff896 is described below

commit ae39dff8968bee8e6241bea1fc54dbe9e983c7be
Author: Istvan Toth <st...@apache.org>
AuthorDate: Tue Sep 26 13:40:09 2023 +0200

    PHOENIX-7052 phoenix-pherf ITs fail because they do not use the miniCluster 
ZK quorum
---
 .../src/it/java/org/apache/phoenix/pherf/PherfMainIT.java        | 9 +++++----
 .../src/it/java/org/apache/phoenix/pherf/ResultBaseTestIT.java   | 4 +++-
 .../src/it/java/org/apache/phoenix/pherf/SchemaReaderIT.java     | 3 ++-
 .../apache/phoenix/pherf/workload/mt/MultiTenantTestUtils.java   | 9 ++++++++-
 .../pherf/workload/mt/TenantTableOperationWorkloadIT.java        | 6 ++++++
 .../phoenix/pherf/workload/mt/TenantViewOperationWorkloadIT.java | 6 ++++++
 6 files changed, 30 insertions(+), 7 deletions(-)

diff --git 
a/phoenix-pherf/src/it/java/org/apache/phoenix/pherf/PherfMainIT.java 
b/phoenix-pherf/src/it/java/org/apache/phoenix/pherf/PherfMainIT.java
index b6b7c56128..9d083e0c0a 100644
--- a/phoenix-pherf/src/it/java/org/apache/phoenix/pherf/PherfMainIT.java
+++ b/phoenix-pherf/src/it/java/org/apache/phoenix/pherf/PherfMainIT.java
@@ -24,6 +24,7 @@ import org.apache.phoenix.pherf.result.Result;
 import org.apache.phoenix.pherf.result.ResultValue;
 import org.apache.phoenix.pherf.result.file.ResultFileDetails;
 import org.apache.phoenix.pherf.result.impl.CSVFileResultHandler;
+import org.apache.phoenix.pherf.workload.mt.MultiTenantTestUtils;
 import org.junit.Ignore;
 import org.junit.Rule;
 import org.junit.Test;
@@ -56,7 +57,7 @@ public class PherfMainIT extends ResultBaseTestIT {
 
     @Test
     public void testPherfMain() throws Exception {
-        String[] args = { "-q", "-l",
+        String[] args = { "-q", "-l", "-z", 
MultiTenantTestUtils.getZookeeperFromUrl(url),
                 "-schemaFile", ".*create_prod_test_unsalted.sql",
                 "-scenarioFile", ".*prod_test_unsalted_scenario.xml"};
         Pherf pherf = new Pherf(args);
@@ -71,7 +72,7 @@ public class PherfMainIT extends ResultBaseTestIT {
     @Test
     public void testQueryTimeout() throws Exception {
         // Timeout of 0 ms means every query execution should time out
-        String[] args = {"-q", "-l",
+        String[] args = {"-q", "-l", "-z", 
MultiTenantTestUtils.getZookeeperFromUrl(url),
                 "-drop", "all",
                 "-schemaFile", ".*timeout_test_schema.sql",
                 "-scenarioFile", ".*scenario_with_query_timeouts.xml" };
@@ -93,7 +94,7 @@ public class PherfMainIT extends ResultBaseTestIT {
     @Test
     public void testLargeQueryTimeout() throws Exception {
         // Timeout of max_long ms means every query execution should finish 
without timing out
-        String[] args = {"-q", "-l",
+        String[] args = {"-q", "-l", "-z", 
MultiTenantTestUtils.getZookeeperFromUrl(url),
                 "-drop", "all",
                 "-schemaFile", ".*timeout_test_schema.sql",
                 "-scenarioFile", ".*scenario_with_query_timeouts.xml" };
@@ -115,7 +116,7 @@ public class PherfMainIT extends ResultBaseTestIT {
     @Test
     public void testNoQueryTimeout() throws Exception {
         // Missing timeout attribute means every query execution should finish 
without timing out
-        String[] args = {"-q", "-l",
+        String[] args = {"-q", "-l", "-z", 
MultiTenantTestUtils.getZookeeperFromUrl(url),
                 "-drop", "all",
                 "-schemaFile", ".*timeout_test_schema.sql",
                 "-scenarioFile", ".*scenario_with_query_timeouts.xml" };
diff --git 
a/phoenix-pherf/src/it/java/org/apache/phoenix/pherf/ResultBaseTestIT.java 
b/phoenix-pherf/src/it/java/org/apache/phoenix/pherf/ResultBaseTestIT.java
index a869c7845d..1f79fcc758 100644
--- a/phoenix-pherf/src/it/java/org/apache/phoenix/pherf/ResultBaseTestIT.java
+++ b/phoenix-pherf/src/it/java/org/apache/phoenix/pherf/ResultBaseTestIT.java
@@ -30,6 +30,7 @@ import org.apache.phoenix.pherf.configuration.XMLConfigParser;
 import org.apache.phoenix.pherf.result.ResultUtil;
 import org.apache.phoenix.pherf.schema.SchemaReader;
 import org.apache.phoenix.pherf.util.PhoenixUtil;
+import org.apache.phoenix.pherf.workload.mt.MultiTenantTestUtils;
 import org.apache.phoenix.util.ReadOnlyProps;
 import org.junit.After;
 import org.junit.AfterClass;
@@ -59,11 +60,12 @@ public abstract class ResultBaseTestIT extends 
ParallelStatsDisabledIT {
         String dir = properties.getProperty("pherf.default.results.dir");
         resultUtil.ensureBaseDirExists(dir);
 
-        PhoenixUtil.setZookeeper("localhost");
         reader = new SchemaReader(util, matcherSchema);
         parser = new XMLConfigParser(matcherScenario);
 
         setUpTestDriver(ReadOnlyProps.EMPTY_PROPS);
+
+        
PhoenixUtil.setZookeeper(MultiTenantTestUtils.getZookeeperFromUrl(url));
     }
 
     @AfterClass public static synchronized void tearDown() throws Exception {
diff --git 
a/phoenix-pherf/src/it/java/org/apache/phoenix/pherf/SchemaReaderIT.java 
b/phoenix-pherf/src/it/java/org/apache/phoenix/pherf/SchemaReaderIT.java
index c5a93fe4b8..51aab6b3a7 100644
--- a/phoenix-pherf/src/it/java/org/apache/phoenix/pherf/SchemaReaderIT.java
+++ b/phoenix-pherf/src/it/java/org/apache/phoenix/pherf/SchemaReaderIT.java
@@ -39,6 +39,7 @@ import org.apache.phoenix.pherf.configuration.Scenario;
 import org.apache.phoenix.pherf.configuration.XMLConfigParser;
 import org.apache.phoenix.pherf.schema.SchemaReader;
 import org.apache.phoenix.pherf.util.PhoenixUtil;
+import org.apache.phoenix.pherf.workload.mt.MultiTenantTestUtils;
 import org.apache.phoenix.query.BaseTest;
 import org.apache.phoenix.util.ReadOnlyProps;
 import org.junit.After;
@@ -77,7 +78,7 @@ public class SchemaReaderIT extends BaseTest {
 
     private void assertApplySchemaTest() {
         try {
-            util.setZookeeper("localhost");
+            
PhoenixUtil.setZookeeper(MultiTenantTestUtils.getZookeeperFromUrl(url));
             SchemaReader reader = new SchemaReader(util, 
".*datamodel/.*test_schema.*sql");
 
             List<Path> resources = new ArrayList<>(reader.getResourceList());
diff --git 
a/phoenix-pherf/src/it/java/org/apache/phoenix/pherf/workload/mt/MultiTenantTestUtils.java
 
b/phoenix-pherf/src/it/java/org/apache/phoenix/pherf/workload/mt/MultiTenantTestUtils.java
index cac24317c7..c8f9896308 100644
--- 
a/phoenix-pherf/src/it/java/org/apache/phoenix/pherf/workload/mt/MultiTenantTestUtils.java
+++ 
b/phoenix-pherf/src/it/java/org/apache/phoenix/pherf/workload/mt/MultiTenantTestUtils.java
@@ -78,10 +78,17 @@ public class MultiTenantTestUtils {
         int expectedOpGroups;
     }
 
+    public static String getZookeeperFromUrl(String jdbcUrl) {
+        // Pherf should use the full JDBC URL internally instead of the ZK 
quorum.
+        // This is just an ugly hack to get the tests running in the meantime
+        jdbcUrl.replaceAll("\\\\:", "=");
+        String[] parts = jdbcUrl.split(":");
+        return String.join(":", parts[2], parts[3], parts[4]).replaceAll("=", 
"\\\\:");
+    }
+
     public SchemaReader applySchema(PhoenixUtil util, String matcherSchema) 
throws Exception {
         PherfConstants constants = PherfConstants.create();
 
-        PhoenixUtil.setZookeeper("localhost");
         SchemaReader reader = new SchemaReader(util, matcherSchema);
         reader.applySchema();
         List<Path> resources = new ArrayList<>(reader.getResourceList());
diff --git 
a/phoenix-pherf/src/it/java/org/apache/phoenix/pherf/workload/mt/TenantTableOperationWorkloadIT.java
 
b/phoenix-pherf/src/it/java/org/apache/phoenix/pherf/workload/mt/TenantTableOperationWorkloadIT.java
index e65790f318..d0f37e4f58 100644
--- 
a/phoenix-pherf/src/it/java/org/apache/phoenix/pherf/workload/mt/TenantTableOperationWorkloadIT.java
+++ 
b/phoenix-pherf/src/it/java/org/apache/phoenix/pherf/workload/mt/TenantTableOperationWorkloadIT.java
@@ -32,6 +32,7 @@ import 
org.apache.phoenix.pherf.workload.mt.generators.TenantLoadEventGeneratorF
 import 
org.apache.phoenix.pherf.workload.mt.MultiTenantTestUtils.TestConfigAndExpectations;
 import org.junit.After;
 import org.junit.Before;
+import org.junit.BeforeClass;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
 import org.junit.runner.RunWith;
@@ -69,6 +70,11 @@ public class TenantTableOperationWorkloadIT extends 
ParallelStatsDisabledIT {
         return testCases;
     }
 
+    @BeforeClass
+    public static synchronized void setUrl() {
+        
PhoenixUtil.setZookeeper(MultiTenantTestUtils.getZookeeperFromUrl(url));
+    }
+
     @Before
     public void setup() throws Exception {
         multiTenantTestUtils.applySchema(util, 
".*datamodel/.*test_tbl_schema_simple.sql");
diff --git 
a/phoenix-pherf/src/it/java/org/apache/phoenix/pherf/workload/mt/TenantViewOperationWorkloadIT.java
 
b/phoenix-pherf/src/it/java/org/apache/phoenix/pherf/workload/mt/TenantViewOperationWorkloadIT.java
index 88cac4ff8e..478fc9eb4c 100644
--- 
a/phoenix-pherf/src/it/java/org/apache/phoenix/pherf/workload/mt/TenantViewOperationWorkloadIT.java
+++ 
b/phoenix-pherf/src/it/java/org/apache/phoenix/pherf/workload/mt/TenantViewOperationWorkloadIT.java
@@ -36,6 +36,7 @@ import 
org.apache.phoenix.pherf.workload.mt.MultiTenantTestUtils.TestConfigAndEx
 
 import org.junit.After;
 import org.junit.Before;
+import org.junit.BeforeClass;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
 import org.junit.runner.RunWith;
@@ -71,6 +72,11 @@ public class TenantViewOperationWorkloadIT extends 
ParallelStatsDisabledIT {
                         
.findCoprocessorEnvironment(TaskRegionObserver.class.getName());
     }
 
+    @BeforeClass
+    public static synchronized void setUrl() {
+        
PhoenixUtil.setZookeeper(MultiTenantTestUtils.getZookeeperFromUrl(url));
+    }
+
     @Parameterized.Parameters( name = "generator_type={0}" )
     public static synchronized Collection<Object[]> data() {
         List<Object[]> testCases = Lists.newArrayList();

Reply via email to