Unstable system test: test_get_ha_pair_mt_config_review_reports
There are extensive logs. It seems some system test waiting function caused the failure. The expected condition has never been met. The system tests stopped after performing 120 unsuccessful retries.
Code trace
=================================== FAILURES ===================================
_________ test_get_ha_pair_mt_config_review_reports[ha_pair_service0] __________
server_service = <core.wrappers.server.Server object at 0x7f3e37abd7f0>
ha_pair_service = (<core.wrappers.kea.Kea object at 0x7f3e37a7e970>, <core.wrappers.kea.Kea object at 0x7f3e37895490>)
@ha_pair_parametrize('agent-kea-ha1-mt', 'agent-kea-ha2-mt')
def test_get_ha_pair_mt_config_review_reports(server_service: Server, ha_pair_service):
"""Test that the Stork server suggests to use the dedicated listeners
if the Kea HA is running in the multi-threading mode but the peers
communicate over the Kea Control Agent."""
server_service.log_in_as_admin()
server_service.authorize_all_machines()
> states = server_service.wait_for_next_machine_states()
tests/test_config_review.py:90:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
core/utils.py:69: in inner_wrapper
result = f(*args, **kwargs)
core/wrappers/server.py:589: in wait_for_next_machine_states
state = self.read_machine_state(machine["id"])
core/wrappers/server.py:296: in read_machine_state
return api_instance.get_machine_state(id=machine_id)
openapi_client/api/services_api.py:2785: in get_machine_state
return self.get_machine_state_endpoint.call_with_http_info(**kwargs)
openapi_client/api_client.py:881: in call_with_http_info
return self.api_client.call_api(
openapi_client/api_client.py:423: in call_api
return self.__call_api(resource_path, method,
openapi_client/api_client.py:205: in __call_api
raise e
openapi_client/api_client.py:198: in __call_api
response_data = self.request(
openapi_client/api_client.py:449: in request
return self.rest_client.GET(url,
openapi_client/rest.py:235: in GET
return self.request("GET", url,
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <openapi_client.rest.RESTClientObject object at 0x7f3e38882e80>
method = 'GET', url = 'http://docker:42080/api/machines/1/state'
query_params = []
headers = {'Accept': 'application/json', 'Cookie': 'session=QAGPZfnh89GWqFHFZmnRhjm-Iv8Q0kzu5K94XIJYdN8; Path=/; Expires=Tue, 06 Jun 2023 16:15:45 GMT; Max-Age=86400; HttpOnly; SameSite=Lax', 'User-Agent': 'OpenAPI-Generator/1.0.0/python'}
body = None, post_params = {}, _preload_content = True, _request_timeout = None
def request(self, method, url, query_params=None, headers=None,
body=None, post_params=None, _preload_content=True,
_request_timeout=None):
"""Perform requests.
:param method: http request method
:param url: http request url
:param query_params: query parameters in the url
:param headers: http request headers
:param body: request json body, for `application/json`
:param post_params: request post parameters,
`application/x-www-form-urlencoded`
and `multipart/form-data`
:param _preload_content: if False, the urllib3.HTTPResponse object will
be returned without reading/decoding response
data. Default is True.
:param _request_timeout: timeout setting for this request. If one
number provided, it will be total request
timeout. It can also be a pair (tuple) of
(connection, read) timeouts.
"""
method = method.upper()
assert method in ['GET', 'HEAD', 'DELETE', 'POST', 'PUT',
'PATCH', 'OPTIONS']
if post_params and body:
raise ApiValueError(
"body parameter cannot be used with post_params parameter."
)
post_params = post_params or {}
headers = headers or {}
timeout = None
if _request_timeout:
if isinstance(_request_timeout, (int, float)): # noqa: E501,F821
timeout = urllib3.Timeout(total=_request_timeout)
elif (isinstance(_request_timeout, tuple) and
len(_request_timeout) == 2):
timeout = urllib3.Timeout(
connect=_request_timeout[0], read=_request_timeout[1])
try:
# For `POST`, `PUT`, `PATCH`, `OPTIONS`, `DELETE`
if method in ['POST', 'PUT', 'PATCH', 'OPTIONS', 'DELETE']:
# Only set a default Content-Type for POST, PUT, PATCH and OPTIONS requests
if (method != 'DELETE') and ('Content-Type' not in headers):
headers['Content-Type'] = 'application/json'
if query_params:
url += '?' + urlencode(query_params)
if ('Content-Type' not in headers) or (re.search('json',
headers['Content-Type'], re.IGNORECASE)):
request_body = None
if body is not None:
request_body = json.dumps(body)
r = self.pool_manager.request(
method, url,
body=request_body,
preload_content=_preload_content,
timeout=timeout,
headers=headers)
elif headers['Content-Type'] == 'application/x-www-form-urlencoded': # noqa: E501
r = self.pool_manager.request(
method, url,
fields=post_params,
encode_multipart=False,
preload_content=_preload_content,
timeout=timeout,
headers=headers)
elif headers['Content-Type'] == 'multipart/form-data':
# must del headers['Content-Type'], or the correct
# Content-Type which generated by urllib3 will be
# overwritten.
del headers['Content-Type']
r = self.pool_manager.request(
method, url,
fields=post_params,
encode_multipart=True,
preload_content=_preload_content,
timeout=timeout,
headers=headers)
# Pass a `string` parameter directly in the body to support
# other content types than Json when `body` argument is
# provided in serialized form
elif isinstance(body, str) or isinstance(body, bytes):
request_body = body
r = self.pool_manager.request(
method, url,
body=request_body,
preload_content=_preload_content,
timeout=timeout,
headers=headers)
else:
# Cannot generate the request from given parameters
msg = """Cannot prepare a request message for provided
arguments. Please check that your arguments match
declared content type."""
raise ApiException(status=0, reason=msg)
# For `GET`, `HEAD`
else:
r = self.pool_manager.request(method, url,
fields=query_params,
preload_content=_preload_content,
timeout=timeout,
headers=headers)
except urllib3.exceptions.SSLError as e:
msg = "{0}\n{1}".format(type(e).__name__, str(e))
raise ApiException(status=0, reason=msg)
if _preload_content:
r = RESTResponse(r)
# log response body
logger.debug("response body: %s", r.data)
if not 200 <= r.status <= 299:
if r.status == 401:
raise UnauthorizedException(http_resp=r)
if r.status == 403:
raise ForbiddenException(http_resp=r)
if r.status == 404:
raise NotFoundException(http_resp=r)
if 500 <= r.status <= 599:
> raise ServiceException(http_resp=r)
E openapi_client.exceptions.ServiceException: Status Code: 500
E Reason: Internal Server Error
E HTTP response headers: HTTPHeaderDict({'Content-Type': 'application/json', 'Vary': 'Cookie', 'Date': 'Mon, 05 Jun 2023 16:15:49 GMT', 'Content-Length': '64'})
E HTTP response body: {"message":"Problem storing application state in the database"}
openapi_client/rest.py:227: ServiceException