BIGTOP-2247. Expand HDFS smoke test suite
Project: http://git-wip-us.apache.org/repos/asf/bigtop/repo Commit: http://git-wip-us.apache.org/repos/asf/bigtop/commit/24bf42da Tree: http://git-wip-us.apache.org/repos/asf/bigtop/tree/24bf42da Diff: http://git-wip-us.apache.org/repos/asf/bigtop/diff/24bf42da Branch: refs/heads/master Commit: 24bf42da798691b7e3c16493a349cc14a4e51e57 Parents: eae6ed3 Author: Konstantin Boudnik <c...@apache.org> Authored: Thu Jan 14 23:43:37 2016 -0800 Committer: Konstantin Boudnik <c...@apache.org> Committed: Fri Jan 15 13:48:28 2016 -0800 ---------------------------------------------------------------------- bigtop-tests/smoke-tests/hdfs/build.gradle | 25 +++++++++++++------- .../itest/hadoop/hdfs/TestDFSAdmin.groovy | 13 ---------- .../itest/hadoop/hdfs/TestHDFSBalancer.groovy | 18 +------------- .../itest/hadoop/hdfs/TestTextSnappy.groovy | 9 ++++--- 4 files changed, 23 insertions(+), 42 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/bigtop/blob/24bf42da/bigtop-tests/smoke-tests/hdfs/build.gradle ---------------------------------------------------------------------- diff --git a/bigtop-tests/smoke-tests/hdfs/build.gradle b/bigtop-tests/smoke-tests/hdfs/build.gradle index 1d8baa2..ee1da46 100644 --- a/bigtop-tests/smoke-tests/hdfs/build.gradle +++ b/bigtop-tests/smoke-tests/hdfs/build.gradle @@ -22,16 +22,13 @@ def tests_to_include() { "TestFileAppend.groovy", "TestFsck.groovy", "TestHDFSQuota.groovy", - /* TODO need to figure out how to unpack the resources - "TestCmdTest.groovy", - "TestCmdText.groovy", - "TestCount.groovy", + "TestHDFSCLI.java", + "TestTextSnappy.groovy", "TestDFSAdmin.groovy", "TestHDFSBalancer.groovy", - - "TestDFSCLI.java", - "TestHDFSCLI.java", - "TestTextSnappy.groovy" + /* + "TestDFSCLI.java", // Can't run until we learn how to change + // effective user in the runtime */ ]; } @@ -62,7 +59,6 @@ sourceSets { resources { srcDirs = [ "${BIGTOP_HOME}/bigtop-tests/test-artifacts/hadoop/src/main/resources", - 'conf/', ] } srcDirs = [ @@ -78,3 +74,14 @@ sourceSets { test.doFirst { checkEnv(["HADOOP_CONF_DIR"]) } + +test { + // Change the default location where configuration file is picked up + systemProperty 'test.cache.data', "${buildDir}/resources/test/clitest_data/" + // Change the default location where test data is picked up + systemProperty 'test.resources.dir', "${buildDir}/resources/test/" + // default user for HCFS CLI test is file-system superuser. Default is 'hdfs' + // However, running that test in provisioned is done under root, hence the + // change to avoid test assert of the effective user + systemProperty 'hcfs.root.username', System.properties['user.name'] +} http://git-wip-us.apache.org/repos/asf/bigtop/blob/24bf42da/bigtop-tests/test-artifacts/hadoop/src/main/groovy/org/apache/bigtop/itest/hadoop/hdfs/TestDFSAdmin.groovy ---------------------------------------------------------------------- diff --git a/bigtop-tests/test-artifacts/hadoop/src/main/groovy/org/apache/bigtop/itest/hadoop/hdfs/TestDFSAdmin.groovy b/bigtop-tests/test-artifacts/hadoop/src/main/groovy/org/apache/bigtop/itest/hadoop/hdfs/TestDFSAdmin.groovy index e4168f5..7eb8e1d 100644 --- a/bigtop-tests/test-artifacts/hadoop/src/main/groovy/org/apache/bigtop/itest/hadoop/hdfs/TestDFSAdmin.groovy +++ b/bigtop-tests/test-artifacts/hadoop/src/main/groovy/org/apache/bigtop/itest/hadoop/hdfs/TestDFSAdmin.groovy @@ -20,8 +20,6 @@ package org.apache.bigtop.itest.hadoop.hdfs; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; -import org.junit.AfterClass; -import org.junit.BeforeClass; import org.junit.Test; import org.apache.bigtop.itest.JarContent; import org.apache.bigtop.itest.shell.Shell; @@ -31,17 +29,6 @@ public class TestDFSAdmin { // set debugging variable to true if you want error messages sent to stdout private static Shell shHDFS = new Shell("/bin/bash", "hdfs"); - @BeforeClass - public static void setUp() { - // unpack resource - JarContent.unpackJarContainer(TestDFSAdmin.class, ".", null); - System.out.println("Running DFSAdmin commands:"); - } - - @AfterClass - public static void tearDown() { - } - @Test public void testDFSbasic() { // report http://git-wip-us.apache.org/repos/asf/bigtop/blob/24bf42da/bigtop-tests/test-artifacts/hadoop/src/main/groovy/org/apache/bigtop/itest/hadoop/hdfs/TestHDFSBalancer.groovy ---------------------------------------------------------------------- diff --git a/bigtop-tests/test-artifacts/hadoop/src/main/groovy/org/apache/bigtop/itest/hadoop/hdfs/TestHDFSBalancer.groovy b/bigtop-tests/test-artifacts/hadoop/src/main/groovy/org/apache/bigtop/itest/hadoop/hdfs/TestHDFSBalancer.groovy index 118affe..03e891e 100644 --- a/bigtop-tests/test-artifacts/hadoop/src/main/groovy/org/apache/bigtop/itest/hadoop/hdfs/TestHDFSBalancer.groovy +++ b/bigtop-tests/test-artifacts/hadoop/src/main/groovy/org/apache/bigtop/itest/hadoop/hdfs/TestHDFSBalancer.groovy @@ -20,8 +20,6 @@ package org.apache.bigtop.itest.hadoop.hdfs; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; -import org.junit.AfterClass; -import org.junit.BeforeClass; import org.junit.Test; import org.apache.bigtop.itest.JarContent; import org.apache.bigtop.itest.shell.Shell; @@ -31,21 +29,7 @@ public class TestHDFSBalancer { private static Shell shHDFS = new Shell("/bin/bash", "hdfs"); // set with -Dthreshold - private static String thresh = "10"; - - @BeforeClass - public static void setUp() { - - // unpack resource - JarContent.unpackJarContainer(TestHDFSBalancer.class, ".", null); - if (System.getProperty("threshold") != null) { - thresh = System.getProperty("threshold"); - } - } - - @AfterClass - public static void tearDown() { - } + private static String thresh = System.getProperty("threshold") ?: "10"; /* * This function executes the hdfs balancer -threshold command with http://git-wip-us.apache.org/repos/asf/bigtop/blob/24bf42da/bigtop-tests/test-artifacts/hadoop/src/main/groovy/org/apache/bigtop/itest/hadoop/hdfs/TestTextSnappy.groovy ---------------------------------------------------------------------- diff --git a/bigtop-tests/test-artifacts/hadoop/src/main/groovy/org/apache/bigtop/itest/hadoop/hdfs/TestTextSnappy.groovy b/bigtop-tests/test-artifacts/hadoop/src/main/groovy/org/apache/bigtop/itest/hadoop/hdfs/TestTextSnappy.groovy index 52df9cb..903c868 100644 --- a/bigtop-tests/test-artifacts/hadoop/src/main/groovy/org/apache/bigtop/itest/hadoop/hdfs/TestTextSnappy.groovy +++ b/bigtop-tests/test-artifacts/hadoop/src/main/groovy/org/apache/bigtop/itest/hadoop/hdfs/TestTextSnappy.groovy @@ -27,13 +27,16 @@ import static org.apache.bigtop.itest.LogErrorsUtils.logError class TestTextSnappy { static Shell sh = new Shell("/bin/bash -s") static String testDir = "testtextsnappy." + (new Date().getTime()) - static String snappyFile = "part-00001.snappy" + static String testCacheDir = System.properties['test.resources.dir'] ? + "${System.properties['test.resources.dir']}/": "" + static String snappyFileName = "part-00001.snappy" + static String snappyFile = "${testCacheDir}${snappyFileName}" @BeforeClass static void setUp() throws IOException { sh.exec( "hadoop fs -mkdir ${testDir}", - "hadoop fs -put ${snappyFile} ${testDir}/${snappyFile}", + "hadoop fs -put ${snappyFile} ${testDir}/${snappyFileName}", ) logError(sh) } @@ -45,7 +48,7 @@ class TestTextSnappy { @Test void testTextSnappy() { - String cmd = "hadoop fs -text ${testDir}/${snappyFile}" + String cmd = "hadoop fs -text ${testDir}/${snappyFileName}" System.out.println(cmd) sh.exec(cmd) String output = sh.getOut().join("\n")