Merge "Fix MAX_TIMEOUT value for listener" into stable/train

This commit is contained in:
Zuul 2021-10-06 21:54:43 +00:00 committed by Gerrit Code Review
commit 03fbfd2551
3 changed files with 23 additions and 12 deletions

View File

@ -228,8 +228,8 @@ DEFAULT_MAX_RETRIES_DOWN = 3
MIN_HM_RETRIES = 1
MAX_HM_RETRIES = 10
# 1 year: y d h m ms
MAX_TIMEOUT = 365 * 24 * 60 * 60 * 1000
# 24 days: days d h m ms
MAX_TIMEOUT = 24 * 24 * 60 * 60 * 1000
MIN_TIMEOUT = 0
DEFAULT_TIMEOUT_CLIENT_DATA = 50000

View File

@ -681,17 +681,21 @@ class TestListener(base.BaseAPITest):
def test_create_with_timeouts_too_high(self):
optionals = {
'timeout_client_data': 1,
'timeout_member_connect': 2,
'timeout_member_data': 3,
'timeout_tcp_inspect': constants.MAX_TIMEOUT + 1,
'timeout_member_connect': 1,
'timeout_member_data': 1,
'timeout_tcp_inspect': 1,
}
resp = self.test_create(response_status=400, **optionals).json
fault = resp.get('faultstring')
self.assertIn(
'Invalid input for field/attribute timeout_tcp_inspect', fault)
self.assertIn(
'Value should be lower or equal to {0}'.format(
constants.MAX_TIMEOUT), fault)
for field in optionals.items():
optionals.update({field[0]: constants.MAX_TIMEOUT + 1})
resp = self.test_create(response_status=400, **optionals).json
optionals.update({field[0]: 1})
fault = resp.get('faultstring')
self.assertIn(
'Invalid input for field/attribute {0}'.format(
field[0]), fault)
self.assertIn(
'Value should be lower or equal to {0}'.format(
constants.MAX_TIMEOUT), fault)
def test_create_with_timeouts_too_low(self):
optionals = {

View File

@ -0,0 +1,7 @@
---
fixes:
- |
Fixed MAX_TIMEOUT for timeout_client_data, timeout_member_connect,
timeout_member_data, timeout_tcp_inspect API listener. The value was
reduced from 365 days to 24 days, which now does not exceed the value of
the data type in DB.