You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bigtop.apache.org by ja...@apache.org on 2014/12/15 01:55:50 UTC

bigtop git commit: BIGTOP-1493. Adding Tachyon smoke tests

Repository: bigtop
Updated Branches:
  refs/heads/master 383993a44 -> fce161888


BIGTOP-1493. Adding Tachyon smoke tests

Signed-off-by: jayunit100 <ja...@apache.org>


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

Branch: refs/heads/master
Commit: fce16188850143f3a2c8237ca1af909fd132452a
Parents: 383993a
Author: David Capwell <dc...@gmail.com>
Authored: Mon Nov 10 10:52:37 2014 -0800
Committer: jayunit100 <ja...@apache.org>
Committed: Sun Dec 14 19:55:36 2014 -0500

----------------------------------------------------------------------
 .../smoke-tests/tachyon/TestTachyonSmoke.groovy | 80 ++++++++++++++++++++
 bigtop-tests/smoke-tests/tachyon/build.gradle   | 48 ++++++++++++
 bigtop-tests/smoke-tests/tachyon/datafile       |  1 +
 .../smoke-tests/tachyon/log4j.properties        | 24 ++++++
 4 files changed, 153 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/bigtop/blob/fce16188/bigtop-tests/smoke-tests/tachyon/TestTachyonSmoke.groovy
----------------------------------------------------------------------
diff --git a/bigtop-tests/smoke-tests/tachyon/TestTachyonSmoke.groovy b/bigtop-tests/smoke-tests/tachyon/TestTachyonSmoke.groovy
new file mode 100644
index 0000000..cde700b
--- /dev/null
+++ b/bigtop-tests/smoke-tests/tachyon/TestTachyonSmoke.groovy
@@ -0,0 +1,80 @@
+/**
+ * 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.tachyon
+
+import org.junit.Before
+import org.apache.bigtop.itest.shell.Shell
+import static org.junit.Assert.assertTrue
+import static org.junit.Assert.assertNotNull
+import org.junit.Test
+import org.apache.bigtop.itest.JarContent
+
+class TestTachyonSmoke {
+
+  def tachyonHome = prop('TACHYON_HOME');
+  def tachyonMasterAddress = prop('TACHYON_MASTER_ADDRESS');
+  def tachyonTestDir = prop('TACHYON_TEST_DIR', '/bigtop');
+  def hadoopHome = prop('HADOOP_HOME');
+
+  def hadoop = "${hadoopHome}/bin/hadoop"
+  def tachyon = "${tachyonHome}/bin/tachyon"
+
+   Shell sh = new Shell("/bin/bash -s");
+
+   String prop(String key) {
+      def value = System.getenv(key)
+      assertNotNull(value)
+      return value
+   }
+
+   String prop(String key, String defaultValue) {
+      def value = System.getenv(key)
+      if (value == null) {
+        return defaultValue
+      }
+      return value
+   }
+
+  /**
+   * Runs the Tachyon runTests command that runs the Tachyon examples against the cluster.
+   * This command takes care of cleanup at the start of each test, so this framework
+   * does not have to worry about cleanup.
+   */
+  @Test
+  void runTests() {
+    sh.exec("$tachyon runTests");
+    assertTrue("runTests failed. " + sh.getOut() + " " + sh.getErr(), sh.getRet() == 0);
+  }
+
+  @Test
+  void hadoopCat() {
+    sh.exec("""
+      set -x
+      set -e
+
+      export LIB_JARS=\$(find ${tachyonHome} -name "tachyon-client-*-jar-with-dependencies.jar" | sort | head -n1)
+      export HADOOP_CLASSPATH=\${LIB_JARS}
+
+      $tachyon tfs rm $tachyonTestDir/hadoopLs/datafile
+      $tachyon tfs copyFromLocal datafile $tachyonTestDir/hadoopLs/datafile
+      $hadoop fs -cat $tachyonMasterAddress/$tachyonTestDir/hadoopLs/datafile
+    """)
+    assertTrue("Unable to list from hadoop. " + sh.getOut().join('\n') + " " + sh.getErr().join('\n'), sh.getRet() == 0);
+  }
+}

http://git-wip-us.apache.org/repos/asf/bigtop/blob/fce16188/bigtop-tests/smoke-tests/tachyon/build.gradle
----------------------------------------------------------------------
diff --git a/bigtop-tests/smoke-tests/tachyon/build.gradle b/bigtop-tests/smoke-tests/tachyon/build.gradle
new file mode 100644
index 0000000..d7c76ae
--- /dev/null
+++ b/bigtop-tests/smoke-tests/tachyon/build.gradle
@@ -0,0 +1,48 @@
+/**
+ * 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.
+ */
+
+apply plugin: 'groovy'
+
+repositories {
+  mavenCentral()
+}
+
+dependencies {
+  //needed to avoid groovy not on classpath error.
+  testCompile 'org.codehaus.groovy:groovy:1.8.0'
+  testCompile "org.apache.bigtop.itest:itest-common:$itestVersion"
+}
+
+sourceSets {
+  test {
+    resources {
+      srcDirs = ['conf/']
+    }
+    groovy {
+      srcDirs = ["./"]
+    }
+  }
+}
+
+test.doFirst {
+  checkEnv([
+    "TACHYON_HOME",
+    "TACHYON_MASTER_ADDRESS",
+    "HADOOP_HOME"
+    ])
+}

http://git-wip-us.apache.org/repos/asf/bigtop/blob/fce16188/bigtop-tests/smoke-tests/tachyon/datafile
----------------------------------------------------------------------
diff --git a/bigtop-tests/smoke-tests/tachyon/datafile b/bigtop-tests/smoke-tests/tachyon/datafile
new file mode 100644
index 0000000..a57d895
--- /dev/null
+++ b/bigtop-tests/smoke-tests/tachyon/datafile
@@ -0,0 +1 @@
+Test file to see if Hadoop is able to read this file from Tachyon.

http://git-wip-us.apache.org/repos/asf/bigtop/blob/fce16188/bigtop-tests/smoke-tests/tachyon/log4j.properties
----------------------------------------------------------------------
diff --git a/bigtop-tests/smoke-tests/tachyon/log4j.properties b/bigtop-tests/smoke-tests/tachyon/log4j.properties
new file mode 100644
index 0000000..db5aacf
--- /dev/null
+++ b/bigtop-tests/smoke-tests/tachyon/log4j.properties
@@ -0,0 +1,24 @@
+# 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.
+
+# Set root logger level to DEBUG and its only appender to A1.
+log4j.rootLogger=TRACE, A1
+
+# A1 is set to be a ConsoleAppender.
+log4j.appender.A1=org.apache.log4j.ConsoleAppender
+
+# A1 uses PatternLayout.
+log4j.appender.A1.layout=org.apache.log4j.PatternLayout
+log4j.appender.A1.layout.ConversionPattern=%-4r [BIGTOP-TEST-LOG %t] %-5p %c %x --- %m%n