Merge "account_auditor: fix warning string"

This commit is contained in:
Zuul 2022-11-18 18:51:56 +00:00 committed by Gerrit Code Review
commit 280f460c80
2 changed files with 7 additions and 5 deletions

View File

@ -41,6 +41,7 @@ class AccountAuditor(DatabaseAuditor):
if policy_totals[key] == info[key]:
continue
return InvalidAccountInfo(
'The total %(key)s for the container (%(total)s) does not '
'match the sum of %(key)s across policies (%(sum)s)'
% {'key': key, 'total': info[key], 'sum': policy_totals[key]})
'The total %(key)s for the account %(account)s (%(total)s) '
'does not match the sum of %(key)s across policies (%(sum)s)'
% {'key': key, 'account': info.get('account'),
'total': info[key], 'sum': policy_totals[key]})

View File

@ -125,8 +125,9 @@ class TestAuditorRealBroker(unittest.TestCase):
self.assertEqual(len(error_lines), 1)
error_message = error_lines[0]
self.assertIn(broker.db_file, error_message)
self.assertIn('container_count', error_message)
self.assertIn('does not match', error_message)
self.assertIn(
'The total container_count for the account a (3) does not match '
'the sum of container_count across policies (2)', error_message)
self.assertEqual(test_auditor.logger.get_increment_counts(),
{'failures': 1})