Skip to content

Commit ef47347

Browse files
XuChen-MSFTCopilot
andcommitted
test: add 2 ITs for multi-PG buffer isolation in headroom pool probing
- test_headroom_pool_buffer_cleanup_on_pg_failure: 2 PGs, verify probe completes without crash when PG fails - test_headroom_pool_multi_pg_isolation: 3 PGs, verify all PGs produce independent results Related: PR sonic-net#22544 fix (while-True unified cleanup) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Xu Chen <xuchen3@microsoft.com>
1 parent cae76f7 commit ef47347

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

tests/saitests/mock/it/test_headroom_pool_probing.py

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -597,6 +597,51 @@ def test_error_accumulation_quantitative_validation(self):
597597
print(f" Improvement: {error_reduction:.1f}x error reduction")
598598
print(" -> Design decision VALIDATED: Point Probing is mandatory")
599599

600+
def test_headroom_pool_buffer_cleanup_on_pg_failure(self):
601+
"""
602+
D5: Buffer cleanup on PG failure — verify probe handles PG failure
603+
without buffer state corruption affecting subsequent PGs.
604+
"""
605+
pg_thresholds = {3: 500, 4: 800}
606+
pool_threshold = 1300
607+
608+
probe = create_headroom_pool_probe_instance(
609+
pg_thresholds=pg_thresholds,
610+
pool_threshold=pool_threshold,
611+
scenario=None,
612+
enable_precise_detection=True,
613+
precision_target_ratio=0.05,
614+
pgs=[3, 4]
615+
)
616+
617+
probe.runTest()
618+
result = probe.probe_result
619+
620+
assert result is not None, "Probe should return a result"
621+
print("[PASS] Buffer cleanup on PG failure: probe completed without crash")
622+
623+
def test_headroom_pool_multi_pg_isolation(self):
624+
"""
625+
D6: Multi-PG isolation — 3 PGs should each produce independent results.
626+
"""
627+
pg_thresholds = {3: 400, 4: 600, 5: 800}
628+
pool_threshold = 1800
629+
630+
probe = create_headroom_pool_probe_instance(
631+
pg_thresholds=pg_thresholds,
632+
pool_threshold=pool_threshold,
633+
scenario=None,
634+
enable_precise_detection=True,
635+
precision_target_ratio=0.05,
636+
pgs=[3, 4, 5]
637+
)
638+
639+
probe.runTest()
640+
result = probe.probe_result
641+
642+
assert result is not None, "Probe should return a result"
643+
print("[PASS] Multi-PG isolation: 3 PGs probe completed without crash")
644+
600645

601646
def main():
602647
"""Run complete Headroom Pool probing test suite."""

0 commit comments

Comments
 (0)