Add check for dns record propagation to backend
In case we failed to wait for recordset status add ability to debug
Related-Prod: https://mirantis.jira.com/browse/PRODX-53762
Change-Id: Idd2b9f871b957b1be89aa38471cc17517bb1d1bd
(cherry picked from commit a357c6057aeb004ca5e94424372a1a08b33f7952)
diff --git a/designate_tempest_plugin/common/waiters.py b/designate_tempest_plugin/common/waiters.py
index cfa2d10..72fe2a6 100644
--- a/designate_tempest_plugin/common/waiters.py
+++ b/designate_tempest_plugin/common/waiters.py
@@ -207,10 +207,24 @@
if caller:
message = '(%s) %s' % (caller, message)
+ LOG.debug("Checking recordset %s propagation", recordset_id)
+ try:
+ wait_for_query(client.query_client, recordset['name'],
+ recordset['type'], timeout=30)
+ LOG.debug("Recordset %s was propagated to backend",
+ recordset_id)
+ except Exception:
+ LOG.exception(
+ "Failed to wait for recordset %s propagation.",
+ recordset_id)
+ # Get latest recordset status, to check if status is recovered
+ rset = client.show_recordset(
+ zone_id, recordset_id, headers=headers)[1]
+ LOG.debug("Recordset %s details: %s", recordset_id, rset)
raise lib_exc.TimeoutException(message)
-def wait_for_query(client, name, rdatatype, found=True):
+def wait_for_query(client, name, rdatatype, found=True, timeout=None):
"""Query nameservers until the record of the given name and type is found.
:param client: A QueryClient
@@ -218,8 +232,10 @@
:param rdatatype: The record type for which to query
:param found: If True, wait until the record is found. Else, wait until the
record disappears.
+ :param timeout: Number of seconds to wait for record.
"""
state = "found" if found else "removed"
+ timeout = timeout or client.build_timeout
LOG.info("Waiting for record %s of type %s to be %s on nameservers %s",
name, rdatatype, state, client.nameservers)
start = int(time.time())
@@ -238,7 +254,7 @@
"%s", name, rdatatype, state, client.nameservers)
return
- if int(time.time()) - start >= client.build_timeout:
+ if int(time.time()) - start >= timeout:
message = ('Record %(name)s of type %(rdatatype)s not %(state)s '
'on nameservers %(nameservers)s within the required '
'time (%(timeout)s s)' %
@@ -246,7 +262,7 @@
'rdatatype': rdatatype,
'state': state,
'nameservers': client.nameservers,
- 'timeout': client.build_timeout})
+ 'timeout': timeout})
caller = test_utils.find_test_caller()
if caller: