diff --git a/tests/bgp/test_bgp_session_flap.py b/tests/bgp/test_bgp_session_flap.py index 73076733f50..83614fe4067 100644 --- a/tests/bgp/test_bgp_session_flap.py +++ b/tests/bgp/test_bgp_session_flap.py @@ -168,12 +168,13 @@ def test_bgp_single_session_flaps(setup): assert stats[index][0] < (stats[0][0] + cpuSpike) assert stats[index][1] < (stats[0][1] + cpuSpike) assert stats[index][2] < (stats[0][2] + cpuSpike) - assert stats[index][3] < (stats[0][3] * memSpike) - assert stats[index][4] < (stats[0][4] * memSpike) - assert stats[index][5] < (stats[0][5] * memSpike) - assert stats[index][6] < (stats[0][6] * memSpike) - assert stats[index][7] < (stats[0][7] * memSpike) - assert stats[index][8] < (stats[0][8] * memSpike) + # Use <= for memory usage comparison because it can be 0 (e.g., No V4 neighbors in V6 topo) + assert stats[index][3] <= (stats[0][3] * memSpike) + assert stats[index][4] <= (stats[0][4] * memSpike) + assert stats[index][5] <= (stats[0][5] * memSpike) + assert stats[index][6] <= (stats[0][6] * memSpike) + assert stats[index][7] <= (stats[0][7] * memSpike) + assert stats[index][8] <= (stats[0][8] * memSpike) time.sleep(wait_time) @@ -215,12 +216,13 @@ def test_bgp_multiple_session_flaps(setup): assert stats[index][0] < (stats[0][0] + cpuSpike) assert stats[index][1] < (stats[0][1] + cpuSpike) assert stats[index][2] < (stats[0][2] + cpuSpike) - assert stats[index][3] < (stats[0][3] * memSpike) - assert stats[index][4] < (stats[0][4] * memSpike) - assert stats[index][5] < (stats[0][5] * memSpike) - assert stats[index][6] < (stats[0][6] * memSpike) - assert stats[index][7] < (stats[0][7] * memSpike) - assert stats[index][8] < (stats[0][8] * memSpike) + # Use <= for memory usage comparison because it can be 0 (e.g., No V4 neighbors in V6 topo) + assert stats[index][3] <= (stats[0][3] * memSpike) + assert stats[index][4] <= (stats[0][4] * memSpike) + assert stats[index][5] <= (stats[0][5] * memSpike) + assert stats[index][6] <= (stats[0][6] * memSpike) + assert stats[index][7] <= (stats[0][7] * memSpike) + assert stats[index][8] <= (stats[0][8] * memSpike) time.sleep(wait_time)