From 9793384f26bd4082c3c4041d91659dd1a5c0bb6c Mon Sep 17 00:00:00 2001 From: Prince George Date: Thu, 4 Aug 2022 00:49:31 +0000 Subject: [PATCH] Improve code coveraged --- tests/portstat_test.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/tests/portstat_test.py b/tests/portstat_test.py index 1a54666174..2a70d0befc 100644 --- a/tests/portstat_test.py +++ b/tests/portstat_test.py @@ -42,6 +42,15 @@ Ethernet8 N/A 100,317 0 0 """ +intf_fec_counters_period = """\ +The rates are calculated within 3 seconds period + IFACE STATE FEC_CORR FEC_UNCORR FEC_SYMBOL_ERR +--------- ------- ---------- ------------ ---------------- +Ethernet0 D 0 0 0 +Ethernet4 N/A 0 0 0 +Ethernet8 N/A 0 0 0 +""" + intf_counters_period = """\ The rates are calculated within 3 seconds period IFACE STATE RX_OK RX_BPS RX_UTIL RX_ERR RX_DRP RX_OVR TX_OK TX_BPS TX_UTIL TX_ERR TX_DRP TX_OVR @@ -281,6 +290,24 @@ def test_show_intf_fec_counters(self): assert return_code == 0 assert result == intf_fec_counters + def test_show_intf_fec_counters_period(self): + runner = CliRunner() + result = runner.invoke(show.cli.commands["interfaces"].commands["counters"].commands["fec-stats"], + ["-p {}".format(TEST_PERIOD)]) + print(result.exit_code) + print(result.output) + assert result.exit_code == 0 + assert result.output == intf_fec_counters_period + + return_code, result = get_result_and_return_code( + 'portstat -f -p {}'.format(TEST_PERIOD)) + print("return_code: {}".format(return_code)) + print("result = {}".format(result)) + assert return_code == 0 + assert result == intf_fec_counters_period + + + def test_show_intf_counters_period(self): runner = CliRunner() result = runner.invoke(show.cli.commands["interfaces"].commands["counters"], [