From 708e232abb3ed981ce2fb9eb6abba016793f5e4c Mon Sep 17 00:00:00 2001 From: Wenda Ni Date: Mon, 15 Nov 2021 18:49:47 -0800 Subject: [PATCH] Test divide by zero processing path (#2028) *Test divide by zero processing path. Add vs test coverage for #1569 Signed-off-by: Wenda Ni --- tests/test_crm.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/test_crm.py b/tests/test_crm.py index 38b0de7a0c3c..200b15cf79dc 100644 --- a/tests/test_crm.py +++ b/tests/test_crm.py @@ -625,10 +625,26 @@ def test_CrmAcl(self, dvs, testlog): old_table_used_counter = getCrmCounterValue(dvs, 'ACL_STATS:INGRESS:PORT', 'crm_stats_acl_table_used') + value = { + "count": 1, + "list": [ + { + "stage": "SAI_ACL_STAGE_INGRESS", + "bind_point": "SAI_ACL_BIND_POINT_TYPE_PORT", + "avail_num": "4294967295" + } + ] + } + dvs.setReadOnlyAttr('SAI_OBJECT_TYPE_SWITCH', 'SAI_SWITCH_ATTR_AVAILABLE_ACL_TABLE', json.dumps(value)) + time.sleep(2) + + marker = dvs.add_log_marker() # create ACL table ttbl = swsscommon.Table(db, "ACL_TABLE") fvs = swsscommon.FieldValuePairs([("policy_desc", "test"), ("type", "L3"), ("ports", ",".join(bind_ports))]) ttbl.set("test", fvs) + time.sleep(2) + check_syslog(dvs, marker, "ACL_TABLE Exception occurred (div by Zero)", 1) # create ACL rule rtbl = swsscommon.Table(db, "ACL_RULE")