Skip to content

Commit

Permalink
Refs #22518: Review - Use stop to shutdown server
Browse files Browse the repository at this point in the history
Signed-off-by: cferreiragonz <[email protected]>
  • Loading branch information
cferreiragonz committed Jan 10, 2025
1 parent fa0eed3 commit 6465cd4
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
8 changes: 4 additions & 4 deletions test/system/tools/fastdds/test_discovery_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def test_parser_shutdown_when_on(self, mock_rpc_stopall, mock_rpc_nbrequest, moc
mock_shutdown.return_value = True
mock_is_running.return_value = True

argv = ['shutdown']
argv = ['stop']
parser = Parser(argv)

mock_is_running.assert_called_once()
Expand All @@ -88,7 +88,7 @@ def test_parser_shutdown_when_off(self, mock_rpc_stopall, mock_rpc_nbrequest, mo
mock_shutdown.return_value = False
mock_is_running.return_value = False

argv = ['shutdown']
argv = ['stop']
try:
parser = Parser(argv)
except SystemExit as e:
Expand Down Expand Up @@ -299,7 +299,7 @@ def test_parser_stop_when_off(self, mock_rpc_stop_once, mock_rpc_nbrequest, mock
self.check_command = [str(command_to_int[Command.STOP]), '-d', '0']
mock_rpc_brequest.side_effect = self.side_effect_rpc

argv = ['stop']
argv = ['stop', '-d', '0']
try:
parser = Parser(argv)
except SystemExit as e:
Expand Down Expand Up @@ -329,7 +329,7 @@ def test_parser_stop_when_on(self, mock_rpc_stop_once, mock_rpc_nbrequest, mock_
self.check_command = [str(command_to_int[Command.STOP]), '-d', '0']
mock_rpc_brequest.side_effect = self.side_effect_rpc

argv = ['stop']
argv = ['stop', '-d', '0']
parser = Parser(argv)

mock_is_running.assert_called_once()
Expand Down
2 changes: 0 additions & 2 deletions test/system/tools/fds/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ class Command_test(Enum):
SET = "set"
LIST = "list"
INFO = "info"
SHUTDOWN = "shutdown"
UNKNOWN = "unknown"

# This map is used to convert the string command to an integer used in the cpp tool
Expand All @@ -75,7 +74,6 @@ class Command_test(Enum):
Command_test.SET: 4,
Command_test.LIST: 5,
Command_test.INFO: 6,
Command_test.SHUTDOWN: 7,
Command_test.SERVER: 42
}

Expand Down
5 changes: 2 additions & 3 deletions tools/fastdds/discovery/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ class Command(Enum):
SET = "set"
LIST = "list"
INFO = "info"
SHUTDOWN = "shutdown"
UNKNOWN = "unknown"

# This map is used to convert the string command to an integer used in the cpp tool
Expand All @@ -62,7 +61,6 @@ class Command(Enum):
Command.SET: 4,
Command.LIST: 5,
Command.INFO: 6,
Command.SHUTDOWN: 7,
Command.SERVER: 42
}

Expand Down Expand Up @@ -177,7 +175,8 @@ def __init__(self, argv):
for unknown_arg in unknown_args:
args_for_cpp.append(unknown_arg)

if command_int == command_to_int[Command.SHUTDOWN]:
# Use the 'stop' command without domain to stop all servers and shutdown the daemon
if command_int == command_to_int[Command.STOP] and daemon_args.domain is None:
if not self.__is_daemon_running():
print('The Fast DDS daemon is not running.')
raise SystemExit(0)
Expand Down

0 comments on commit 6465cd4

Please sign in to comment.