HBASE-19714 Fix broken status-detailed

Expanded on the unit tests to catch this in the future.

Signed-off-by: Michael Stack <stack@apache.org>
This commit is contained in:
Josh Elser 2018-01-05 18:13:54 -05:00 committed by Michael Stack
parent 54928ce3ea
commit ea819d1733
No known key found for this signature in database
GPG Key ID: 9816C7FC8ACC93D2
2 changed files with 45 additions and 8 deletions

View File

@ -727,8 +727,8 @@ module Hbase
if format == 'detailed'
puts(format('version %s', status.getHBaseVersion))
# Put regions in transition first because usually empty
puts(format('%d regionsInTransition', status.getRegionsInTransition.size))
for v in status.getRegionsInTransition
puts(format('%d regionsInTransition', status.getRegionStatesInTransition.size))
for v in status.getRegionStatesInTransition
puts(format(' %s', v))
end
master = status.getMaster

View File

@ -515,17 +515,54 @@ module Hbase
assert_not_equal(nil, table)
table.close
end
end
define_test "Get replication status" do
replication_status("replication", "both")
# Tests for the `status` shell command
class StatusTest < Test::Unit::TestCase
include TestHelpers
def setup
setup_hbase
# Create test table if it does not exist
@test_name = 'hbase_shell_tests_table'
drop_test_table(@test_name)
create_test_table(@test_name)
end
define_test "Get replication source metrics information" do
replication_status("replication", "source")
def teardown
shutdown
end
define_test "Get replication sink metrics information" do
replication_status("replication", "sink")
define_test 'Get replication status' do
output = capture_stdout { replication_status('replication', 'both') }
puts "Status output:\n#{output}"
assert output.include? 'SOURCE'
assert output.include? 'SINK'
end
define_test 'Get replication source metrics information' do
output = capture_stdout { replication_status('replication', 'source') }
puts "Status output:\n#{output}"
assert output.include? 'SOURCE'
end
define_test 'Get replication sink metrics information' do
output = capture_stdout { replication_status('replication', 'sink') }
puts "Status output:\n#{output}"
assert output.include? 'SINK'
end
define_test 'Get simple status' do
output = capture_stdout { admin.status('simple', '') }
puts "Status output:\n#{output}"
assert output.include? 'active master'
end
define_test 'Get detailed status' do
output = capture_stdout { admin.status('detailed', '') }
puts "Status output:\n#{output}"
# Some text which isn't in the simple output
assert output.include? 'regionsInTransition'
end
end