Fix the global unique ID generator recursive constructor call

This commit is contained in:
Stanislav Hejny
2025-07-12 22:59:21 +01:00
parent dd590a11b5
commit 0e294b223d
8 changed files with 122 additions and 326 deletions
+13 -5
View File
@@ -275,7 +275,9 @@ class TestBackpressureHandler:
"""
Pytest fixture to create a mock AMQConfiguration.
"""
return AMQConfiguration("")
amq_cfg = AMQConfiguration("")
amq_cfg.backpressure.cpu_monitoring_enabled = True
return amq_cfg
def test_backpressure_handler_initialization(self, mock_channel, mock_loop, mock_config):
"""
@@ -649,8 +651,12 @@ class TestBackpressureHandler:
mock_time.return_value = current_time
# Set last data message time to be older than idle_duration
handler.last_data_message_time = current_time - mock_config.backpressure.idle_duration - 10
handler.last_backpressure_event_time = current_time - mock_config.backpressure.time_window - 10
handler.last_data_message_time = (
current_time - mock_config.backpressure.idle_duration - 10
)
handler.last_backpressure_event_time = (
current_time - mock_config.backpressure.time_window - 10
)
# Call the method
await handler.check_overload_condition()
@@ -679,7 +685,9 @@ class TestBackpressureHandler:
mock_time.return_value = current_time
# Set last event time to be older than time_window
handler.last_backpressure_event_time = current_time - mock_config.backpressure.time_window - 10
handler.last_backpressure_event_time = (
current_time - mock_config.backpressure.time_window - 10
)
# Call the method
await handler.check_overload_condition()
@@ -701,7 +709,7 @@ class TestBackpressureHandler:
# Verify no thread was started
assert thread is None
assert not hasattr(handler, 'thread') or handler.thread is None
assert not hasattr(handler, "thread") or handler.thread is None
def test_start_backpressure_monitor_enabled(self, mock_channel, mock_loop, mock_config):
"""