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:
diff --git a/designate_tempest_plugin/services/dns/v2/json/recordset_client.py b/designate_tempest_plugin/services/dns/v2/json/recordset_client.py
index ed07817..440b852 100644
--- a/designate_tempest_plugin/services/dns/v2/json/recordset_client.py
+++ b/designate_tempest_plugin/services/dns/v2/json/recordset_client.py
@@ -11,9 +11,14 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
+from tempest import config
from designate_tempest_plugin.common import waiters
from designate_tempest_plugin.services.dns.v2.json import base
+from designate_tempest_plugin.services.dns.query.query_client import (
+ QueryClient)
+
+CONF = config.CONF
class RecordsetClient(base.DnsClientV2Base):
@@ -32,6 +37,12 @@
build_timeout, disable_ssl_certificate_validation, ca_certs,
trace_requests, name, http_timeout, proxy_url,
follow_redirects=False)
+ self.query_client = QueryClient(
+ nameservers=CONF.dns.nameservers,
+ query_timeout=CONF.dns.query_timeout,
+ build_interval=CONF.dns.build_interval,
+ build_timeout=CONF.dns.build_timeout,
+ )
@base.handle_errors
def create_recordset(self, zone_uuid, recordset_data,