Просмотр исходного кода

HADOOP-4722. Add tests for dfsadmin quota error messages. Contributed by Boris Shkolnik.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/core/trunk@723182 13f79535-47bb-0310-9956-ffa450edef68
Christopher Douglas 16 лет назад
Родитель
Сommit
2f61abaec8
2 измененных файлов с 104 добавлено и 0 удалено
  1. 3 0
      CHANGES.txt
  2. 101 0
      src/test/org/apache/hadoop/cli/testConf.xml

+ 3 - 0
CHANGES.txt

@@ -161,6 +161,9 @@ Trunk (unreleased changes)
     HADOOP-4758. Add a splitter for metrics contexts to support more than one
     type of collector. (cdouglas)
 
+    HADOOP-4722. Add tests for dfsadmin quota error messages. (Boris Shkolnik
+    via cdouglas)
+
   OPTIMIZATIONS
 
     HADOOP-3293. Fixes FileInputFormat to do provide locations for splits

+ 101 - 0
src/test/org/apache/hadoop/cli/testConf.xml

@@ -3165,5 +3165,106 @@
         </comparator>
       </comparators>
     </test>
+    
+    <test> <!--Tested -->
+      <description>verifying error messages for quota commands - setting quota on a file</description>
+      <test-commands>
+        <command>-fs NAMENODE -mkdir /test </command>
+        <command>-fs NAMENODE -touchz /test/file1 </command>
+        <admin-command>-fs NAMENODE -setQuota 1 /test/file1 </admin-command>
+      </test-commands>
+      <cleanup-commands>
+      	<admin-command>-fs NAMENODE -setQuota 5 /test </admin-command>
+        <!-- Same directory will be used in the next test -->
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>SubstringComparator</type>
+          <expected-output>Cannot set quota on a file: /test/file1</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <test> <!--Tested -->
+      <description>verifying error messages for quota commands - setting quota on non-existing file</description>
+      <test-commands>
+        <admin-command>-fs NAMENODE -setSpaceQuota 1g /test1 </admin-command>
+      </test-commands>
+      <cleanup-commands>
+             <!-- Same directory will be used in the next test -->   
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>SubstringComparator</type>
+          <expected-output>Can not find listing for /test1</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <test> <!--Tested -->
+      <description>verifying error messages for quota commands - exceeding quota</description>
+      <test-commands>
+        <admin-command>-fs NAMENODE -setQuota 3 /test </admin-command>
+        <command>-fs NAMENODE -touchz /test/file0 </command>
+        <command>-fs NAMENODE -mkdir /test/test1 </command>
+      </test-commands>
+      <cleanup-commands>
+             <!-- Same directory(/test) will be used in the next test -->   
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>SubstringComparator</type>
+          <expected-output>The quota of /test is exceeded</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+
+    <test> <!--Tested -->
+      <description>verifying error messages for quota commands - setting not valid quota</description>
+      <test-commands>
+        <admin-command>-fs NAMENODE -setQuota 0 /test </admin-command>
+      </test-commands>
+      <cleanup-commands>
+             <!-- Same directory will be used in the next test -->   
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>SubstringComparator</type>
+          <expected-output>Invalid values for quota : 0</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <test> <!--Tested -->
+      <description>verifying error messages for quota commands - setting not valid space quota</description>
+      <test-commands>
+        <admin-command>-fs NAMENODE -setSpaceQuota a5 /test </admin-command>
+      </test-commands>
+      <cleanup-commands>
+             <!-- Same directory will be used in the next test -->   
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>SubstringComparator</type>
+          <expected-output>For input string: "a5"</expected-output>
+        </comparator>
+      </comparators>
+    </test>
+    
+    <test> <!--Tested -->
+      <description>verifying error messages for quota commands - clearQuota on non existing file</description>
+      <test-commands>
+        <admin-command>-fs NAMENODE -clrQuota /test1 </admin-command>
+      </test-commands>
+      <cleanup-commands>
+      	<command>-fs NAMENODE -rmr /test </command>
+      </cleanup-commands>
+      <comparators>
+        <comparator>
+          <type>SubstringComparator</type>
+          <expected-output>Can not find listing for /test1</expected-output>
+        </comparator>
+      </comparators>
+    </test>
   </tests>
 </configuration>