From 783984244152987ecac6a07675f61a8aba41f587 Mon Sep 17 00:00:00 2001 From: Sean Busbey Date: Thu, 14 Aug 2014 01:23:03 -0500 Subject: [PATCH] HBASE-11731 Allow testing a subset of shell tests. --- hbase-shell/src/test/ruby/tests_runner.rb | 10 +++++++- src/main/docbkx/developer.xml | 38 +++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+), 1 deletion(-) diff --git a/hbase-shell/src/test/ruby/tests_runner.rb b/hbase-shell/src/test/ruby/tests_runner.rb index 7e40962..e1458db 100644 --- a/hbase-shell/src/test/ruby/tests_runner.rb +++ b/hbase-shell/src/test/ruby/tests_runner.rb @@ -54,7 +54,15 @@ files.each do |file| end end -if !Test::Unit::AutoRunner.run +# If this system property is set, we'll use it to filter the test cases. +runner_args = [] +if java.lang.System.get_property('shell.test') + shell_test_pattern = java.lang.System.get_property('shell.test') + puts "Only running tests that match #{shell_test_pattern}" + runner_args << "--testcase=#{shell_test_pattern}" +end +# first couple of args are to match the defaults, so we can pass options to limit the tests run +if !(Test::Unit::AutoRunner.run(false, nil, runner_args)) raise "Shell unit tests failed. Check output file for details." end diff --git a/src/main/docbkx/developer.xml b/src/main/docbkx/developer.xml index 91fb5f3..bf34a34 100644 --- a/src/main/docbkx/developer.xml +++ b/src/main/docbkx/developer.xml @@ -513,6 +513,44 @@ HBase have a character not usually seen in other projects. the tests must be strict unit tests and just test the class under test - no use of the HBaseTestingUtility or minicluster is allowed (or even possible given the dependency tree). +
+ Testing the HBase Shell + + The HBase shell and its tests are predominantly written in jruby. In order to make these + tests run as a part of the standard build, there is a single JUnit test, + TestShell, that takes care of loading the jruby implemented tests and + running them. You can run all of these tests from the top level with: + + + mvn clean test -Dtest=TestShell + + + Alternatively, you may limit the shell tests that run using the system variable + shell.test. This value may specify a particular test case by name. For + example, the tests that cover the shell commands for altering tables are contained in the test + case AdminAlterTableTest and you can run them with: + + + mvn clean test -Dtest=TestShell -Dshell.test=AdminAlterTableTest + + + You may also use a Ruby Regular Expression + literal (in the /pattern/ style) to select a set of test cases. + You can run all of the HBase admin related tests, including both the normal administration and + the security administration, with the command: + + + mvn clean test -Dtest=TestShell -Dshell.test=/.*Admin.*Test/ + + + In the event of a test failure, you can see details by examining the XML version of the + surefire report results + + + vim hbase-shell/target/surefire-reports/TEST-org.apache.hadoop.hbase.client.TestShell.xml + +
Running Tests in other Modules If the module you are developing in has no other dependencies on other HBase modules, then -- 2.0.3