Skip to content

Commit

Permalink
Fix unit test errors
Browse files Browse the repository at this point in the history
  • Loading branch information
judyjoseph committed Nov 8, 2020
1 parent b0d190e commit 98000a4
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 5 deletions.
9 changes: 5 additions & 4 deletions tests/crm_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,10 +349,10 @@
Table ID Resource Name Used Count Available Count
--------------- --------------- ------------ -----------------
0x700000000063f acl_entry 0 2048
0x700000000063f acl_counter 0 2048
0x7000000000670 acl_entry 0 1024
0x7000000000670 acl_counter 0 1280
0x700000000063f acl_entry 0 2048
0x700000000063f acl_counter 0 2048
"""

Expand Down Expand Up @@ -454,10 +454,10 @@
Table ID Resource Name Used Count Available Count
--------------- --------------- ------------ -----------------
0x700000000063f acl_entry 0 2048
0x700000000063f acl_counter 0 2048
0x7000000000670 acl_entry 0 1024
0x7000000000670 acl_counter 0 1280
0x700000000063f acl_entry 0 2048
0x700000000063f acl_counter 0 2048
"""

Expand Down Expand Up @@ -900,3 +900,4 @@ def teardown_class(cls):
os.environ["PATH"] = os.pathsep.join(os.environ["PATH"].split(os.pathsep)[:-1])
os.environ["UTILITIES_UNIT_TESTING"] = "0"
os.environ["UTILITIES_UNIT_TESTING_TOPOLOGY"] = ""
import mock_tables.mock_single_asic
6 changes: 6 additions & 0 deletions tests/mock_tables/asic1/counters_db.json
Original file line number Diff line number Diff line change
Expand Up @@ -870,6 +870,12 @@
"COUNTERS_DEBUG_NAME_SWITCH_STAT_MAP": {
"DEBUG_1": "SAI_SWITCH_STAT_IN_DROP_REASON_RANGE_BASE"
},
"CRM:ACL_STATS:INGRESS:VLAN":{
"crm_stats_acl_table_used":"0",
"crm_stats_acl_group_available":"232",
"crm_stats_acl_table_available":"6",
"crm_stats_acl_group_used":"0"
},
"CRM:STATS":{
"crm_stats_ipv4_neighbor_used":"8",
"crm_stats_ipv4_route_available":"98246",
Expand Down
8 changes: 7 additions & 1 deletion tests/mock_tables/counters_db.json
Original file line number Diff line number Diff line change
Expand Up @@ -1000,7 +1000,13 @@
},
"PERSISTENT_WATERMARKS:oid:0x18000000000b66": {
"SAI_BUFFER_POOL_STAT_WATERMARK_BYTES": "4000"
},
},
"CRM:ACL_STATS:INGRESS:VLAN":{
"crm_stats_acl_table_used":"0",
"crm_stats_acl_group_available":"232",
"crm_stats_acl_table_available":"6",
"crm_stats_acl_group_used":"0"
},
"CRM:STATS":{
"crm_stats_ipv4_neighbor_used":"8",
"crm_stats_ipv4_route_available":"98246",
Expand Down
16 changes: 16 additions & 0 deletions tests/mock_tables/mock_single_asic.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# MONKEY PATCH!!!
import mock
from sonic_py_common import multi_asic

def mock_get_num_asics():
return 1

def mock_is_multi_asic():
return False

def mock_get_namespace_list(namespace=None):
return ['']

multi_asic.is_multi_asic = mock_is_multi_asic
multi_asic.get_num_asics = mock_get_num_asics
multi_asic.get_namespace_list = mock_get_namespace_list

0 comments on commit 98000a4

Please sign in to comment.