Stop Prometheus mode from falling through to the client
This commit is contained in:
+1
-1
@@ -138,7 +138,7 @@ def main() -> None:
|
||||
|
||||
prometheus.prometheus_export(daemonize=True, debug=debug)
|
||||
|
||||
if args.report_influxdb:
|
||||
elif args.report_influxdb:
|
||||
from bmspy import influxdb as bms_influx
|
||||
|
||||
bms_influx.influxdb_export(
|
||||
|
||||
+5
-1
@@ -138,9 +138,13 @@ class TestMain:
|
||||
import bmspy.prometheus as prom_mod
|
||||
mock_export = MagicMock()
|
||||
with patch("sys.argv", ["bmspy", "--prometheus"]), \
|
||||
patch.object(prom_mod, "prometheus_export", mock_export):
|
||||
patch.object(prom_mod, "prometheus_export", mock_export), \
|
||||
patch("bmspy.client.handle_registration") as register, \
|
||||
patch("bmspy.client.read_data") as read_data:
|
||||
main()
|
||||
mock_export.assert_called_once()
|
||||
register.assert_not_called()
|
||||
read_data.assert_not_called()
|
||||
|
||||
def test_textfile_flag_calls_prometheus_export(self, tmp_path):
|
||||
import bmspy.prometheus as prom_mod
|
||||
|
||||
Reference in New Issue
Block a user