Skip to content

Commit 1c6ab1f

Browse files
authored
Merge pull request #81 from DataKitchen/obs-compose
fix: Heartbeat demo should not print the interrupt message when stopped
2 parents 976921b + 0b6e8f8 commit 1c6ab1f

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

dk-installer.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1643,8 +1643,10 @@ class ObsRunHeartbeatDemoAction(DemoContainerAction):
16431643

16441644
def execute(self, args):
16451645
CONSOLE.title("Run Observability Heartbeat demo")
1646-
self.run_dk_demo_container("obs-heartbeat-demo")
1647-
CONSOLE.msg("Observability Heartbeat demo stopped")
1646+
try:
1647+
self.run_dk_demo_container("obs-heartbeat-demo")
1648+
except KeyboardInterrupt:
1649+
CONSOLE.msg("Observability Heartbeat demo stopped")
16481650

16491651

16501652
class UpdateComposeFileStep(Step):

tests/test_obs_demo.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from unittest.mock import call
1+
from unittest.mock import call, patch
22

33
import pytest
44

@@ -44,3 +44,14 @@ def test_obs_demo_action(action_class, arg_action, demo_cmd, args_mock, start_cm
4444
],
4545
any_order=True,
4646
)
47+
48+
49+
@pytest.mark.unit
50+
def test_obs_heartbeat_demo_stop(args_mock, start_cmd_mock, demo_config_path):
51+
action = ObsRunHeartbeatDemoAction()
52+
with patch.object(action, "run_dk_demo_container") as run_demo_cmd_mock:
53+
run_demo_cmd_mock.side_effect = KeyboardInterrupt
54+
55+
action.execute(args_mock)
56+
57+
run_demo_cmd_mock.assert_called_with("obs-heartbeat-demo")

0 commit comments

Comments
 (0)