Skip to content
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
12 changes: 12 additions & 0 deletions devservices/commands/toggle.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,18 @@ def handle_transition_to_local_runtime(service_to_transition: Service) -> None:
service_to_transition,
[service_to_transition_dependency_config.remote.mode],
)
console.warning(f"Restarting {service_to_transition.name} in default mode")
# This behavior matches the default behavior of up as it
# will bring up dependencies with local runtimes automatically
# in the default mode. If the user wants to run it in a different
# mode, they can switch to that mode manually.
up(
Namespace(
service_name=service_to_transition.name,
mode="default",
exclude_local=False,
)
)
break
state.update_service_runtime(service_to_transition.name, ServiceRuntime.LOCAL)

Expand Down
10 changes: 10 additions & 0 deletions tests/commands/test_toggle.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,9 +218,11 @@ def test_toggle_nothing_running_same_runtime(
)


@mock.patch("devservices.commands.toggle.up")
@mock.patch("devservices.commands.down._bring_down_dependency")
def test_toggle_dependent_service_running(
mock_bring_down_dependency: mock.Mock,
mock_up: mock.Mock,
tmp_path: Path,
) -> None:
with (
Expand Down Expand Up @@ -384,6 +386,14 @@ def test_toggle_dependent_service_running(
mock.ANY,
)

mock_up.assert_called_once_with(
Namespace(
service_name="example-service",
mode="default",
exclude_local=False,
)
)


@mock.patch("devservices.commands.toggle.find_matching_service")
@mock.patch("devservices.commands.toggle.handle_transition_to_local_runtime")
Expand Down
Loading