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
6 changes: 4 additions & 2 deletions dk-installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -1643,8 +1643,10 @@ class ObsRunHeartbeatDemoAction(DemoContainerAction):

def execute(self, args):
CONSOLE.title("Run Observability Heartbeat demo")
self.run_dk_demo_container("obs-heartbeat-demo")
CONSOLE.msg("Observability Heartbeat demo stopped")
try:
self.run_dk_demo_container("obs-heartbeat-demo")
except KeyboardInterrupt:
CONSOLE.msg("Observability Heartbeat demo stopped")


class UpdateComposeFileStep(Step):
Expand Down
13 changes: 12 additions & 1 deletion tests/test_obs_demo.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from unittest.mock import call
from unittest.mock import call, patch

import pytest

Expand Down Expand Up @@ -44,3 +44,14 @@ def test_obs_demo_action(action_class, arg_action, demo_cmd, args_mock, start_cm
],
any_order=True,
)


@pytest.mark.unit
def test_obs_heartbeat_demo_stop(args_mock, start_cmd_mock, demo_config_path):
action = ObsRunHeartbeatDemoAction()
with patch.object(action, "run_dk_demo_container") as run_demo_cmd_mock:
run_demo_cmd_mock.side_effect = KeyboardInterrupt

action.execute(args_mock)

run_demo_cmd_mock.assert_called_with("obs-heartbeat-demo")