Repository: bigtop
Updated Branches:
  refs/heads/master 4df9e6973 -> add0bad8f


BIGTOP-1461. Add a simple Hive validation to smoke-tests.

Signed-off-by: [email protected] <jayunit100>


Project: http://git-wip-us.apache.org/repos/asf/bigtop/repo
Commit: http://git-wip-us.apache.org/repos/asf/bigtop/commit/add0bad8
Tree: http://git-wip-us.apache.org/repos/asf/bigtop/tree/add0bad8
Diff: http://git-wip-us.apache.org/repos/asf/bigtop/diff/add0bad8

Branch: refs/heads/master
Commit: add0bad8f57df82fdc9d89e83010eee556a4748a
Parents: 4df9e69
Author: [email protected] <[email protected]>
Authored: Wed Sep 24 23:21:29 2014 -0400
Committer: [email protected] <jayunit100>
Committed: Tue Sep 30 18:53:36 2014 -0400

----------------------------------------------------------------------
 bigtop-tests/smoke-tests/build.gradle           |  8 ++-
 .../smoke-tests/hive/TestHiveSimple.groovy      | 59 ++++++++++++++++++++
 bigtop-tests/smoke-tests/hive/build.gradle      | 11 +++-
 bigtop-tests/smoke-tests/hive/passwd.ql         |  6 ++
 4 files changed, 80 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/bigtop/blob/add0bad8/bigtop-tests/smoke-tests/build.gradle
----------------------------------------------------------------------
diff --git a/bigtop-tests/smoke-tests/build.gradle 
b/bigtop-tests/smoke-tests/build.gradle
index 57286e5..7907600 100644
--- a/bigtop-tests/smoke-tests/build.gradle
+++ b/bigtop-tests/smoke-tests/build.gradle
@@ -47,8 +47,8 @@ subprojects {
   println("Now testing...");
   test {
 
-    
systemProperties['org.apache.bigtop.itest.hivesmoke.TestHiveSmokeBulk.test_include']
 = 'basic'
-       testLogging {
+    //todo, add back in 'basic' after BIGTOP-1392 .
+    testLogging {
       events "passed", "skipped", "failed"
     }
   }
@@ -66,6 +66,10 @@ subprojects {
     }
   }
 
+  /**
+  * In general, java_home should be declared in all cases.
+  */
+  checkEnv(["JAVA_HOME"])
 test.dependsOn compileGroovy
 compileGroovy.dependsOn clean
 }

http://git-wip-us.apache.org/repos/asf/bigtop/blob/add0bad8/bigtop-tests/smoke-tests/hive/TestHiveSimple.groovy
----------------------------------------------------------------------
diff --git a/bigtop-tests/smoke-tests/hive/TestHiveSimple.groovy 
b/bigtop-tests/smoke-tests/hive/TestHiveSimple.groovy
new file mode 100644
index 0000000..680093f
--- /dev/null
+++ b/bigtop-tests/smoke-tests/hive/TestHiveSimple.groovy
@@ -0,0 +1,59 @@
+/**
+ * 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.hadoop.mapreduce
+
+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.hadoop.conf.Configuration
+import org.apache.bigtop.itest.JarContent
+import org.apache.bigtop.itest.TestUtils
+import org.apache.commons.logging.LogFactory
+import org.apache.commons.logging.Log
+
+import org.junit.runner.RunWith
+
+class TestHiveSmoke {
+  static private Log LOG = LogFactory.getLog(Object.class);
+
+  static Shell sh = new Shell("/bin/bash -s");
+
+  @AfterClass
+  public static void tearDown() {
+    sh.exec("hadoop fs -rmr -skipTrash /tmp/hivesmoketest");
+  }
+
+  @BeforeClass
+  static void setUp() {
+    sh.exec("cat /etc/passwd > passwd");
+    sh.exec("hadoop fs -mkdir /tmp/hivesmoketest");
+    sh.exec("hadoop fs -copyFromLocal passwd /tmp/hivesmoketest/input");
+  }
+
+  @Test
+  void test() {
+    sh.exec("hive -f passwd.ql");
+    assertTrue("Example hive count failed. " + sh.getOut() + " " + 
sh.getErr(), sh.getRet() == 0);
+    //since every /etc/passwd has a root user, we should see it in the output.
+    assertTrue("Hive contained meaningfull results out=" + sh.getOut() + " 
err=" + sh.getErr(), sh.getOut().toString().contains("root"));
+  }
+}

http://git-wip-us.apache.org/repos/asf/bigtop/blob/add0bad8/bigtop-tests/smoke-tests/hive/build.gradle
----------------------------------------------------------------------
diff --git a/bigtop-tests/smoke-tests/hive/build.gradle 
b/bigtop-tests/smoke-tests/hive/build.gradle
index 447fb00..8fe69c0 100644
--- a/bigtop-tests/smoke-tests/hive/build.gradle
+++ b/bigtop-tests/smoke-tests/hive/build.gradle
@@ -32,6 +32,7 @@ dependencies {
 
 def tests_to_include() {
   return [
+      "TestHiveSimple.groovy",
       "TestHiveSmokeBulk.groovy",
       "HiveBulkScriptExecutor.groovy"
   ];
@@ -45,14 +46,20 @@ sourceSets {
       ]
     }
     groovy {
-      srcDirs = 
["$System.env.BIGTOP_HOME"+"/bigtop-tests/test-artifacts/hive/"]
+      srcDirs = 
["$System.env.BIGTOP_HOME"+"/bigtop-tests/test-artifacts/hive/",
+                 "$System.env.BIGTOP_HOME"+"/bigtop-tests/smoke-tests/hive/"]
       exclude { FileTreeElement elem -> (doExclude(elem.getName())) }
     }
   }
 }
 
+test {
+ //TODO : Resurrect this line after BIGTOP-1392 is done.
+ 
systemProperties["org.apache.bigtop.itest.hivesmoke.TestHiveSmokeBulk.test_include"]="xxx"
+}
+
 test.doFirst {
   // BIGTOP_HOME is necessary here, since we use it to read in from
   // test-artifacts.
-  checkEnv(["HIVE_HOME", "HIVE_CONF_DIR", "BIGTOP_HOME"])
+  checkEnv(["BIGTOP_HOME", "HIVE_HOME", "HIVE_CONF_DIR", "BIGTOP_HOME"])
 }

http://git-wip-us.apache.org/repos/asf/bigtop/blob/add0bad8/bigtop-tests/smoke-tests/hive/passwd.ql
----------------------------------------------------------------------
diff --git a/bigtop-tests/smoke-tests/hive/passwd.ql 
b/bigtop-tests/smoke-tests/hive/passwd.ql
new file mode 100644
index 0000000..9d584ce
--- /dev/null
+++ b/bigtop-tests/smoke-tests/hive/passwd.ql
@@ -0,0 +1,6 @@
+drop table hivesmoke;
+create external table hivesmoke (
+field1 STRING
+)
+location '/tmp/hivesmoketest/';
+select * from hivesmoke;

Reply via email to