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.
24 puts "Ruby description: #{RUBY_DESCRIPTION}"
26 unless defined?($TEST_CLUSTER)
29 # Set logging level to avoid verboseness
30 org.apache.log4j.Logger.getRootLogger.setLevel(org.apache.log4j.Level::OFF)
31 org.apache.log4j.Logger.getLogger("org.apache.zookeeper").setLevel(org.apache.log4j.Level::OFF)
32 org.apache.log4j.Logger.getLogger("org.apache.hadoop.hdfs").setLevel(org.apache.log4j.Level::OFF)
33 org.apache.log4j.Logger.getLogger("org.apache.hadoop.hbase").setLevel(org.apache.log4j.Level::OFF)
34 org.apache.log4j.Logger.getLogger("org.apache.hadoop.ipc.HBaseServer").setLevel(org.apache.log4j.Level::OFF)
36 java_import org.apache.hadoop.hbase.HBaseTestingUtility
38 $TEST_CLUSTER = HBaseTestingUtility.new
39 $TEST_CLUSTER.configuration.setInt("hbase.regionserver.msginterval", 100)
40 $TEST_CLUSTER.configuration.setInt("hbase.client.pause", 250)
41 $TEST_CLUSTER.configuration.set("hbase.quota.enabled", "true")
42 $TEST_CLUSTER.configuration.set('hbase.master.quotas.snapshot.chore.period', 5000)
43 $TEST_CLUSTER.configuration.set('hbase.master.quotas.snapshot.chore.delay', 5000)
44 $TEST_CLUSTER.configuration.setInt(org.apache.hadoop.hbase.HConstants::HBASE_CLIENT_RETRIES_NUMBER, 6)
45 $TEST_CLUSTER.startMiniCluster
51 puts "Running tests..."
53 if java.lang.System.get_property('shell.test.include')
54 includes = Set.new(java.lang.System.get_property('shell.test.include').split(','))
57 if java.lang.System.get_property('shell.test.exclude')
58 excludes = Set.new(java.lang.System.get_property('shell.test.exclude').split(','))
61 files = Dir[ File.dirname(__FILE__) + "/**/*_test.rb" ]
63 filename = File.basename(file)
64 if includes != nil && !includes.include?(filename)
65 puts "Skip #{filename} because of not included"
68 if excludes != nil && excludes.include?(filename)
69 puts "Skip #{filename} because of excluded"
73 puts "loading test file '#{filename}'."
81 # If this system property is set, we'll use it to filter the test cases.
83 if java.lang.System.get_property('shell.test')
84 shell_test_pattern = java.lang.System.get_property('shell.test')
85 puts "Only running tests that match #{shell_test_pattern}"
86 runner_args << "--testcase=#{shell_test_pattern}"
89 # first couple of args are to match the defaults, so we can pass options to limit the tests run
90 unless Test::Unit::AutoRunner.run(false, nil, runner_args)
91 raise 'Shell unit tests failed. Check output file for details.'
93 rescue SystemExit => e
94 # Unit tests should not raise uncaught SystemExit exceptions. This could cause tests to be ignored.
95 raise 'Caught SystemExit during unit test execution! Check output file for details.'
98 puts "Done with tests! Shutting down the cluster..."
100 $TEST_CLUSTER.shutdownMiniCluster
101 java.lang.System.exit(0)