@@ -31,7 +31,7 @@ def test_returns_false_when_worker_not_overloaded(self, notify_api: "Flask", moc
3131
3232 def test_returns_false_when_below_high_water_mark (self , notify_api : "Flask" , mocker : MockerFixture ) -> None :
3333 mock_counter = mocker .patch ("app.load_shedding.concurrent_request_counter" )
34- mock_counter .get .return_value = 20 # Below HIGH_WATER_MARK of 26
34+ mock_counter .get .return_value = 4 # Below HIGH_WATER_MARK of 6
3535 mock_gauge = mocker .patch ("app.load_shedding.WORKER_LOAD_SHEDDING" )
3636
3737 assert is_worker_overloaded () is False
@@ -41,7 +41,7 @@ def test_returns_false_when_below_high_water_mark(self, notify_api: "Flask", moc
4141
4242 def test_returns_true_when_above_high_water_mark (self , notify_api : "Flask" , mocker : MockerFixture ) -> None :
4343 mock_counter = mocker .patch ("app.load_shedding.concurrent_request_counter" )
44- mock_counter .get .return_value = 28 # Above HIGH_WATER_MARK of 26
44+ mock_counter .get .return_value = 7 # Above HIGH_WATER_MARK of 6
4545 mock_gauge = mocker .patch ("app.load_shedding.WORKER_LOAD_SHEDDING" )
4646
4747 assert is_worker_overloaded () is True
@@ -51,7 +51,7 @@ def test_returns_true_when_above_high_water_mark(self, notify_api: "Flask", mock
5151
5252 def test_returns_false_at_boundary (self , notify_api : "Flask" , mocker : MockerFixture ) -> None :
5353 mock_counter = mocker .patch ("app.load_shedding.concurrent_request_counter" )
54- mock_counter .get .return_value = 26 # At HIGH_WATER_MARK
54+ mock_counter .get .return_value = 6 # At HIGH_WATER_MARK
5555 mock_gauge = mocker .patch ("app.load_shedding.WORKER_LOAD_SHEDDING" )
5656
5757 # At the threshold should NOT trigger (uses > not >=)
@@ -73,32 +73,32 @@ def test_increments_activation_counter_on_state_transition(
7373
7474 ls_module ._is_currently_load_shedding = False
7575
76- # First call: healthy (10 < 26 )
77- mock_counter .get .return_value = 10
76+ # First call: healthy (3 < 6 )
77+ mock_counter .get .return_value = 3
7878 is_worker_overloaded ()
7979 assert mock_activation_counter .inc .call_count == 0
8080 assert mock_gauge .set .call_args [0 ][0 ] == 0 # Gauge set to 0
8181
82- # Second call: enter overload (28 > 26 ) - should increment
83- mock_counter .get .return_value = 28
82+ # Second call: enter overload (7 > 6 ) - should increment
83+ mock_counter .get .return_value = 7
8484 is_worker_overloaded ()
8585 assert mock_activation_counter .inc .call_count == 1
8686 assert mock_gauge .set .call_args [0 ][0 ] == 1 # Gauge set to 1
8787
88- # Third call: stay overloaded (30 > 26 ) - should NOT increment again
89- mock_counter .get .return_value = 30
88+ # Third call: stay overloaded (8 > 6 ) - should NOT increment again
89+ mock_counter .get .return_value = 8
9090 is_worker_overloaded ()
9191 assert mock_activation_counter .inc .call_count == 1 # Still 1, not 2
9292 assert mock_gauge .set .call_args [0 ][0 ] == 1 # Gauge still 1
9393
94- # Fourth call: exit overload (10 < 26 ) - should NOT increment
95- mock_counter .get .return_value = 10
94+ # Fourth call: exit overload (3 < 6 ) - should NOT increment
95+ mock_counter .get .return_value = 3
9696 is_worker_overloaded ()
9797 assert mock_activation_counter .inc .call_count == 1
9898 assert mock_gauge .set .call_args [0 ][0 ] == 0 # Gauge back to 0
9999
100- # Fifth call: re-enter overload (28 > 26 ) - should increment again
101- mock_counter .get .return_value = 28
100+ # Fifth call: re-enter overload (7 > 6 ) - should increment again
101+ mock_counter .get .return_value = 7
102102 is_worker_overloaded ()
103103 assert mock_activation_counter .inc .call_count == 2
104104 assert mock_gauge .set .call_args [0 ][0 ] == 1 # Gauge set to 1 again
@@ -115,7 +115,7 @@ def test_logs_activation_and_deactivation(self, notify_api: "Flask", mocker: Moc
115115 ls_module ._is_currently_load_shedding = False
116116
117117 # Enter load shedding - should log warning
118- mock_counter .get .return_value = 28
118+ mock_counter .get .return_value = 7
119119 with notify_api .app_context ():
120120 mock_logger = mocker .patch ("app.load_shedding.current_app.logger" )
121121 is_worker_overloaded ()
@@ -125,7 +125,7 @@ def test_logs_activation_and_deactivation(self, notify_api: "Flask", mocker: Moc
125125 assert "ACTIVATED" in mock_logger .warning .call_args [0 ][0 ]
126126
127127 # Exit load shedding - should log info
128- mock_counter .get .return_value = 10
128+ mock_counter .get .return_value = 3
129129 with notify_api .app_context ():
130130 mock_logger = mocker .patch ("app.load_shedding.current_app.logger" )
131131 is_worker_overloaded ()
0 commit comments