Merge "Add name to compact output"

This commit is contained in:
Zuul 2021-03-13 09:20:08 +00:00 committed by Gerrit Code Review
commit d43d59e4c6
2 changed files with 15 additions and 11 deletions

View File

@ -181,8 +181,10 @@ DEFAULT_SHRINK_THRESHOLD = DEFAULT_SHARD_CONTAINER_THRESHOLD * \
def _print_shard_range(sr, level=0): def _print_shard_range(sr, level=0):
indent = ' ' * level indent = ' ' * level
print(indent + 'objects: %-9d lower: %r' % (sr.object_count, sr.lower_str)) print(indent + '%r' % sr.name)
print(indent + ' state: %-9s upper: %r' % (sr.state_text, sr.upper_str)) print(indent + ' objects: %-9d lower: %r' % (sr.object_count,
sr.lower_str))
print(indent + ' state: %-9s upper: %r' % (sr.state_text, sr.upper_str))
def _load_and_validate_shard_data(args): def _load_and_validate_shard_data(args):

View File

@ -694,15 +694,17 @@ class TestManageShardRanges(unittest.TestCase):
self.assert_starts_with(err_lines[0], 'Loaded db broker for ') self.assert_starts_with(err_lines[0], 'Loaded db broker for ')
out_lines = out.getvalue().split('\n') out_lines = out.getvalue().split('\n')
self.assertIn('total of 20 objects', out_lines[0]) self.assertIn('total of 20 objects', out_lines[0])
self.assertIn('objects: 10', out_lines[1]) self.assertIn('.shards_a', out_lines[1])
self.assertIn('state: active', out_lines[2]) self.assertIn('objects: 10', out_lines[2])
self.assertIn('objects: 10', out_lines[3]) self.assertIn('state: active', out_lines[3])
self.assertIn('state: active', out_lines[4]) self.assertIn('.shards_a', out_lines[4])
self.assertIn('can be compacted into', out_lines[5]) self.assertIn('objects: 10', out_lines[5])
self.assertIn('objects: 10', out_lines[6]) self.assertIn('state: active', out_lines[6])
self.assertIn('state: active', out_lines[7]) self.assertIn('can be compacted into', out_lines[7])
broker_ranges = broker.get_shard_ranges() self.assertIn('.shards_a', out_lines[8])
return broker_ranges self.assertIn('objects: 10', out_lines[9])
self.assertIn('state: active', out_lines[10])
return broker.get_shard_ranges()
broker_ranges = do_compact('n') broker_ranges = do_compact('n')
# expect no changes to shard ranges # expect no changes to shard ranges