From 4a5b7a77b75912b6c3f626c09d0b8b3f3976460c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20M=C3=A4rdian?= Date: Mon, 10 Jul 2023 16:54:20 +0200 Subject: [PATCH] tests:regressions: simplify assertions to avoid buffering races --- tests/integration/regressions.py | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/tests/integration/regressions.py b/tests/integration/regressions.py index 112c2833f..d4cad5e47 100644 --- a/tests/integration/regressions.py +++ b/tests/integration/regressions.py @@ -94,14 +94,10 @@ def test_try_accept_lp1949095(self): stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) time.sleep(2) p.send_signal(signal.SIGUSR1) - out, err = p.communicate() - p.wait(10) + out, err = p.communicate(timeout=10) self.assertEqual('', err) self.assertNotIn('An error occurred:', out) - self.assertRegex(out.strip(), r'Do you want to keep these settings\?\n\n\n' - r'Press ENTER before the timeout to accept the new configuration\n\n\n' - r'(Changes will revert in \d+ seconds\n)+' - r'Configuration accepted\.') + self.assertIn('Configuration accepted.', out) def test_try_reject_lp1949095(self): with open(self.config, 'w') as f: @@ -113,14 +109,10 @@ def test_try_reject_lp1949095(self): stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) time.sleep(2) p.send_signal(signal.SIGINT) - out, err = p.communicate() - p.wait(10) + out, err = p.communicate(timeout=10) self.assertEqual('', err) self.assertNotIn('An error occurred:', out) - self.assertRegex(out.strip(), r'Do you want to keep these settings\?\n\n\n' - r'Press ENTER before the timeout to accept the new configuration\n\n\n' - r'(Changes will revert in \d+ seconds\n)+' - r'Reverting\.') + self.assertIn('Reverting.', out) def test_apply_networkd_inactive_lp1962095(self): self.setup_eth(None)