diff --git a/docker_overlay/etc/neon/neon.yaml b/docker_overlay/etc/neon/neon.yaml index 146181190..0a4e62b78 100644 --- a/docker_overlay/etc/neon/neon.yaml +++ b/docker_overlay/etc/neon/neon.yaml @@ -41,4 +41,7 @@ play_wav_cmdline: "play %1" play_mp3_cmdline: "play %1" play_ogg_cmdline: "play %1" ready_settings: - - skills \ No newline at end of file + - skills +signal: + use_signal_files: false + patch_imports: false \ No newline at end of file diff --git a/neon_core/configuration/mark_2/neon.yaml b/neon_core/configuration/mark_2/neon.yaml index 500482db9..bf816abdf 100644 --- a/neon_core/configuration/mark_2/neon.yaml +++ b/neon_core/configuration/mark_2/neon.yaml @@ -81,6 +81,7 @@ gui: homescreen_supported: true signal: use_signal_files: false + patch_imports: false skills: common_query: extension_time: 5 diff --git a/neon_core/configuration/neon.yaml b/neon_core/configuration/neon.yaml index ca9e00d61..5c1b3e7c9 100644 --- a/neon_core/configuration/neon.yaml +++ b/neon_core/configuration/neon.yaml @@ -231,7 +231,7 @@ MQ: hana: url: "https://hana.neonaiservices.com" signal: - use_signal_files: true + use_signal_files: false max_wait_seconds: 300 # Logging Config diff --git a/neon_core/util/diagnostic_utils.py b/neon_core/util/diagnostic_utils.py index 0c6eb9d21..3b6421de4 100644 --- a/neon_core/util/diagnostic_utils.py +++ b/neon_core/util/diagnostic_utils.py @@ -33,10 +33,11 @@ from os.path import join, isfile, basename, splitext from json_database import xdg_data_home, xdg_config_home -from neon_utils import LOG -from neon_utils.metrics_utils import report_metric +from ovos_utils.log import LOG from neon_utils.configuration_utils import NGIConfig +from ovos_bus_client.message import Message +from ovos_bus_client.util import get_mycroft_bus from ovos_config.config import Configuration @@ -111,10 +112,12 @@ def send_diagnostics(allow_logs=True, allow_transcripts=True, allow_config=True) # else: transcripts = None - data = {"host": socket.gethostname(), + data = {"name": "diagnostics", + "host": socket.gethostname(), "startup": startup_text, "configurations": json.dumps(configs) if configs else None, "logs": json.dumps(logs) if logs else None, "transcripts": transcripts} - report_metric("diagnostics", **data) + bus = get_mycroft_bus() + bus.emit(Message("neon.metric", data=data)) return data diff --git a/requirements/core_modules.txt b/requirements/core_modules.txt index 6920698c0..7e4ea385b 100644 --- a/requirements/core_modules.txt +++ b/requirements/core_modules.txt @@ -1,6 +1,6 @@ # neon core modules neon-messagebus~=2.0,>=2.0.2a7 -neon-enclosure~=1.7,>=1.7.1a4 +neon-enclosure~=1.7,>=1.7.1a5 neon-speech~=4.4,>=4.4.2a4 neon-gui~=1.3,>=1.3.1a3 neon-audio~=1.5,>=1.5.2a10 \ No newline at end of file diff --git a/requirements/requirements.txt b/requirements/requirements.txt index 31e1bb3a8..61b0d4698 100644 --- a/requirements/requirements.txt +++ b/requirements/requirements.txt @@ -2,7 +2,7 @@ ovos-core[lgpl]~=0.0.8 # padacioso==0.1.3a2 -neon-utils[network,audio]~=1.11,>=1.11.1a3 +neon-utils[network,audio]~=1.11,>=1.11.1a4 # TODO: `audio` extra for dependency resolution ovos-utils~=0.0,>=0.0.38 ovos-bus-client~=0.0,>=0.0.10 diff --git a/test/test_diagnostic_utils.py b/test/test_diagnostic_utils.py index c5665e92c..48acf4252 100644 --- a/test/test_diagnostic_utils.py +++ b/test/test_diagnostic_utils.py @@ -30,6 +30,10 @@ import shutil import sys import unittest +from unittest.mock import patch + +from ovos_utils.fakebus import FakeBus + import neon_utils.metrics_utils from mock import Mock @@ -41,6 +45,7 @@ class DiagnosticUtilsTests(unittest.TestCase): config_dir = os.path.join(os.path.dirname(__file__), "test_config") report_metric = Mock() + bus = FakeBus() @classmethod def setUpClass(cls) -> None: @@ -52,6 +57,8 @@ def setUpClass(cls) -> None: from neon_core.configuration import patch_config patch_config({"log_dir": test_dir}) + cls.bus.on("neon.metric", cls.report_metric) + @classmethod def tearDownClass(cls) -> None: if os.getenv("NEON_CONFIG_PATH"): @@ -62,70 +69,65 @@ def setUp(self) -> None: self.report_metric.reset_mock() neon_utils.metrics_utils.report_metric = self.report_metric - def test_send_diagnostics_default(self): + @patch("ovos_bus_client.util.get_mycroft_bus") + def test_send_diagnostics_default(self, get_bus): + get_bus.return_value = self.bus from neon_core.util.diagnostic_utils import send_diagnostics send_diagnostics() self.report_metric.assert_called_once() - args = self.report_metric.call_args - self.assertEqual(args.args, ("diagnostics",)) - data = args.kwargs - self.assertIsInstance(data, dict) - self.assertIsInstance(data["host"], str) - self.assertIsInstance(data["configurations"], str) - self.assertIsInstance(data["logs"], str) - # self.assertIsInstance(data["transcripts"], str) - - def test_send_diagnostics_no_extras(self): + message = self.report_metric.call_args[0][0] + self.assertEqual(message.data['name'], 'diagnostics') + self.assertEqual(set(message.data.keys()), + {"name", "host", "startup", "configurations", "logs", + "transcripts"}) + + @patch("ovos_bus_client.util.get_mycroft_bus") + def test_send_diagnostics_no_extras(self, get_bus): + get_bus.return_value = self.bus from neon_core.util.diagnostic_utils import send_diagnostics send_diagnostics(False, False, False) self.report_metric.assert_called_once() - args = self.report_metric.call_args - self.assertEqual(args.args, ("diagnostics",)) - data = args.kwargs - self.assertIsInstance(data, dict) - self.assertIsInstance(data["host"], str) - self.assertIsNone(data["configurations"]) - self.assertIsNone(data["logs"]) - self.assertIsNone(data["transcripts"]) - - def test_send_diagnostics_allow_logs(self): + message = self.report_metric.call_args[0][0] + self.assertEqual(message.data['name'], 'diagnostics') + self.assertEqual(set(message.data.keys()), + {"name", "host", "startup", "configurations", "logs", + "transcripts"}) + + @patch("ovos_bus_client.util.get_mycroft_bus") + def test_send_diagnostics_allow_logs(self, get_bus): + get_bus.return_value = self.bus from neon_core.util.diagnostic_utils import send_diagnostics send_diagnostics(True, False, False) self.report_metric.assert_called_once() - args = self.report_metric.call_args - self.assertEqual(args.args, ("diagnostics",)) - data = args.kwargs - self.assertIsInstance(data, dict) - self.assertIsInstance(data["host"], str) - self.assertIsNone(data["configurations"]) - self.assertIsInstance(data["logs"], str) - self.assertIsNone(data["transcripts"]) - - def test_send_diagnostics_allow_transcripts(self): + message = self.report_metric.call_args[0][0] + self.assertEqual(message.data['name'], 'diagnostics') + self.assertEqual(set(message.data.keys()), + {"name", "host", "startup", "configurations", "logs", + "transcripts"}) + + @patch("ovos_bus_client.util.get_mycroft_bus") + def test_send_diagnostics_allow_transcripts(self, get_bus): + get_bus.return_value = self.bus from neon_core.util.diagnostic_utils import send_diagnostics send_diagnostics(False, True, False) self.report_metric.assert_called_once() - args = self.report_metric.call_args - self.assertEqual(args.args, ("diagnostics",)) - data = args.kwargs - self.assertIsInstance(data, dict) - self.assertIsInstance(data["host"], str) - self.assertIsNone(data["configurations"]) - self.assertIsNone(data["logs"]) - # self.assertIsInstance(data["transcripts"], str) - - def test_send_diagnostics_allow_config(self): + message = self.report_metric.call_args[0][0] + self.assertEqual(message.data['name'], 'diagnostics') + self.assertEqual(set(message.data.keys()), + {"name", "host", "startup", "configurations", "logs", + "transcripts"}) + + @patch("ovos_bus_client.util.get_mycroft_bus") + def test_send_diagnostics_allow_config(self, get_bus): + get_bus.return_value = self.bus from neon_core.util.diagnostic_utils import send_diagnostics send_diagnostics(False, False, True) self.report_metric.assert_called_once() - args = self.report_metric.call_args - self.assertEqual(args.args, ("diagnostics",)) - data = args.kwargs - self.assertIsInstance(data, dict) - self.assertIsInstance(data["host"], str) - self.assertIsInstance(data["configurations"], str) - self.assertIsNone(data["logs"]) - self.assertIsNone(data["transcripts"]) + message = self.report_metric.call_args[0][0] + self.assertEqual(message.data['name'], 'diagnostics') + self.assertEqual(set(message.data.keys()), + {"name", "host", "startup", "configurations", "logs", + "transcripts"}) if __name__ == '__main__':