Skip to content

Commit 9793384

Browse files
committed
Improve code coveraged
1 parent 978900c commit 9793384

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

tests/portstat_test.py

+27
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,15 @@
4242
Ethernet8 N/A 100,317 0 0
4343
"""
4444

45+
intf_fec_counters_period = """\
46+
The rates are calculated within 3 seconds period
47+
IFACE STATE FEC_CORR FEC_UNCORR FEC_SYMBOL_ERR
48+
--------- ------- ---------- ------------ ----------------
49+
Ethernet0 D 0 0 0
50+
Ethernet4 N/A 0 0 0
51+
Ethernet8 N/A 0 0 0
52+
"""
53+
4554
intf_counters_period = """\
4655
The rates are calculated within 3 seconds period
4756
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):
281290
assert return_code == 0
282291
assert result == intf_fec_counters
283292

293+
def test_show_intf_fec_counters_period(self):
294+
runner = CliRunner()
295+
result = runner.invoke(show.cli.commands["interfaces"].commands["counters"].commands["fec-stats"],
296+
["-p {}".format(TEST_PERIOD)])
297+
print(result.exit_code)
298+
print(result.output)
299+
assert result.exit_code == 0
300+
assert result.output == intf_fec_counters_period
301+
302+
return_code, result = get_result_and_return_code(
303+
'portstat -f -p {}'.format(TEST_PERIOD))
304+
print("return_code: {}".format(return_code))
305+
print("result = {}".format(result))
306+
assert return_code == 0
307+
assert result == intf_fec_counters_period
308+
309+
310+
284311
def test_show_intf_counters_period(self):
285312
runner = CliRunner()
286313
result = runner.invoke(show.cli.commands["interfaces"].commands["counters"], [

0 commit comments

Comments
 (0)