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

iwasakims pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/bigtop.git


The following commit(s) were added to refs/heads/master by this push:
     new 08a3f060 Bigtop-3887: Fix Phoenix smoke-test is failed (#1068)
08a3f060 is described below

commit 08a3f060b59f9148ae2c91c00e538b3b6f68d7ea
Author: Shuhei Yamasaki <[email protected]>
AuthorDate: Mon Dec 5 10:33:29 2022 +0900

    Bigtop-3887: Fix Phoenix smoke-test is failed (#1068)
---
 .../src/common/phoenix/install_phoenix.sh          |  2 +-
 bigtop-packages/src/deb/phoenix/control            |  2 +-
 bigtop-packages/src/rpm/phoenix/SPECS/phoenix.spec |  6 +++
 bigtop-tests/smoke-tests/phoenix/STOCK_SYMBOL.csv  |  9 ----
 bigtop-tests/smoke-tests/phoenix/STOCK_SYMBOL.sql  | 24 ----------
 .../smoke-tests/phoenix/TestPhoenixSimple.groovy   | 55 ++++++++++++++++++++++
 bigtop-tests/smoke-tests/phoenix/build.gradle      |  2 +-
 bigtop-tests/smoke-tests/phoenix/smoke-test.sql    |  2 +-
 provisioner/utils/smoke-tests.sh                   |  1 +
 9 files changed, 66 insertions(+), 37 deletions(-)

diff --git a/bigtop-packages/src/common/phoenix/install_phoenix.sh 
b/bigtop-packages/src/common/phoenix/install_phoenix.sh
index 8a70a822..f661ff14 100755
--- a/bigtop-packages/src/common/phoenix/install_phoenix.sh
+++ b/bigtop-packages/src/common/phoenix/install_phoenix.sh
@@ -118,7 +118,7 @@ cp -r $BUILD_DIR/bin $PREFIX/$LIB_DIR/
 chmod 755 $PREFIX/$BIN_DIR/*.py
 
 cp -a $BUILD_DIR/{LICENSE,NOTICE} $PREFIX/$DOC_DIR/
-cp -ra $BUILD_DIR/examples $PREFIX/$DOC_DIR
+cp -ra $BUILD_DIR/examples $PREFIX/$LIB_DIR/
 
 # Remove the executable bit from jars to avoid lintian warnings
 find $PREFIX/$LIB_DIR -name '*.jar' -exec chmod a-x {} \;
diff --git a/bigtop-packages/src/deb/phoenix/control 
b/bigtop-packages/src/deb/phoenix/control
index d601f278..ab0ea63f 100644
--- a/bigtop-packages/src/deb/phoenix/control
+++ b/bigtop-packages/src/deb/phoenix/control
@@ -23,7 +23,7 @@ Homepage: http://phoenix.apache.org
 
 Package: phoenix
 Architecture: all
-Depends: bigtop-utils (>= 0.7)
+Depends: bigtop-utils (>= 0.7),  python (>= 2.6)
 Description: Phoenix is a SQL skin over HBase and client-embedded JDBC driver.
  Phoenix is a SQL skin over HBase, delivered as a client-embedded JDBC driver.
  The Phoenix query engine transforms an SQL query into one or more HBase scans,
diff --git a/bigtop-packages/src/rpm/phoenix/SPECS/phoenix.spec 
b/bigtop-packages/src/rpm/phoenix/SPECS/phoenix.spec
index 54bb56bf..1a7b2533 100644
--- a/bigtop-packages/src/rpm/phoenix/SPECS/phoenix.spec
+++ b/bigtop-packages/src/rpm/phoenix/SPECS/phoenix.spec
@@ -14,6 +14,7 @@
 # limitations under the License.
 %define phoenix_home /usr/lib/%{name}
 %define bin_phoenix %{phoenix_home}/bin
+%define examples_phoenix %{phoenix_home}/examples
 %define etc_phoenix_conf %{_sysconfdir}/%{name}/conf
 %define etc_phoenix_conf_dist %{etc_phoenix_conf}.dist
 %define var_lib_phoenix /var/lib/%{name}
@@ -128,6 +129,10 @@ getent passwd phoenix >/dev/null || useradd -c "Phoenix" 
-s /sbin/nologin -g pho
 %post
 %{alternatives_cmd} --install %{etc_phoenix_conf} %{name}-conf 
%{etc_phoenix_conf_dist} 30
 
+%if  0%{?rhel} >= 8
+%{alternatives_cmd} --set python /usr/bin/python3
+%endif
+
 
 %preun
 if [ "$1" = 0 ]; then
@@ -143,4 +148,5 @@ fi
 %doc %{doc_phoenix}
 %{phoenix_home}/phoenix-*.jar
 %{bin_phoenix}
+%{examples_phoenix}
 %config(noreplace) %{etc_phoenix_conf_dist}
diff --git a/bigtop-tests/smoke-tests/phoenix/STOCK_SYMBOL.csv 
b/bigtop-tests/smoke-tests/phoenix/STOCK_SYMBOL.csv
deleted file mode 100644
index 66c10329..00000000
--- a/bigtop-tests/smoke-tests/phoenix/STOCK_SYMBOL.csv
+++ /dev/null
@@ -1,9 +0,0 @@
-AAPL,APPLE Inc.
-CRM,SALESFORCE
-GOOG,Google
-HOG,Harlet-Davidson Inc.
-HPQ,Hewlett Packard
-INTC,Intel
-MSFT,Microsoft
-WAG,Walgreens
-WMT,Walmart
diff --git a/bigtop-tests/smoke-tests/phoenix/STOCK_SYMBOL.sql 
b/bigtop-tests/smoke-tests/phoenix/STOCK_SYMBOL.sql
deleted file mode 100644
index f098da7b..00000000
--- a/bigtop-tests/smoke-tests/phoenix/STOCK_SYMBOL.sql
+++ /dev/null
@@ -1,24 +0,0 @@
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
--- creates stock table with single row
-CREATE TABLE IF NOT EXISTS STOCK_SYMBOL (SYMBOL VARCHAR NOT NULL PRIMARY KEY, 
COMPANY VARCHAR);
-UPSERT INTO STOCK_SYMBOL VALUES ('CRM','SalesForce.com');
-SELECT * FROM STOCK_SYMBOL;
-
diff --git a/bigtop-tests/smoke-tests/phoenix/TestPhoenixSimple.groovy 
b/bigtop-tests/smoke-tests/phoenix/TestPhoenixSimple.groovy
new file mode 100644
index 00000000..0cabaec1
--- /dev/null
+++ b/bigtop-tests/smoke-tests/phoenix/TestPhoenixSimple.groovy
@@ -0,0 +1,55 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.bigtop.itest.phoenix
+
+import org.junit.BeforeClass
+import org.junit.AfterClass
+import static org.junit.Assert.assertNotNull
+import org.apache.bigtop.itest.shell.Shell
+import static org.junit.Assert.assertTrue
+import org.junit.Test
+import org.apache.bigtop.itest.JarContent
+import org.apache.bigtop.itest.TestUtils
+import org.apache.commons.logging.LogFactory
+import org.apache.commons.logging.Log
+
+class TestPhoenixSimple {
+  static private Log LOG = LogFactory.getLog(Object.class)
+
+  static Shell sh = new Shell("/bin/bash -s")
+  static final String PHOENIX_HOME = System.getenv("PHOENIX_HOME")
+  static final String PSQL = PHOENIX_HOME + "/bin/psql.py"
+  
+  @AfterClass
+  public static void tearDown() {
+    sh.exec(PSQL + "smoke-test-teardown.sql")
+  }
+
+  @BeforeClass
+  static void setUp() {
+    sh.exec(PSQL + " " + PHOENIX_HOME + "/examples/STOCK_SYMBOL.sql " + 
PHOENIX_HOME + "/examples/STOCK_SYMBOL.csv")
+  }
+
+  @Test
+  void test() {
+    sh.exec(PSQL + " smoke-test.sql >> /tmp/bigtop-phoenix-smoke-simple")
+    sh.exec("cat /tmp/bigtop-phoenix-smoke-simple")
+    assertTrue("Test failed. " + sh.getOut() + " " + sh.getErr(), 
sh.getOut().toString().contains("SALESFORCE") )
+  }
+}
diff --git a/bigtop-tests/smoke-tests/phoenix/build.gradle 
b/bigtop-tests/smoke-tests/phoenix/build.gradle
index 977095a9..7a59b73b 100644
--- a/bigtop-tests/smoke-tests/phoenix/build.gradle
+++ b/bigtop-tests/smoke-tests/phoenix/build.gradle
@@ -16,7 +16,7 @@
  * limitations under the License.
  */
 def tests_to_include() {
-  return ["TestPhoenixQueryServer.groovy"];
+  return ["TestPhoenixSimple.groovy"];
 }
 
 sourceSets {
diff --git a/bigtop-tests/smoke-tests/phoenix/smoke-test.sql 
b/bigtop-tests/smoke-tests/phoenix/smoke-test.sql
index 6e0e61d0..d4067de5 100644
--- a/bigtop-tests/smoke-tests/phoenix/smoke-test.sql
+++ b/bigtop-tests/smoke-tests/phoenix/smoke-test.sql
@@ -1 +1 @@
-SELECT * FROM STOCK_SYMBOL
+SELECT * FROM STOCK_SYMBOL;
diff --git a/provisioner/utils/smoke-tests.sh b/provisioner/utils/smoke-tests.sh
index 0cc254e7..d6fdb716 100755
--- a/provisioner/utils/smoke-tests.sh
+++ b/provisioner/utils/smoke-tests.sh
@@ -41,6 +41,7 @@ export HADOOP_CONF_DIR=${HADOOP_CONF_DIR:-/etc/hadoop/conf}
 export HADOOP_MAPRED_HOME=${HADOOP_MAPRED_HOME:-/usr/lib/hadoop-mapreduce}
 export HBASE_HOME=${HBASE_HOME:-/usr/lib/hbase}
 export HBASE_CONF_DIR=${HBASE_CONF_DIR:-/usr/lib/hbase/conf}
+export PHOENIX_HOME=${PHOENIX_HOME:-/usr/lib/phoenix}
 export HIVE_HOME=${HIVE_HOME:-/usr/lib/hive}
 export HIVE_CONF_DIR=${HIVE_CONF_DIR:-/etc/hive/conf}
 export KAFKA_HOME=${KAFKA_HOME:-/usr/lib/kafka}

Reply via email to