diff --git a/test/test-network/systemd-networkd-tests.py b/test/test-network/systemd-networkd-tests.py index 1fd1b2290f..000645c916 100755 --- a/test/test-network/systemd-networkd-tests.py +++ b/test/test-network/systemd-networkd-tests.py @@ -929,17 +929,25 @@ def read_networkd_log(invocation_id=None, since=None): def networkd_is_failed(): return call_quiet('systemctl is-failed -q systemd-networkd.service') != 1 -def stop_networkd(show_logs=True): +def stop_networkd(show_logs=True, check_failed=True): global show_journal show_logs = show_logs and show_journal if show_logs: invocation_id = networkd_invocation_id() - check_output('systemctl stop systemd-networkd.socket') - check_output('systemctl stop systemd-networkd.service') + + if check_failed: + check_output('systemctl stop systemd-networkd.socket') + check_output('systemctl stop systemd-networkd.service') + else: + call('systemctl stop systemd-networkd.socket') + call('systemctl stop systemd-networkd.service') + if show_logs: print(read_networkd_log(invocation_id)) + # Check if networkd exits cleanly. - assert not networkd_is_failed() + if check_failed: + assert not networkd_is_failed() def start_networkd(): check_output('systemctl start systemd-networkd') @@ -1024,7 +1032,7 @@ def tear_down_common(): flush_links() # 5. stop networkd - stop_networkd() + stop_networkd(check_failed=False) # 6. remove configs clear_network_units() @@ -1041,6 +1049,9 @@ def tear_down_common(): sys.stdout.flush() check_output('journalctl --sync') + # 9. check the status of networkd + assert not networkd_is_failed() + def setUpModule(): rm_rf(networkd_ci_temp_dir) cp_r(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'conf'), networkd_ci_temp_dir)