Merge "Fix checking of the [dns].nameservers value"

This commit is contained in:
Zuul 2023-01-15 22:40:43 +00:00 committed by Gerrit Code Review
commit c9429994a4
3 changed files with 11 additions and 8 deletions

View File

@ -233,7 +233,7 @@ def wait_for_query(client, name, rdatatype, found=True):
else:
all_answers_good = all(not r.answer for r in responses)
if not client.nameservers or all_answers_good:
if all_answers_good:
LOG.info("Record %s of type %s was successfully %s on nameservers "
"%s", name, rdatatype, state, client.nameservers)
return

View File

@ -24,21 +24,17 @@ class QueryClient(object):
def __init__(self, nameservers=None, query_timeout=None,
build_interval=None, build_timeout=None):
self.nameservers = self._nameservers_not_empty(
nameservers or CONF.dns.nameservers)
self.nameservers = nameservers or CONF.dns.nameservers
self.query_timeout = query_timeout or CONF.dns.query_timeout
self.build_interval = build_interval or CONF.dns.build_interval
self.build_timeout = build_timeout or CONF.dns.build_timeout
self.clients = [SingleQueryClient(ns, query_timeout=query_timeout)
for ns in nameservers]
def _nameservers_not_empty(self, nameservers_list):
if not nameservers_list:
def query(self, zone_name, rdatatype):
if not self.nameservers:
raise ValueError('Nameservers list cannot be empty and it should '
'contain DNS backend IPs to "dig" for')
return nameservers_list
def query(self, zone_name, rdatatype):
return [c.query(zone_name, rdatatype) for c in self.clients]

View File

@ -18,6 +18,7 @@ from oslo_log import log as logging
from tempest import config
from tempest.lib import decorators
from tempest.lib import exceptions as lib_exc
import testtools
from designate_tempest_plugin.common import waiters
from designate_tempest_plugin import data_utils as dns_data_utils
@ -79,6 +80,9 @@ class ZoneTasks(BaseZonesTest):
cls.alt_client = cls.os_alt.dns_v2.ZonesClient()
@decorators.idempotent_id('287e2cd0-a0e7-11eb-b962-74e5f9e2a801')
@testtools.skipUnless(
config.CONF.dns.nameservers,
"Config option dns.nameservers is missing or empty")
def test_zone_abandon(self):
LOG.info('Create a PRIMARY zone')
zone_name = dns_data_utils.rand_zone_name(
@ -121,6 +125,9 @@ class ZoneTasks(BaseZonesTest):
self.query_client, pr_zone['name'], "SOA")
@decorators.idempotent_id('90b21d1a-a1ba-11eb-84fa-74e5f9e2a801')
@testtools.skipUnless(
config.CONF.dns.nameservers,
"Config option dns.nameservers is missing or empty")
def test_zone_abandon_forbidden(self):
LOG.info('Create a PRIMARY zone and add to the cleanup')