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 adab329a9d
commit 34c334d58f
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' if format == 'detailed'
puts(format('version %s', status.getHBaseVersion)) puts(format('version %s', status.getHBaseVersion))
# Put regions in transition first because usually empty # Put regions in transition first because usually empty
puts(format('%d regionsInTransition', status.getRegionsInTransition.size)) puts(format('%d regionsInTransition', status.getRegionStatesInTransition.size))
for v in status.getRegionsInTransition for v in status.getRegionStatesInTransition
puts(format(' %s', v)) puts(format(' %s', v))
end end
master = status.getMaster master = status.getMaster

View File

@ -515,17 +515,54 @@ module Hbase
assert_not_equal(nil, table) assert_not_equal(nil, table)
table.close table.close
end end
define_test "Get replication status" do
replication_status("replication", "both")
end end
define_test "Get replication source metrics information" do # Tests for the `status` shell command
replication_status("replication", "source") 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 end
define_test "Get replication sink metrics information" do def teardown
replication_status("replication", "sink") shutdown
end
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
end end