3 # Licensed to the Apache Software Foundation (ASF) under one
4 # or more contributor license agreements. See the NOTICE file
5 # distributed with this work for additional information
6 # regarding copyright ownership. The ASF licenses this file
7 # to you under the Apache License, Version 2.0 (the
8 # "License"); you may not use this file except in compliance
9 # with the License. You may obtain a copy of the License at
11 # http://www.apache.org/licenses/LICENSE-2.0
13 # Unless required by applicable law or agreed to in writing, software
14 # distributed under the License is distributed on an "AS IS" BASIS,
15 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 # See the License for the specific language governing permissions and
17 # limitations under the License.
25 # This runner will only launch shell tests that don't require a HBase cluster running.
27 unless defined?($TEST_CLUSTER)
30 # Set logging level to avoid verboseness
31 org.apache.log4j.Logger.getRootLogger.setLevel(org.apache.log4j.Level::OFF)
32 org.apache.log4j.Logger.getLogger("org.apache.zookeeper").setLevel(org.apache.log4j.Level::OFF)
33 org.apache.log4j.Logger.getLogger("org.apache.hadoop.hdfs").setLevel(org.apache.log4j.Level::OFF)
34 org.apache.log4j.Logger.getLogger("org.apache.hadoop.hbase").setLevel(org.apache.log4j.Level::OFF)
35 org.apache.log4j.Logger.getLogger("org.apache.hadoop.ipc.HBaseServer").setLevel(org.apache.log4j.Level::OFF)
37 java_import org.apache.hadoop.hbase.HBaseTestingUtility
39 $TEST_CLUSTER = HBaseTestingUtility.new
40 $TEST_CLUSTER.configuration.setInt("hbase.regionserver.msginterval", 100)
41 $TEST_CLUSTER.configuration.setInt("hbase.client.pause", 250)
42 $TEST_CLUSTER.configuration.setInt(org.apache.hadoop.hbase.HConstants::HBASE_CLIENT_RETRIES_NUMBER, 6)
47 puts "Running tests without a cluster..."
49 if java.lang.System.get_property('shell.test.include')
50 includes = Set.new(java.lang.System.get_property('shell.test.include').split(','))
53 if java.lang.System.get_property('shell.test.exclude')
54 excludes = Set.new(java.lang.System.get_property('shell.test.exclude').split(','))
57 files = Dir[ File.dirname(__FILE__) + "/**/*_no_cluster.rb" ]
59 filename = File.basename(file)
60 if includes != nil && !includes.include?(filename)
61 puts "Skip #{filename} because of not included"
64 if excludes != nil && excludes.include?(filename)
65 puts "Skip #{filename} because of excluded"
76 # If this system property is set, we'll use it to filter the test cases.
78 if java.lang.System.get_property('shell.test')
79 shell_test_pattern = java.lang.System.get_property('shell.test')
80 puts "Only running tests that match #{shell_test_pattern}"
81 runner_args << "--testcase=#{shell_test_pattern}"
83 # first couple of args are to match the defaults, so we can pass options to limit the tests run
84 if !(Test::Unit::AutoRunner.run(false, nil, runner_args))
85 raise "Shell unit tests failed. Check output file for details."
88 puts "Done with tests! Shutting down the cluster..."
90 $TEST_CLUSTER.shutdownMiniCluster
91 java.lang.System.exit(0)