Skip to content

Commit a733df5

Browse files
authored
[watermarkstat] Add unit tests for watermarkstat show commands (sonic-net#1157)
* Add watermark testcases and mock counters Signed-off-by: Neetha John <[email protected]>
1 parent 059cdca commit a733df5

File tree

6 files changed

+942
-15
lines changed

6 files changed

+942
-15
lines changed

scripts/watermarkstat

100644100755
+13-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/python
22

33
#####################################################################
44
#
@@ -10,12 +10,24 @@ from __future__ import print_function
1010

1111
import argparse
1212
import json
13+
import os
1314
import sys
1415

1516
import swsssdk
1617
from natsort import natsorted
1718
from tabulate import tabulate
1819

20+
# mock the redis for unit test purposes #
21+
try:
22+
if os.environ["UTILITIES_UNIT_TESTING"] == "2":
23+
modules_path = os.path.join(os.path.dirname(__file__), "..")
24+
tests_path = os.path.join(modules_path, "tests")
25+
sys.path.insert(0, modules_path)
26+
sys.path.insert(0, tests_path)
27+
import mock_tables.dbconnector
28+
29+
except KeyError:
30+
pass
1931

2032
headerBufferPool = ['Pool', 'Bytes']
2133

setup.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@
5858
'mock_tables/asic0/*.json',
5959
'mock_tables/asic1/*.json',
6060
'filter_fdb_input/*',
61-
'pfcwd_input/*']
61+
'pfcwd_input/*',
62+
'wm_input/*']
6263
},
6364
scripts=[
6465
'scripts/aclshow',

0 commit comments

Comments
 (0)