Fix test_two_warnings_daily text test
This commit is contained in:
parent
ae4c0c6fa2
commit
c28f1c30dc
|
@ -140,16 +140,23 @@ class TestsWithZpool(unittest.TestCase):
|
|||
return_info = monitor_snapshots_command()
|
||||
|
||||
# Output should be something like:
|
||||
# CRIT: sanoid-test-1 newest hourly snapshot is 6h 30m 1s old (should be < 6h 0m 0s), CRIT: sanoid-test-2 newest hourly snapshot is 6h 30m 1s old (should be < 6h 0m 0s)\n
|
||||
# CRIT: sanoid-test-1 newest hourly snapshot is 1d 5h 0m 0s old (should be < 6h 0m 0s), CRIT: sanoid-test-2 newest hourly snapshot is 1d 5h 0m 0s old (should be < 6h 0m 0s), WARN: sanoid-test-1 newest daily snapshot is 1d 5h 0m 0s old (should be < 1d 4h 0m 0s), WARN: sanoid-test-2 newest daily snapshot is 1d 5h 0m 0s old (should be < 1d 4h 0m 0s)\n
|
||||
# But we cannot be sure about the exact time as test execution could be different on
|
||||
# different machines, so ignore the bits that may be different.
|
||||
print(return_info.stdout)
|
||||
comma_location = return_info.stdout.find(b",")
|
||||
self.assertEqual(return_info.stdout[:49], b"CRIT: sanoid-test-1 newest hourly snapshot is 6h ")
|
||||
self.assertEqual(return_info.stdout[comma_location - 28:comma_location], b"s old (should be < 6h 0m 0s)")
|
||||
self.assertEqual(return_info.stdout[comma_location:comma_location + 51], b", CRIT: sanoid-test-2 newest hourly snapshot is 6h ")
|
||||
self.assertEqual(return_info.stdout[-29:], b"s old (should be < 6h 0m 0s)\n")
|
||||
self.assertEqual(return_info.returncode, 2)
|
||||
output_list = return_info.stdout.split(b", ")
|
||||
|
||||
self.assertEqual(output_list[0][:49], b"CRIT: sanoid-test-1 newest hourly snapshot is 1d ")
|
||||
self.assertEqual(output_list[0][-28:], b"s old (should be < 6h 0m 0s)")
|
||||
self.assertEqual(output_list[1][:49], b"CRIT: sanoid-test-2 newest hourly snapshot is 1d ")
|
||||
self.assertEqual(output_list[1][-28:], b"s old (should be < 6h 0m 0s)")
|
||||
|
||||
self.assertEqual(output_list[2][:48], b"WARN: sanoid-test-1 newest daily snapshot is 1d ")
|
||||
self.assertEqual(output_list[2][-31:], b"s old (should be < 1d 4h 0m 0s)")
|
||||
self.assertEqual(output_list[3][:48], b"WARN: sanoid-test-2 newest daily snapshot is 1d ")
|
||||
self.assertEqual(output_list[3][-32:], b"s old (should be < 1d 4h 0m 0s)\n")
|
||||
|
||||
self.assertEqual(return_info.returncode, 1)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
Loading…
Reference in New Issue