Skip to content

Commit

Permalink
add test for invalid namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
bktsim-arista committed Nov 30, 2023
1 parent 5337d78 commit 4d0ac37
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions tests/multi_asic_watermarkstat_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,25 @@ def setup_class(cls):
os.environ["UTILITIES_UNIT_TESTING_TOPOLOGY"] = "multi_asic"
print("SETUP")

def execute(self, command, expected_result):
def execute(self, command, expected_code=0, expected_result=None):
return_code, result = get_result_and_return_code(command)
print("return_code: {}".format(return_code))
print("result = {}".format(result))
assert return_code == 0
assert result == expected_result
assert return_code == expected_code
if expected_result:
assert result == expected_result

def test_show_pg_shared_masic(self):
self.execute(['watermarkstat', '-t', 'pg_shared', '-n', 'asic1'],
show_pg_wm_shared_output_masic)
expected_result=show_pg_wm_shared_output_masic)

def test_show_headroom_pool_masic(self):
self.execute(['watermarkstat', '-t', 'headroom_pool', '-n', 'asic1'],
show_hdrm_pool_wm_output)
expected_result=show_hdrm_pool_wm_output)

def test_show_invalid_asic_masic(self):
self.execute(['watermarkstat', '-t', 'headroom_pool', '-n', 'asic15'],
expected_code=1)

@classmethod
def teardown_class(cls):
Expand Down

0 comments on commit 4d0ac37

Please sign in to comment.