Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pfcwd] Fix the return code in invalid case #1691

Merged
merged 2 commits into from
Jun 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pfcwd/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ def start(self, action, restoration_time, ports, detection_time):
click.echo("Failed to run command, invalid options:")
for opt in invalid_ports:
click.echo(opt)
exit()
exit(1)
self.start_cmd(action, restoration_time, ports, detection_time)


Expand Down
6 changes: 3 additions & 3 deletions tests/pfcwd_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ def test_pfcwd_start_ports_invalid(self):
obj=db
)
print(result.output)
assert result.exit_code == 0
assert result.exit_code == 1
assert result.output == pfcwd_show_start_config_output_fail

@classmethod
Expand Down Expand Up @@ -447,7 +447,7 @@ def test_pfcwd_start_ports_masic_invalid(self):
obj=db
)
print(result.output)
assert result.exit_code == 0
assert result.exit_code == 1
assert result.output == show_pfc_config_start_fail

# get config after the command, config shouldn't change
Expand Down Expand Up @@ -500,4 +500,4 @@ def teardown_class(cls):
import mock_tables.mock_single_asic
importlib.reload(mock_tables.mock_single_asic)
import pfcwd.main
importlib.reload(pfcwd.main)
importlib.reload(pfcwd.main)