Skip to content

Commit

Permalink
[202012] [pfcwd] Fix the return code in invalid case (#1698)
Browse files Browse the repository at this point in the history
Backport #1691
- What I did
Set the correct return code when pfcwd command is specified with invalid options

Signed-off-by: Neetha John <nejo@microsoft.com>
  • Loading branch information
neethajohn authored Jun 30, 2021
1 parent 80b7b54 commit d83eccd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pfcwd/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,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
4 changes: 2 additions & 2 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

0 comments on commit d83eccd

Please sign in to comment.