test: fix syslog assertions in test_prefix_list_suppress for multi-ASIC#25204
Merged
yxieca merged 1 commit intoJun 12, 2026
Merged
Conversation
Collaborator
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
cbe0357 to
3167e3c
Compare
Collaborator
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates tests/bgp/test_prefix_list_suppress.py to make syslog-based assertions reliable on multi-ASIC chassis platforms by switching from journalctl --since log collection to a marker-based window over /var/log/syslog.
Changes:
- Added syslog marker placement and “collect since marker” helpers to scope log assertions to a known point in time.
- Reworked
test_prefix_list_mgr_running_on_every_deviceto restartbgpcfgdper BGP container and assert logs per restart window. - Updated the SUPPRESS_PREFIX direct CONFIG_DB path test to use the same marker-based syslog windowing.
shixizhang
previously approved these changes
Jun 9, 2026
Replace journalctl-based collect_recent_syslog() with syslog marker-based collect_syslog_since_marker(). On multi-ASIC chassis (T2/VoQ), container daemons log via rsyslog to /var/log/syslog, not systemd journal. The old journalctl approach always returned empty on these platforms, causing assertions to silently pass (negative check) or fail (positive check). Changes: - Add place_syslog_marker() helper using logger + uuid - Add collect_syslog_since_marker() using sed from marker in /var/log/syslog - Restructure test_prefix_list_mgr_running_on_every_device into per-container loop: marker → restart → wait → assert for each container individually - Remove BGPCFGD_LOG_WINDOW_SECONDS constant (no longer needed) - Remove unused restart_bgpcfgd_only() helper - Fix second caller (SUPPRESS_PREFIX direct DB path) to use marker approach Fixes: ADO #38303118 Signed-off-by: Deepak Singhal <deepsinghal@microsoft.com>
3167e3c to
ff285a3
Compare
Collaborator
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
shixizhang
approved these changes
Jun 9, 2026
shixizhang
approved these changes
Jun 9, 2026
Contributor
Author
|
Hi @yxieca, could you help merge this PR? this fix is for Nightly test failure, and also need this change in 202605 branch as well. Thanks, |
sdeotarse-msft
pushed a commit
to SoumyaMishra18/sonic-mgmt
that referenced
this pull request
Jun 12, 2026
…IC (sonic-net#25204) What: Replaces journalctl-based collect_recent_syslog() with a syslog marker-based collect_syslog_since_marker() in tests/bgp/test_prefix_list_suppress.py, restructures test_prefix_list_mgr_running_on_every_device into a per-container marker→restart→wait→assert loop, and removes the unused BGPCFGD_LOG_WINDOW_SECONDS constant and restart_bgpcfgd_only() helper. Why: On multi-ASIC chassis (T2/VoQ), container daemons log via rsyslog to /var/log/syslog, not the systemd journal, so journalctl --since always returned empty — negative assertions silently passed and positive assertions failed, causing nightly failures on T2 UpstreamLC linecards. Fixes ADO #38303118. How: Injects a UUID-tagged marker via logger -t SONIC_TEST and scopes assertions with sed -n "/<marker>/,\$p" /var/log/syslog | grep <pattern>, which works on all SONiC platforms since rsyslog is the universal log sink. Testing: T0 KVM VS (ToRRouter single-ASIC) PASSED; T0 KVM VS (SpineRouter/UpstreamLC via CONFIG_DB) PASSED; test_suppress_prefix_on_non_spine_device PASSED. All CI green. Signed-off-by: Deepak Singhal <deepsinghal@microsoft.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of PR
Replace
journalctl-basedcollect_recent_syslog()with syslog marker-basedcollect_syslog_since_marker()intests/bgp/test_prefix_list_suppress.py.On multi-ASIC chassis (T2/VoQ), container daemons log via rsyslog to
/var/log/syslog, not the systemd journal. The oldjournalctl --sinceapproach always returned empty on these platforms, causing negative assertions to silently pass and positive assertions to fail.Summary:
Fixes ADO #38303118
The test was introduced in PR #24840 and fails on T2 multi-ASIC UpstreamLC linecards where
journalctldoes not capture container daemon logs (bgpcfgd logs are forwarded via rsyslog instead of systemd journal).Type of change
Back port request
Approach
What is the motivation for this PR?
Nightly test
test_prefix_list_mgr_running_on_every_device(from PR #24840) was failing on T2 multi-ASIC chassis UpstreamLC linecards. The root cause is thatjournalctl --since="N sec ago"returns nothing for container daemons that log via rsyslog (not systemd journal) on multi-ASIC platforms. This made the syslog-based assertions unreliable — negative checks silently pass (empty grep = no match) and positive checks always fail.How did you do it?
place_syslog_marker()— injects a UUID-tagged marker vialogger -t SONIC_TESTcollect_syslog_since_marker()— usessed -n "/<marker>/,\$p" /var/log/syslog | grep <pattern>test_prefix_list_mgr_running_on_every_deviceinto a per-container loop (marker → restart → wait → assert) instead of batch restart + batch checkBGPCFGD_LOG_WINDOW_SECONDSconstant and unusedrestart_bgpcfgd_only()helperThe
/var/log/syslogapproach works on all SONiC platforms (single-ASIC, multi-ASIC chassis, VS) since rsyslog is the universal log sink.How did you verify/test it?
test_suppress_prefix_on_non_spine_device(SUPPRESS_PREFIX direct DB path)All three test functions exercising the marker-based syslog logic pass on latest master nightly VS image.
Any platform specific information?
None — the fix is platform-independent. Works on any SONiC device with rsyslog (all platforms).
Supported testbed topology if it's a new test case?
Not a new test case. Existing test supports topologies: t0, t1, t2.
Documentation
N/A — no new features or test cases added.