hadoop/hadoop-hdfs-project/hadoop-hdfs/src/test/resources/testCacheAdminConf.xml

378 lines
15 KiB
XML
Raw Normal View History

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="testConf.xsl"?>
<!--
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.
-->
<configuration>
<!-- Normal mode is test. To run just the commands and dump the output
to the log, set it to nocompare -->
<mode>test</mode>
<!-- Comparator types:
ExactComparator
SubstringComparator
RegexpComparator
TokenComparator
-->
<tests>
<test> <!--Tested -->
<description>Testing basic usage</description>
<test-commands>
<cache-admin-command></cache-admin-command>
</test-commands>
<cleanup-commands>
</cleanup-commands>
<comparators>
<comparator>
<type>SubstringComparator</type>
<expected-output>Usage: bin/hdfs cacheadmin [COMMAND]</expected-output>
</comparator>
</comparators>
</test>
<test> <!--Tested -->
<description>Testing listing no cache pools</description>
<test-commands>
<cache-admin-command>-listPools</cache-admin-command>
</test-commands>
<cleanup-commands>
</cleanup-commands>
<comparators>
<comparator>
<type>SubstringComparator</type>
<expected-output>Found 0 results.</expected-output>
</comparator>
</comparators>
</test>
<test> <!--Tested -->
<description>Testing adding a cache pool</description>
<test-commands>
<cache-admin-command>-addPool foo</cache-admin-command>
</test-commands>
<cleanup-commands>
<cache-admin-command>-removePool foo</cache-admin-command>
</cleanup-commands>
<comparators>
<comparator>
<type>SubstringComparator</type>
<expected-output>Successfully added cache pool foo.</expected-output>
</comparator>
</comparators>
</test>
<test> <!--Tested -->
<description>Testing modifying a cache pool</description>
<test-commands>
<cache-admin-command>-addPool poolparty -owner alice -group alicegroup -mode 0000 -weight 50</cache-admin-command>
<cache-admin-command>-modifyPool poolparty -owner bob -group bobgroup -mode 0777 -weight 51</cache-admin-command>
<cache-admin-command>-listPools</cache-admin-command>
</test-commands>
<cleanup-commands>
<cache-admin-command>-removePool poolparty</cache-admin-command>
</cleanup-commands>
<comparators>
<comparator>
<type>SubstringComparator</type>
<expected-output>poolparty bob bobgroup rwxrwxrwx 51</expected-output>
</comparator>
</comparators>
</test>
<test> <!--Tested -->
<description>Testing deleting a cache pool</description>
<test-commands>
<cache-admin-command>-addPool foo</cache-admin-command>
<cache-admin-command>-removePool foo</cache-admin-command>
</test-commands>
<cleanup-commands>
</cleanup-commands>
<comparators>
<comparator>
<type>SubstringComparator</type>
<expected-output>Successfully removed cache pool foo.</expected-output>
</comparator>
</comparators>
</test>
<test> <!--Tested -->
<description>Testing listing all cache pools</description>
<test-commands>
<cache-admin-command>-addPool foo -owner bob -group bob -mode 0664</cache-admin-command>
<cache-admin-command>-addPool bar -owner alice -group alicegroup -mode 0755</cache-admin-command>
<cache-admin-command>-listPools</cache-admin-command>
</test-commands>
<cleanup-commands>
<cache-admin-command>-removePool foo</cache-admin-command>
<cache-admin-command>-removePool bar</cache-admin-command>
</cleanup-commands>
<comparators>
<comparator>
<type>SubstringComparator</type>
<expected-output>Found 2 results.</expected-output>
</comparator>
<comparator>
<type>SubstringComparator</type>
<expected-output>bar alice alicegroup rwxr-xr-x 100 </expected-output>
</comparator>
<comparator>
<type>SubstringComparator</type>
<expected-output>foo bob bob rw-rw-r-- 100 </expected-output>
</comparator>
</comparators>
</test>
<test> <!--Tested -->
<description>Testing listing a single cache pool</description>
<test-commands>
<cache-admin-command>-addPool foo -owner bob -group bob -mode 0664</cache-admin-command>
<cache-admin-command>-addPool bar -owner alice -group alicegroup -mode 0755</cache-admin-command>
<cache-admin-command>-listPools foo</cache-admin-command>
</test-commands>
<cleanup-commands>
<cache-admin-command>-removePool foo</cache-admin-command>
<cache-admin-command>-removePool bar</cache-admin-command>
</cleanup-commands>
<comparators>
<comparator>
<type>SubstringComparator</type>
<expected-output>Found 1 result.</expected-output>
</comparator>
<comparator>
<type>SubstringComparator</type>
<expected-output>foo bob bob rw-rw-r-- 100 </expected-output>
</comparator>
</comparators>
</test>
<test> <!--Tested -->
<description>Testing creating cache paths</description>
<test-commands>
<cache-admin-command>-addPool pool1</cache-admin-command>
<cache-admin-command>-addDirective -path /foo -pool pool1</cache-admin-command>
<cache-admin-command>-addDirective -path /bar -pool pool1</cache-admin-command>
<cache-admin-command>-addDirective -path /baz -replication 2 -pool pool1</cache-admin-command>
<cache-admin-command>-listDirectives -pool pool1</cache-admin-command>
</test-commands>
<cleanup-commands>
<cache-admin-command>-removePool pool1</cache-admin-command>
</cleanup-commands>
<comparators>
<comparator>
<type>SubstringComparator</type>
<expected-output>Found 3 entries</expected-output>
</comparator>
<comparator>
<type>SubstringComparator</type>
<expected-output>1 pool1 /foo</expected-output>
</comparator>
<comparator>
<type>SubstringComparator</type>
<expected-output>2 pool1 /bar</expected-output>
</comparator>
<comparator>
<type>SubstringComparator</type>
<expected-output>3 pool1 /baz</expected-output>
</comparator>
</comparators>
</test>
<test> <!--Tested -->
<description>Testing removing cache paths</description>
<test-commands>
<cache-admin-command>-addPool pool1</cache-admin-command>
<cache-admin-command>-addDirective -path /foo -pool pool1</cache-admin-command>
<cache-admin-command>-addDirective -path /bar -pool pool1</cache-admin-command>
<cache-admin-command>-removePool pool1</cache-admin-command>
<cache-admin-command>-listDirectives -pool pool1</cache-admin-command>
</test-commands>
<cleanup-commands>
</cleanup-commands>
<comparators>
<comparator>
<type>SubstringComparator</type>
<expected-output>Found 0 entries</expected-output>
</comparator>
</comparators>
</test>
<test> <!--Tested -->
<description>Testing listing directives filtered by pool</description>
<test-commands>
<cache-admin-command>-addPool pool1</cache-admin-command>
<cache-admin-command>-addPool pool2</cache-admin-command>
<cache-admin-command>-addDirective -path /foo -pool pool1</cache-admin-command>
<cache-admin-command>-addDirective -path /bar -pool pool1</cache-admin-command>
<cache-admin-command>-addDirective -path /baz -pool pool2</cache-admin-command>
<cache-admin-command>-addDirective -path /buz -pool pool2</cache-admin-command>
<cache-admin-command>-listDirectives -pool pool2</cache-admin-command>
</test-commands>
<cleanup-commands>
<cache-admin-command>-removePool pool1</cache-admin-command>
<cache-admin-command>-removePool pool2</cache-admin-command>
</cleanup-commands>
<comparators>
<comparator>
<type>SubstringComparator</type>
<expected-output>Found 2 entries</expected-output>
</comparator>
<comparator>
<type>SubstringComparator</type>
<expected-output>8 pool2 /baz</expected-output>
</comparator>
<comparator>
<type>SubstringComparator</type>
<expected-output>9 pool2 /buz</expected-output>
</comparator>
</comparators>
</test>
<test> <!--Tested -->
<description>Testing listing directives filtered by path</description>
<test-commands>
<cache-admin-command>-addPool pool1</cache-admin-command>
<cache-admin-command>-addPool pool2</cache-admin-command>
<cache-admin-command>-addDirective -path /foo -pool pool1</cache-admin-command>
<cache-admin-command>-addDirective -path /bar -pool pool1</cache-admin-command>
<cache-admin-command>-addDirective -path /foo -pool pool2</cache-admin-command>
<cache-admin-command>-addDirective -path /bar -pool pool2</cache-admin-command>
<cache-admin-command>-listDirectives -path /foo</cache-admin-command>
</test-commands>
<cleanup-commands>
<cache-admin-command>-removePool pool1</cache-admin-command>
<cache-admin-command>-removePool pool2</cache-admin-command>
</cleanup-commands>
<comparators>
<comparator>
<type>SubstringComparator</type>
<expected-output>Found 2 entries</expected-output>
</comparator>
<comparator>
<type>SubstringComparator</type>
<expected-output>10 pool1 /foo</expected-output>
</comparator>
<comparator>
<type>SubstringComparator</type>
<expected-output>12 pool2 /foo</expected-output>
</comparator>
</comparators>
</test>
<test> <!--Tested -->
<description>Testing listing directives filtered by path and pool</description>
<test-commands>
<cache-admin-command>-addPool pool1</cache-admin-command>
<cache-admin-command>-addPool pool2</cache-admin-command>
<cache-admin-command>-addDirective -path /foo -pool pool1</cache-admin-command>
<cache-admin-command>-addDirective -path /bar -pool pool1</cache-admin-command>
<cache-admin-command>-addDirective -path /foo -pool pool2</cache-admin-command>
<cache-admin-command>-addDirective -path /bar -pool pool2</cache-admin-command>
<cache-admin-command>-listDirectives -path /foo -pool pool2</cache-admin-command>
</test-commands>
<cleanup-commands>
<cache-admin-command>-removePool pool1</cache-admin-command>
<cache-admin-command>-removePool pool2</cache-admin-command>
</cleanup-commands>
<comparators>
<comparator>
<type>SubstringComparator</type>
<expected-output>Found 1 entry</expected-output>
</comparator>
<comparator>
<type>SubstringComparator</type>
<expected-output>16 pool2 /foo</expected-output>
</comparator>
</comparators>
</test>
<test> <!--Tested -->
<description>Testing removing a directive</description>
<test-commands>
<cache-admin-command>-addPool pool1</cache-admin-command>
<cache-admin-command>-addDirective -path /foo -pool pool1</cache-admin-command>
<cache-admin-command>-addDirective -path /bar -pool pool1</cache-admin-command>
<cache-admin-command>-removeDirective 18</cache-admin-command>
<cache-admin-command>-listDirectives</cache-admin-command>
</test-commands>
<cleanup-commands>
<cache-admin-command>-removePool pool1</cache-admin-command>
</cleanup-commands>
<comparators>
<comparator>
<type>SubstringComparator</type>
<expected-output>Found 1 entry</expected-output>
</comparator>
<comparator>
<type>SubstringComparator</type>
<expected-output>19 pool1 /bar</expected-output>
</comparator>
</comparators>
</test>
<test> <!--Tested -->
<description>Testing removing every directive for a path</description>
<test-commands>
<cache-admin-command>-addPool pool1</cache-admin-command>
<cache-admin-command>-addPool pool2</cache-admin-command>
<cache-admin-command>-addDirective -path /foo -pool pool1</cache-admin-command>
<cache-admin-command>-addDirective -path /foo -pool pool1</cache-admin-command>
<cache-admin-command>-addDirective -path /bar -pool pool1</cache-admin-command>
<cache-admin-command>-addDirective -path /foo -pool pool2</cache-admin-command>
<cache-admin-command>-addDirective -path /bar -pool pool2</cache-admin-command>
<cache-admin-command>-removeDirectives -path ../../foo</cache-admin-command>
<cache-admin-command>-listDirectives</cache-admin-command>
</test-commands>
<cleanup-commands>
<cache-admin-command>-removePool pool1</cache-admin-command>
<cache-admin-command>-removePool pool2</cache-admin-command>
</cleanup-commands>
<comparators>
<comparator>
<type>SubstringComparator</type>
<expected-output>Found 2 entries</expected-output>
</comparator>
<comparator>
<type>SubstringComparator</type>
<expected-output>22 pool1 /bar</expected-output>
</comparator>
<comparator>
<type>SubstringComparator</type>
<expected-output>24 pool2 /bar</expected-output>
</comparator>
</comparators>
</test>
<test>
<description>Testing the help usage</description>
<test-commands>
<cache-admin-command>-help -addPool</cache-admin-command>
</test-commands>
<cleanup-commands>
</cleanup-commands>
<comparators>
<comparator>
<type>SubstringComparator</type>
<expected-output>Add a new cache pool.</expected-output>
</comparator>
</comparators>
</test>
</tests>
</configuration>