diff --git a/hbase-shell/src/main/ruby/shell/commands/list_regions.rb b/hbase-shell/src/main/ruby/shell/commands/list_regions.rb index bcc0c4aaf34..0ce569c0a31 100644 --- a/hbase-shell/src/main/ruby/shell/commands/list_regions.rb +++ b/hbase-shell/src/main/ruby/shell/commands/list_regions.rb @@ -50,6 +50,8 @@ EOF options = { SERVER_NAME => options } end + raise "Table #{table_name} must be enabled." unless admin.enabled?(table_name) + size_hash = {} if cols.nil? size_hash = { 'SERVER_NAME' => 12, 'REGION_NAME' => 12, 'START_KEY' => 10, 'END_KEY' => 10, 'SIZE' => 5, 'REQ' => 5, 'LOCALITY' => 10 } diff --git a/hbase-shell/src/test/ruby/hbase/admin_test.rb b/hbase-shell/src/test/ruby/hbase/admin_test.rb index 929484c51d2..a27bbc50822 100644 --- a/hbase-shell/src/test/ruby/hbase/admin_test.rb +++ b/hbase-shell/src/test/ruby/hbase/admin_test.rb @@ -319,6 +319,18 @@ module Hbase admin.truncate_preserve(@create_test_name, $TEST_CLUSTER.getConfiguration) assert_equal(splits, table(@create_test_name)._get_splits_internal()) end + + #------------------------------------------------------------------------------- + + define_test "list_regions should fail for disabled table" do + drop_test_table(@create_test_name) + admin.create(@create_test_name, 'a') + command(:disable, @create_test_name) + assert(:is_disabled, @create_test_name) + assert_raise(RuntimeError) do + command(:list_regions, @create_test_name) + end + end end # Simple administration methods tests