test-network: flush stream buffer and journals before/after running test

This commit is contained in:
Yu Watanabe
2024-06-03 18:41:26 +01:00
committed by Luca Boccassi
parent 22fa8f6724
commit 6fec598290
@@ -923,7 +923,11 @@ def udevadm_trigger(*args, action='add'):
udevadm('trigger', '--settle', f'--action={action}', *args)
def setup_common():
# We usually show something in each test. So, let's break line to make the title of a test and output
# from the test mixed. Then, flush stream buffer and journals.
print()
sys.stdout.flush()
check_output('journalctl --sync')
def tear_down_common():
# 1. stop DHCP/RA servers
@@ -956,6 +960,10 @@ def tear_down_common():
flush_routing_policy_rules()
flush_routes()
# 8. flush stream buffer and journals to make not any output from the test with the next one
sys.stdout.flush()
check_output('journalctl --sync')
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)
@@ -989,6 +997,10 @@ def tearDownModule():
clear_system_units()
restore_active_units()
# Flush stream buffer and journals before showing the test summary.
sys.stdout.flush()
check_output('journalctl --sync')
class Utilities():
# pylint: disable=no-member