@@ -121,9 +121,9 @@ class PySQLRetryTestsMixin:
121
121
# For testing purposes
122
122
_retry_policy = {
123
123
"_retry_delay_min" : 0.1 ,
124
- "_retry_delay_max" : 5 ,
124
+ "_retry_delay_max" : 3 ,
125
125
"_retry_stop_after_attempts_count" : 5 ,
126
- "_retry_stop_after_attempts_duration" : 10 ,
126
+ "_retry_stop_after_attempts_duration" : 30 ,
127
127
"_retry_delay_default" : 0.5 ,
128
128
}
129
129
@@ -135,7 +135,7 @@ def test_retry_urllib3_settings_are_honored(self):
135
135
urllib3_config = {"connect" : 10 , "read" : 11 , "redirect" : 12 }
136
136
rp = DatabricksRetryPolicy (
137
137
delay_min = 0.1 ,
138
- delay_max = 10.0 ,
138
+ delay_max = 3 ,
139
139
stop_after_attempts_count = 10 ,
140
140
stop_after_attempts_duration = 10.0 ,
141
141
delay_default = 1.0 ,
@@ -174,14 +174,14 @@ def test_retry_max_count_not_exceeded(self):
174
174
def test_retry_exponential_backoff (self ):
175
175
"""GIVEN the retry policy is configured for reasonable exponential backoff
176
176
WHEN the server sends nothing but 429 responses with retry-afters
177
- THEN the connector will use those retry-afters values as delay
177
+ THEN the connector will use those retry-afters values as floor
178
178
"""
179
179
retry_policy = self ._retry_policy .copy ()
180
180
retry_policy ["_retry_delay_min" ] = 1
181
181
182
182
time_start = time .time ()
183
183
with mocked_server_response (
184
- status = 429 , headers = {"Retry-After" : "3 " }
184
+ status = 429 , headers = {"Retry-After" : "8 " }
185
185
) as mock_obj :
186
186
with pytest .raises (RequestError ) as cm :
187
187
with self .connection (extra_params = retry_policy ) as conn :
@@ -191,14 +191,14 @@ def test_retry_exponential_backoff(self):
191
191
assert isinstance (cm .value .args [1 ], MaxRetryDurationError )
192
192
193
193
# With setting delay_min to 1, the expected retry delays should be:
194
- # 3, 3, 3, 3
194
+ # 8, 8, 8, 8
195
195
# The first 3 retries are allowed, the 4th retry puts the total duration over the limit
196
- # of 10 seconds
196
+ # of 30 seconds
197
197
assert mock_obj .return_value .getresponse .call_count == 4
198
- assert duration > 6
198
+ assert duration > 24
199
199
200
- # Should be less than 7 , but this is a safe margin for CI/CD slowness
201
- assert duration < 10
200
+ # Should be less than 26 , but this is a safe margin for CI/CD slowness
201
+ assert duration < 30
202
202
203
203
def test_retry_max_duration_not_exceeded (self ):
204
204
"""GIVEN the max attempt duration of 10 seconds
0 commit comments