diff --git a/tests/dualtor_io/conftest.py b/tests/dualtor_io/conftest.py index 4504a3a7287..5077540912d 100644 --- a/tests/dualtor_io/conftest.py +++ b/tests/dualtor_io/conftest.py @@ -35,10 +35,17 @@ def pytest_generate_tests(metafunc): def setup_loganalyzer(loganalyzer): """Fixture to allow customize loganalyzer behaviors.""" - def _setup_loganalyzer(duthost, collect_only): + KERNEL_BOOTUP_SYSLOG = "kernel: [ 0.000000] Linux version" + + def _setup_loganalyzer(duthost, collect_only=False, collect_from_bootup=False): if collect_only: loganalyzer[duthost.hostname].match_regex = [] loganalyzer[duthost.hostname].expect_regex = [] loganalyzer[duthost.hostname].ignore_regex = [] + if collect_from_bootup: + loganalyzer[duthost.hostname].start_marker = KERNEL_BOOTUP_SYSLOG + loganalyzer[duthost.hostname].ansible_loganalyzer.start_marker = \ + KERNEL_BOOTUP_SYSLOG + return _setup_loganalyzer diff --git a/tests/dualtor_io/test_tor_failure.py b/tests/dualtor_io/test_tor_failure.py index 07adf8e5164..8f9e14850bf 100644 --- a/tests/dualtor_io/test_tor_failure.py +++ b/tests/dualtor_io/test_tor_failure.py @@ -66,7 +66,7 @@ def test_active_tor_reboot_upstream( Send upstream traffic and reboot the active ToR. Confirm switchover occurred and disruption lasts < 1 second """ - setup_loganalyzer(upper_tor_host, collect_only=True) + setup_loganalyzer(upper_tor_host, collect_only=True, collect_from_bootup=True) send_server_to_t1_with_action( upper_tor_host, verify=True, delay=MUX_SIM_ALLOWED_DISRUPTION_SEC, action=toggle_upper_tor_pdu, stop_after=60 @@ -99,7 +99,7 @@ def test_active_tor_reboot_downstream_standby( Send downstream traffic to the standby ToR and reboot the active ToR. Confirm switchover occurred and disruption lasts < 1 second """ - setup_loganalyzer(upper_tor_host, collect_only=True) + setup_loganalyzer(upper_tor_host, collect_only=True, collect_from_bootup=True) send_t1_to_server_with_action( lower_tor_host, verify=True, delay=MUX_SIM_ALLOWED_DISRUPTION_SEC, action=toggle_upper_tor_pdu, stop_after=60 @@ -123,7 +123,7 @@ def test_standby_tor_reboot_upstream( Send upstream traffic and reboot the standby ToR. Confirm no switchover occurred and no disruption """ - setup_loganalyzer(lower_tor_host, collect_only=True) + setup_loganalyzer(lower_tor_host, collect_only=True, collect_from_bootup=True) send_server_to_t1_with_action( upper_tor_host, verify=True, action=toggle_lower_tor_pdu, stop_after=60 @@ -147,7 +147,7 @@ def test_standby_tor_reboot_downstream_active( Send downstream traffic to the active ToR and reboot the standby ToR. Confirm no switchover occurred and no disruption """ - setup_loganalyzer(lower_tor_host, collect_only=True) + setup_loganalyzer(lower_tor_host, collect_only=True, collect_from_bootup=True) send_t1_to_server_with_action( upper_tor_host, verify=True, action=toggle_lower_tor_pdu, stop_after=60