Skip to content

Commit 13619aa

Browse files
authored
[QOS] Skip showing unnecessary warning message (sonic-net#3708)
* [QOS] Skip showing unnecessary warning message Signed-off-by: Vivek Reddy <[email protected]>
1 parent f4e6e5b commit 13619aa

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

config/main.py

+3
Original file line numberDiff line numberDiff line change
@@ -778,6 +778,8 @@ def storm_control_delete_entry(port_name, storm_type):
778778

779779

780780
def _wait_until_clear(tables, interval=0.5, timeout=30, verbose=False):
781+
if timeout == 0:
782+
return True
781783
start = time.time()
782784
empty = False
783785
app_db = SonicV2Connector(host='127.0.0.1')
@@ -793,6 +795,7 @@ def _wait_until_clear(tables, interval=0.5, timeout=30, verbose=False):
793795
click.echo("Some entries matching {} still exist: {}".format(table, keys[0]))
794796
time.sleep(interval)
795797
empty = (non_empty_table_count == 0)
798+
796799
if not empty:
797800
click.echo("Operation not completed successfully, please save and reload configuration.")
798801
return empty

tests/config_test.py

+8
Original file line numberDiff line numberDiff line change
@@ -1625,6 +1625,14 @@ def test_qos_wait_until_clear_not_empty(self):
16251625
empty = _wait_until_clear(["BUFFER_POOL_TABLE:*"], 0.5,2)
16261626
assert not empty
16271627

1628+
@patch('click.echo')
1629+
@patch('swsscommon.swsscommon.SonicV2Connector.keys')
1630+
def test_qos_wait_until_clear_no_timeout(self, mock_keys, mock_echo):
1631+
from config.main import _wait_until_clear
1632+
assert _wait_until_clear(["BUFFER_POOL_TABLE:*"], 0.5, 0)
1633+
mock_keys.assert_not_called()
1634+
mock_echo.assert_not_called()
1635+
16281636
@mock.patch('config.main._wait_until_clear')
16291637
def test_qos_clear_no_wait(self, _wait_until_clear):
16301638
from config.main import _clear_qos

0 commit comments

Comments
 (0)