diff --git a/platform_plugin_aspects/management/commands/monitor_load_test_tracking.py b/platform_plugin_aspects/management/commands/monitor_load_test_tracking.py index 439f58f..c32f280 100644 --- a/platform_plugin_aspects/management/commands/monitor_load_test_tracking.py +++ b/platform_plugin_aspects/management/commands/monitor_load_test_tracking.py @@ -31,6 +31,7 @@ class Monitor: """ Manages the configuration and state of the load test monitor. """ + def __init__(self, sleep_time: float, backend: str): self.run_id = str(uuid.uuid4())[:6] self.ch_url = settings.EVENT_SINK_CLICKHOUSE_BACKEND_CONFIG["url"] diff --git a/platform_plugin_aspects/tests/commands/test_load_test_monitor.py b/platform_plugin_aspects/tests/commands/test_load_test_monitor.py index a320c72..2f09aee 100644 --- a/platform_plugin_aspects/tests/commands/test_load_test_monitor.py +++ b/platform_plugin_aspects/tests/commands/test_load_test_monitor.py @@ -67,7 +67,7 @@ def load_test_command_basic_options(): expected_logs=[ "Clickhouse lag seconds: 1", "Starting monitor for kafka_bus with sleep of 10 seconds", - "test [test] Lag: 95" + "test [test] Lag: 95", ], ), # Test vector backend @@ -113,18 +113,24 @@ def test_monitor_options(test_command_option, caplog): ] }, # Second response is the Vector API call, GraphQL is awful. - {"data": { - "sinks": { - "edges": [{ - "node": { - "metrics": { - "sentEventsTotal": {"sentEventsTotal": 10}, - "receivedEventsTotal": {"receivedEventsTotal": 10}, - }, - }, - }], + { + "data": { + "sinks": { + "edges": [ + { + "node": { + "metrics": { + "sentEventsTotal": {"sentEventsTotal": 10}, + "receivedEventsTotal": { + "receivedEventsTotal": 10 + }, + }, + }, + } + ], + } } - }}, + }, ) patches["redis"].Redis.from_url.return_value.llen.return_value = 5 @@ -133,16 +139,16 @@ def test_monitor_options(test_command_option, caplog): "groups": [ {"name": "group1", "lag": 2}, {"name": "group2", "lag": 3}, - ] + ], } patches["confluent_kafka"].Consumer.return_value.committed.return_value = { KafkaPartition(offset=5, topic="test", partition="test"): Mock() } - patches["confluent_kafka"].Consumer.return_value.get_watermark_offsets.return_value = ( - 10, 100 - ) + patches[ + "confluent_kafka" + ].Consumer.return_value.get_watermark_offsets.return_value = (10, 100) call_command("monitor_load_test_tracking", **option_combination)