Merge "Fix checking of the [dns].nameservers value"
This commit is contained in:
commit
c9429994a4
|
@ -233,7 +233,7 @@ def wait_for_query(client, name, rdatatype, found=True):
|
||||||
else:
|
else:
|
||||||
all_answers_good = all(not r.answer for r in responses)
|
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 "
|
LOG.info("Record %s of type %s was successfully %s on nameservers "
|
||||||
"%s", name, rdatatype, state, client.nameservers)
|
"%s", name, rdatatype, state, client.nameservers)
|
||||||
return
|
return
|
||||||
|
|
|
@ -24,21 +24,17 @@ class QueryClient(object):
|
||||||
|
|
||||||
def __init__(self, nameservers=None, query_timeout=None,
|
def __init__(self, nameservers=None, query_timeout=None,
|
||||||
build_interval=None, build_timeout=None):
|
build_interval=None, build_timeout=None):
|
||||||
self.nameservers = self._nameservers_not_empty(
|
self.nameservers = nameservers or CONF.dns.nameservers
|
||||||
nameservers or CONF.dns.nameservers)
|
|
||||||
self.query_timeout = query_timeout or CONF.dns.query_timeout
|
self.query_timeout = query_timeout or CONF.dns.query_timeout
|
||||||
self.build_interval = build_interval or CONF.dns.build_interval
|
self.build_interval = build_interval or CONF.dns.build_interval
|
||||||
self.build_timeout = build_timeout or CONF.dns.build_timeout
|
self.build_timeout = build_timeout or CONF.dns.build_timeout
|
||||||
self.clients = [SingleQueryClient(ns, query_timeout=query_timeout)
|
self.clients = [SingleQueryClient(ns, query_timeout=query_timeout)
|
||||||
for ns in nameservers]
|
for ns in nameservers]
|
||||||
|
|
||||||
def _nameservers_not_empty(self, nameservers_list):
|
def query(self, zone_name, rdatatype):
|
||||||
if not nameservers_list:
|
if not self.nameservers:
|
||||||
raise ValueError('Nameservers list cannot be empty and it should '
|
raise ValueError('Nameservers list cannot be empty and it should '
|
||||||
'contain DNS backend IPs to "dig" for')
|
'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]
|
return [c.query(zone_name, rdatatype) for c in self.clients]
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,7 @@ from oslo_log import log as logging
|
||||||
from tempest import config
|
from tempest import config
|
||||||
from tempest.lib import decorators
|
from tempest.lib import decorators
|
||||||
from tempest.lib import exceptions as lib_exc
|
from tempest.lib import exceptions as lib_exc
|
||||||
|
import testtools
|
||||||
|
|
||||||
from designate_tempest_plugin.common import waiters
|
from designate_tempest_plugin.common import waiters
|
||||||
from designate_tempest_plugin import data_utils as dns_data_utils
|
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()
|
cls.alt_client = cls.os_alt.dns_v2.ZonesClient()
|
||||||
|
|
||||||
@decorators.idempotent_id('287e2cd0-a0e7-11eb-b962-74e5f9e2a801')
|
@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):
|
def test_zone_abandon(self):
|
||||||
LOG.info('Create a PRIMARY zone')
|
LOG.info('Create a PRIMARY zone')
|
||||||
zone_name = dns_data_utils.rand_zone_name(
|
zone_name = dns_data_utils.rand_zone_name(
|
||||||
|
@ -121,6 +125,9 @@ class ZoneTasks(BaseZonesTest):
|
||||||
self.query_client, pr_zone['name'], "SOA")
|
self.query_client, pr_zone['name'], "SOA")
|
||||||
|
|
||||||
@decorators.idempotent_id('90b21d1a-a1ba-11eb-84fa-74e5f9e2a801')
|
@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):
|
def test_zone_abandon_forbidden(self):
|
||||||
|
|
||||||
LOG.info('Create a PRIMARY zone and add to the cleanup')
|
LOG.info('Create a PRIMARY zone and add to the cleanup')
|
||||||
|
|
Loading…
Reference in New Issue