Skip to content

Commit d084b4c

Browse files
authored
HBASE-28275 Flaky test: Fix 'test_list_decommissioned_regionservers' in TestAdminShell2.java (#5594)
Signed-off-by: Bryan Beaudreault <[email protected]>
1 parent 2c07847 commit d084b4c

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

hbase-shell/src/test/ruby/hbase/admin2_test.rb

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -324,19 +324,24 @@ def teardown
324324
define_test 'list decommissioned regionservers' do
325325
server_name = admin.getServerNames([], true)[0].getServerName()
326326
command(:decommission_regionservers, server_name)
327+
initial_number_of_rows = -1
327328
begin
328329
output = capture_stdout { command(:list_decommissioned_regionservers) }
329330
puts "#{output}"
330331
assert output.include? 'DECOMMISSIONED REGION SERVERS'
331332
assert output.include? "#{server_name}"
332-
assert output.include? '1 row(s)'
333+
matches = output.match(/(\d+) row\(s\)/)
334+
initial_number_of_rows = matches[1].to_i unless matches.nil?
335+
assert initial_number_of_rows > 0
333336
ensure
334337
command(:recommission_regionserver, server_name)
335338
output = capture_stdout { command(:list_decommissioned_regionservers) }
336339
puts "#{output}"
337340
assert output.include? 'DECOMMISSIONED REGION SERVERS'
338341
assert (output.include? "#{server_name}") ? false : true
339-
assert output.include? '0 row(s)'
342+
matches = output.match(/(\d+) row\(s\)/)
343+
final_number_of_rows = matches[1].to_i unless matches.nil?
344+
assert (initial_number_of_rows - final_number_of_rows) == 1
340345
end
341346
end
342347

0 commit comments

Comments
 (0)