Updated Branches:
  refs/heads/master 1271d5ee9 -> 4e77c83ef

BIGTOP-948. TestFileAppend and TestHDFSQuota tests need to be updated


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

Branch: refs/heads/master
Commit: 155f827fe6ed268a9278f5067bdb0a7accc21ea9
Parents: 1271d5e
Author: Roman Shaposhnik <[email protected]>
Authored: Tue Apr 30 09:27:09 2013 -0700
Committer: Roman Shaposhnik <[email protected]>
Committed: Tue Apr 30 11:05:50 2013 -0700

----------------------------------------------------------------------
 .../bigtop/itest/hadoop/hdfs/TestFileAppend.groovy |   12 ++++----
 .../bigtop/itest/hadoop/hdfs/TestHDFSQuota.groovy  |   20 ++++++--------
 2 files changed, 15 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/bigtop/blob/155f827f/bigtop-tests/test-artifacts/hadoop/src/main/groovy/org/apache/bigtop/itest/hadoop/hdfs/TestFileAppend.groovy
----------------------------------------------------------------------
diff --git 
a/bigtop-tests/test-artifacts/hadoop/src/main/groovy/org/apache/bigtop/itest/hadoop/hdfs/TestFileAppend.groovy
 
b/bigtop-tests/test-artifacts/hadoop/src/main/groovy/org/apache/bigtop/itest/hadoop/hdfs/TestFileAppend.groovy
index 8b58685..235220a 100644
--- 
a/bigtop-tests/test-artifacts/hadoop/src/main/groovy/org/apache/bigtop/itest/hadoop/hdfs/TestFileAppend.groovy
+++ 
b/bigtop-tests/test-artifacts/hadoop/src/main/groovy/org/apache/bigtop/itest/hadoop/hdfs/TestFileAppend.groovy
@@ -95,8 +95,8 @@ public class TestFileAppend {
     IOUtils.copyBytes(input1, output1, 4096, true);
 
     sh.exec("hadoop fs -cat $testAppendInput/appendinput1.txt$date > 
$testAppendOutput");
-    sh.exec("if diff $testAppendOutput appendCorrect.txt$date >/dev/null; then 
echo \"success\"; else echo \"failure\"; fi");
-    assertTrue("Append did not work", sh.getOut().get(0).equals("success"));
+    sh.exec("diff $testAppendOutput appendCorrect.txt$date");
+    assertTrue("Append did not work", sh.getRet() == 0);
     sh.exec("rm -rf appendinput1.txt$date", "rm -rf appendinput2.txt$date");
 
   }
@@ -127,8 +127,8 @@ public class TestFileAppend {
     IOUtils.copyBytes(input1, output1, 4096, true);
 
     sh.exec("hadoop fs -cat $testAppendInput/appendinput3.txt$date > 
$testAppendOutput");
-    sh.exec("if diff $testAppendOutput appendCorrect.txt$date >/dev/null; then 
echo \"success\"; else echo \"failure\"; fi");
-    assertTrue("Append did not work", sh.getOut().get(0).equals("success"));
+    sh.exec("diff $testAppendOutput appendCorrect.txt$date");
+    assertTrue("Append did not work", sh.getRet() == 0);
     sh.exec("rm -rf $testAppendOutput", "rm -rf appendinput1.txt$date", "rm 
-rf appendinput2.txt$date");
     sh.exec("rm -rf appendCorrect.txt$date");
     sh.exec("rm -rf appendinput3.txt$date"); 
@@ -163,8 +163,8 @@ public class TestFileAppend {
     IOUtils.copyBytes(input1, output1, 4096, true);
 
     sh.exec("hadoop fs -cat $testAppendInput/3mboutput.file$date > 
$testAppendOutput");
-    sh.exec("if diff $testAppendOutput 3mboutput.file$date >/dev/null; then 
echo \"success\"; else echo \"failure\"; fi");
-    assertTrue("Append result is not what is expected", 
sh.getOut().get(0).equals("success"));
+    sh.exec("diff $testAppendOutput 3mboutput.file$date");
+    assertTrue("Append result is not what is expected", sh.getRet() == 0);
     sh.exec("rm -rf $testAppendOutput", "rm -rf 3mboutput.file$date", "rm -rf 
3mbinput.file$date");
   }
 

http://git-wip-us.apache.org/repos/asf/bigtop/blob/155f827f/bigtop-tests/test-artifacts/hadoop/src/main/groovy/org/apache/bigtop/itest/hadoop/hdfs/TestHDFSQuota.groovy
----------------------------------------------------------------------
diff --git 
a/bigtop-tests/test-artifacts/hadoop/src/main/groovy/org/apache/bigtop/itest/hadoop/hdfs/TestHDFSQuota.groovy
 
b/bigtop-tests/test-artifacts/hadoop/src/main/groovy/org/apache/bigtop/itest/hadoop/hdfs/TestHDFSQuota.groovy
index 5d3c9a7..d6a72c1 100644
--- 
a/bigtop-tests/test-artifacts/hadoop/src/main/groovy/org/apache/bigtop/itest/hadoop/hdfs/TestHDFSQuota.groovy
+++ 
b/bigtop-tests/test-artifacts/hadoop/src/main/groovy/org/apache/bigtop/itest/hadoop/hdfs/TestHDFSQuota.groovy
@@ -32,9 +32,10 @@ public class TestHDFSQuota {
   private static final long LARGE = Long.MAX_VALUE - 1;
   private static final String USERNAME = System.getProperty("user.name");
   private static String quotaDate = 
shHDFS.exec("date").getOut().get(0).replaceAll("\\s","").replaceAll(":","");
-  private static String testQuotaFolder = "testQuotaFolder" + quotaDate;
+  private static String testQuotaFolder = "/tmp/testQuotaFolder" + quotaDate;
   private static String testQuotaFolder1 = testQuotaFolder + "1";
   private static String testQuotaFolder2 = testQuotaFolder + "2";
+  private static String testQuotaFolder3 = testQuotaFolder + "3";
   
   @BeforeClass
   public static void setUp() {
@@ -42,7 +43,7 @@ public class TestHDFSQuota {
     shHDFS.exec("hadoop fs -mkdir $testQuotaFolder1");
     assertTrue("Could not create input directory", shHDFS.getRet() == 0);
 
-    sh.exec("hadoop fs -mkdir $testQuotaFolder1");
+    sh.exec("hadoop fs -mkdir $testQuotaFolder2");
     assertTrue("Could not create input directory", sh.getRet() == 0);
   }
 
@@ -112,15 +113,15 @@ public class TestHDFSQuota {
     shHDFS.exec("hadoop fs -count -q $testQuotaFolder1");
     assertTrue("Could not use count command", shHDFS.getRet() == 0);
     String[] status1 = shHDFS.getOut().get(0).trim().split();
-    shHDFS.exec("hadoop fs -mv $testQuotaFolder1" + " 
/user/hdfs/$testQuotaFolder2");
+    shHDFS.exec("hadoop fs -mv $testQuotaFolder1" + " $testQuotaFolder3");
     assertTrue("Could not use move command", shHDFS.getRet() == 0);
-    shHDFS.exec("hadoop fs -count -q $testQuotaFolder2");
+    shHDFS.exec("hadoop fs -count -q $testQuotaFolder3");
     assertTrue("Could not use count command", shHDFS.getRet() == 0);
     String[] status2 = shHDFS.getOut().get(0).trim().split();
     for (int i = 0; i < status1.length - 1; i++) {
       assertTrue("quotas changed after folder rename", 
status1[i].equals(status2[i]));
     }
-    shHDFS.exec("hadoop fs -mv $testQuotaFolder2" + " 
/user/hdfs/$testQuotaFolder1");
+    shHDFS.exec("hadoop fs -mv $testQuotaFolder3" + " $testQuotaFolder1");
     assertTrue("Could not use move command", shHDFS.getRet() == 0);
   }
 
@@ -200,8 +201,7 @@ public class TestHDFSQuota {
   //@Test - can be reinstated upon resolution of BIGTOP-635 due to restarting 
of hdfs service
   public void testLogEntries() {
     // Log entry created when nodes are started with both quota violations
-    shHDFS.exec("date");
-    String date = "logTest" + 
shHDFS.getOut().get(0).replaceAll("\\s","").replaceAll(":","");
+    String date = "logTest" + quotaDate;
     shHDFS.exec("hadoop fs -mkdir $date");
     assertTrue("Could not use mkdir command", shHDFS.getRet() == 0);
     shHDFS.exec("hadoop fs -put - $date" + "/testString1", "-------TEST 
STRING--------");
@@ -242,8 +242,7 @@ public class TestHDFSQuota {
 
   @Test
   public void testQuotasShouldFail() {
-    shHDFS.exec("date");
-    String date = "failTest" + 
shHDFS.getOut().get(0).replaceAll("\\s","").replaceAll(":","");
+    String date = "failTest" + quotaDate;
     shHDFS.exec("hadoop fs -mkdir $date");
     assertTrue("Could not use mkdir command", shHDFS.getRet() == 0);
     shHDFS.exec("hadoop fs -put - $date" + "/testString1", "-------TEST 
STRING--------");
@@ -276,8 +275,7 @@ public class TestHDFSQuota {
   @Test
   public void testReplicationFactor() {
     // increasing/decreasing replication factor of a file should debit/credit 
quota
-    shHDFS.exec("date");
-    String repFolder = "repFactorTest" + 
shHDFS.getOut().get(0).replaceAll("\\s","").replaceAll(":","");
+    String repFolder = "/tmp/repFactorTest" + quotaDate;
     shHDFS.exec("hadoop fs -mkdir $repFolder");
     assertTrue("Could not use mkdir command", shHDFS.getRet() == 0);    
     shHDFS.exec("hadoop fs -put - $repFolder" + "/testString1" , "-------TEST 
STRING--------");

Reply via email to