mirror of
https://github.com/systemd/systemd-stable.git
synced 2024-12-25 23:21:33 +03:00
test: wait until the unit finishes before checking the log
Otherwise we might read an incomplete log and fail: ``` test_added_after (__main__.ExecutionResumeTest) ... FAIL test_added_before (__main__.ExecutionResumeTest) ... ok test_interleaved (__main__.ExecutionResumeTest) ... ok test_issue_6533 (__main__.ExecutionResumeTest) ... ok test_no_change (__main__.ExecutionResumeTest) ... ok test_removal (__main__.ExecutionResumeTest) ... ok test_swapped (__main__.ExecutionResumeTest) ... ok ====================================================================== FAIL: test_added_after (__main__.ExecutionResumeTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/build/./test/test-exec-deserialization.py", line 152, in test_added_after self.check_output(expected_output) File "/build/./test/test-exec-deserialization.py", line 107, in check_output self.assertEqual(output, expected_output) AssertionError: 'foo\n' != 'foo\nbar\n' foo + bar ---------------------------------------------------------------------- Ran 7 tests in 27.470s ```
This commit is contained in:
parent
842a9d5f91
commit
bb0f817abf
@ -101,6 +101,10 @@ class ExecutionResumeTest(unittest.TestCase):
|
||||
|
||||
def check_output(self, expected_output):
|
||||
for _ in range(15):
|
||||
# Wait until the unit finishes so we don't check an incomplete log
|
||||
if subprocess.call(['systemctl', '-q', 'is-active', self.unit]) == 0:
|
||||
continue
|
||||
|
||||
try:
|
||||
with open(self.output_file, 'r', encoding='utf-8') as log:
|
||||
output = log.read()
|
||||
|
Loading…
Reference in New Issue
Block a user