Skip to content

Commit 31946cf

Browse files
committed
retry_test_mixins changes
1 parent a162de3 commit 31946cf

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

tests/e2e/common/retry_test_mixins.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,9 @@ class PySQLRetryTestsMixin:
121121
# For testing purposes
122122
_retry_policy = {
123123
"_retry_delay_min": 0.1,
124-
"_retry_delay_max": 5,
124+
"_retry_delay_max": 3,
125125
"_retry_stop_after_attempts_count": 5,
126-
"_retry_stop_after_attempts_duration": 10,
126+
"_retry_stop_after_attempts_duration": 30,
127127
"_retry_delay_default": 0.5,
128128
}
129129

@@ -135,7 +135,7 @@ def test_retry_urllib3_settings_are_honored(self):
135135
urllib3_config = {"connect": 10, "read": 11, "redirect": 12}
136136
rp = DatabricksRetryPolicy(
137137
delay_min=0.1,
138-
delay_max=10.0,
138+
delay_max=3,
139139
stop_after_attempts_count=10,
140140
stop_after_attempts_duration=10.0,
141141
delay_default=1.0,
@@ -174,14 +174,14 @@ def test_retry_max_count_not_exceeded(self):
174174
def test_retry_exponential_backoff(self):
175175
"""GIVEN the retry policy is configured for reasonable exponential backoff
176176
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
178178
"""
179179
retry_policy = self._retry_policy.copy()
180180
retry_policy["_retry_delay_min"] = 1
181181

182182
time_start = time.time()
183183
with mocked_server_response(
184-
status=429, headers={"Retry-After": "3"}
184+
status=429, headers={"Retry-After": "8"}
185185
) as mock_obj:
186186
with pytest.raises(RequestError) as cm:
187187
with self.connection(extra_params=retry_policy) as conn:
@@ -191,14 +191,14 @@ def test_retry_exponential_backoff(self):
191191
assert isinstance(cm.value.args[1], MaxRetryDurationError)
192192

193193
# With setting delay_min to 1, the expected retry delays should be:
194-
# 3, 3, 3, 3
194+
# 8, 8, 8, 8
195195
# The first 3 retries are allowed, the 4th retry puts the total duration over the limit
196-
# of 10 seconds
196+
# of 30 seconds
197197
assert mock_obj.return_value.getresponse.call_count == 4
198-
assert duration > 6
198+
assert duration > 24
199199

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
202202

203203
def test_retry_max_duration_not_exceeded(self):
204204
"""GIVEN the max attempt duration of 10 seconds

0 commit comments

Comments
 (0)