Skip to content

Commit

Permalink
Fix additional comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Shlomi Bitton committed Jul 13, 2020
1 parent 0fc2d48 commit 04d0672
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
6 changes: 3 additions & 3 deletions show/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -3464,7 +3464,7 @@ def summary():
fault_counter += 1
if fault_counter == 1:
click.echo(category + "\tNot OK")
click.echo('\t' + elements[element]['message'])
click.echo('\t\t' + elements[element]['message'])
if not fault_counter:
click.echo(category + "\tOK")
fault_counter = 0
Expand Down Expand Up @@ -3507,7 +3507,7 @@ def detail():
fault_counter += 1
if fault_counter == 1:
click.echo(category + "\tNot OK")
click.echo('\t' + elements[element]['message'])
click.echo('\t\t' + elements[element]['message'])
if not fault_counter:
click.echo(category + "\tOK")
fault_counter = 0
Expand Down Expand Up @@ -3536,7 +3536,7 @@ def detail():
for element in manager.config.ignore_devices:
entry = []
entry.append(element)
entry.append("Ignore")
entry.append("Ignored")
entry.append("Device")
table.append(entry)
click.echo(tabulate(table, header))
Expand Down
13 changes: 7 additions & 6 deletions sonic-utilities-tests/system_health_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,12 @@ def initizalize_system_led(self):
return

def get_status_led(self):
if not MockerChassis.counter:
if MockerChassis.counter == 1:
MockerChassis.counter += 1
return "red"
else:
return "green"
else:
MockerChassis.counter += 1
return "red"

import show.main as show

Expand All @@ -78,7 +79,7 @@ def test_health_summary(self):
expected = """System is currently booting...\n"""
assert result.output == expected
result = runner.invoke(show.cli.commands["system-health"].commands["summary"])
expected = """System status summary\n---------------------\nSystem status LED red\n\nServices\tNot OK\n\ttelemetry is not Running\n\tsnmp_subagent is not Running\nHardware\tOK\n"""
expected = """System status summary\n---------------------\nSystem status LED red\n\nServices\tNot OK\n\t\ttelemetry is not Running\n\t\tsnmp_subagent is not Running\nHardware\tOK\n"""
click.echo(result.output)
assert result.output == expected
result = runner.invoke(show.cli.commands["system-health"].commands["summary"])
Expand All @@ -97,12 +98,12 @@ def test_health_detail(self):
runner = CliRunner()
result = runner.invoke(show.cli.commands["system-health"].commands["detail"])
click.echo(result.output)
expected = """System status summary\n---------------------\nSystem status LED green\n\nServices\tNot OK\n\ttelemetry is not Running\n\tsflowmgrd is not Running\nHardware\tNot OK\n\tFailed to get voltage minimum threshold data for PSU 2\n\tFailed to get voltage minimum threshold data for PSU 1\n\nSystem services and devices monitor list\n----------------------------------------\n\nName Status Type\n-------------- -------- ----------\ntelemetry Not OK Process\nsflowmgrd Not OK Process\nneighsyncd OK Process\nvrfmgrd OK Process\ndialout_client OK Process\nzebra OK Process\nrsyslog OK Process\nsnmpd OK Process\nredis_server OK Process\nintfmgrd OK Process\norchagent OK Process\nvxlanmgrd OK Process\nlldpd_monitor OK Process\nportsyncd OK Process\nvar-log OK Filesystem\nlldpmgrd OK Process\nsyncd OK Process\nsonic OK System\nbuffermgrd OK Process\nportmgrd OK Process\nstaticd OK Process\nvlanmgrd OK Process\nlldp_syncd OK Process\nbgpcfgd OK Process\nsnmp_subagent OK Process\nroot-overlay OK Filesystem\nfpmsyncd OK Process\nbgpd OK Process\nnbrmgrd OK Process\nPSU 2 Not OK PSU\nPSU 1 Not OK PSU\nfan12 OK Fan\npsu_1_fan_1 OK Fan\npsu_2_fan_1 OK Fan\nfan11 OK Fan\nfan10 OK Fan\nASIC OK ASIC\nfan1 OK Fan\nfan3 OK Fan\nfan2 OK Fan\nfan5 OK Fan\nfan4 OK Fan\nfan7 OK Fan\nfan6 OK Fan\nfan9 OK Fan\nfan8 OK Fan\n\nSystem services and devices ignore list\n---------------------------------------\n\nName Status Type\n------ -------- ------\n"""
expected = """System status summary\n---------------------\nSystem status LED red\n\nServices\tNot OK\n\t\ttelemetry is not Running\n\t\tsflowmgrd is not Running\nHardware\tNot OK\n\t\tFailed to get voltage minimum threshold data for PSU 2\n\t\tFailed to get voltage minimum threshold data for PSU 1\n\nSystem services and devices monitor list\n----------------------------------------\n\nName Status Type\n-------------- -------- ----------\ntelemetry Not OK Process\nsflowmgrd Not OK Process\nneighsyncd OK Process\nvrfmgrd OK Process\ndialout_client OK Process\nzebra OK Process\nrsyslog OK Process\nsnmpd OK Process\nredis_server OK Process\nintfmgrd OK Process\norchagent OK Process\nvxlanmgrd OK Process\nlldpd_monitor OK Process\nportsyncd OK Process\nvar-log OK Filesystem\nlldpmgrd OK Process\nsyncd OK Process\nsonic OK System\nbuffermgrd OK Process\nportmgrd OK Process\nstaticd OK Process\nvlanmgrd OK Process\nlldp_syncd OK Process\nbgpcfgd OK Process\nsnmp_subagent OK Process\nroot-overlay OK Filesystem\nfpmsyncd OK Process\nbgpd OK Process\nnbrmgrd OK Process\nPSU 2 Not OK PSU\nPSU 1 Not OK PSU\nfan12 OK Fan\npsu_1_fan_1 OK Fan\npsu_2_fan_1 OK Fan\nfan11 OK Fan\nfan10 OK Fan\nASIC OK ASIC\nfan1 OK Fan\nfan3 OK Fan\nfan2 OK Fan\nfan5 OK Fan\nfan4 OK Fan\nfan7 OK Fan\nfan6 OK Fan\nfan9 OK Fan\nfan8 OK Fan\n\nSystem services and devices ignore list\n---------------------------------------\n\nName Status Type\n------ -------- ------\n"""
assert result.output == expected
MockerConfig.ignore_devices.insert(0, "psu.voltage")
result = runner.invoke(show.cli.commands["system-health"].commands["detail"])
click.echo(result.output)
expected = """System status summary\n---------------------\nSystem status LED green\n\nServices\tNot OK\n\ttelemetry is not Running\n\tsflowmgrd is not Running\nHardware\tOK\n\nSystem services and devices monitor list\n----------------------------------------\n\nName Status Type\n-------------- -------- ----------\ntelemetry Not OK Process\nsflowmgrd Not OK Process\nneighsyncd OK Process\nvrfmgrd OK Process\ndialout_client OK Process\nzebra OK Process\nrsyslog OK Process\nsnmpd OK Process\nredis_server OK Process\nintfmgrd OK Process\norchagent OK Process\nvxlanmgrd OK Process\nlldpd_monitor OK Process\nportsyncd OK Process\nvar-log OK Filesystem\nlldpmgrd OK Process\nsyncd OK Process\nsonic OK System\nbuffermgrd OK Process\nportmgrd OK Process\nstaticd OK Process\nvlanmgrd OK Process\nlldp_syncd OK Process\nbgpcfgd OK Process\nsnmp_subagent OK Process\nroot-overlay OK Filesystem\nfpmsyncd OK Process\nbgpd OK Process\nnbrmgrd OK Process\nfan12 OK Fan\npsu_1_fan_1 OK Fan\npsu_2_fan_1 OK Fan\nfan11 OK Fan\nfan10 OK Fan\nPSU 2 OK PSU\nASIC OK ASIC\nfan1 OK Fan\nPSU 1 OK PSU\nfan3 OK Fan\nfan2 OK Fan\nfan5 OK Fan\nfan4 OK Fan\nfan7 OK Fan\nfan6 OK Fan\nfan9 OK Fan\nfan8 OK Fan\n\nSystem services and devices ignore list\n---------------------------------------\n\nName Status Type\n----------- -------- ------\npsu.voltage Ignore Device\n"""
expected = """System status summary\n---------------------\nSystem status LED red\n\nServices\tNot OK\n\t\ttelemetry is not Running\n\t\tsflowmgrd is not Running\nHardware\tOK\n\nSystem services and devices monitor list\n----------------------------------------\n\nName Status Type\n-------------- -------- ----------\ntelemetry Not OK Process\nsflowmgrd Not OK Process\nneighsyncd OK Process\nvrfmgrd OK Process\ndialout_client OK Process\nzebra OK Process\nrsyslog OK Process\nsnmpd OK Process\nredis_server OK Process\nintfmgrd OK Process\norchagent OK Process\nvxlanmgrd OK Process\nlldpd_monitor OK Process\nportsyncd OK Process\nvar-log OK Filesystem\nlldpmgrd OK Process\nsyncd OK Process\nsonic OK System\nbuffermgrd OK Process\nportmgrd OK Process\nstaticd OK Process\nvlanmgrd OK Process\nlldp_syncd OK Process\nbgpcfgd OK Process\nsnmp_subagent OK Process\nroot-overlay OK Filesystem\nfpmsyncd OK Process\nbgpd OK Process\nnbrmgrd OK Process\nfan12 OK Fan\npsu_1_fan_1 OK Fan\npsu_2_fan_1 OK Fan\nfan11 OK Fan\nfan10 OK Fan\nPSU 2 OK PSU\nASIC OK ASIC\nfan1 OK Fan\nPSU 1 OK PSU\nfan3 OK Fan\nfan2 OK Fan\nfan5 OK Fan\nfan4 OK Fan\nfan7 OK Fan\nfan6 OK Fan\nfan9 OK Fan\nfan8 OK Fan\n\nSystem services and devices ignore list\n---------------------------------------\n\nName Status Type\n----------- -------- ------\npsu.voltage Ignored Device\n"""
assert result.output == expected

@classmethod
Expand Down

0 comments on commit 04d0672

Please sign in to comment.