Fix checking of the [dns].nameservers value

This patch [1] introduced checking whether the CONF.dns.nameservers
is empty. If the CONF.dns.nameservers value is empty then the
initialization of the QueryClient fails. This change makes the majority
of designate-tempest-plugin tests fail even tests that do not use the
QueryClient.

This patch introduces three changes:

1) ValueError is raised only when the query() function is called so
   that only tests that actually use the query() function fail.

2) wait_for_query() function is fixed so that it never succeeds when the
   CONF.dns.nameservers value is empty.

3) Skip tests that rely upon [dns].nameserver value.

[1] https://review.opendev.org/c/openstack/designate-tempest-plugin/+/860116

Change-Id: Iedd151b2e47ed62adc168a97cb6021ccb47abb0f
diff --git a/designate_tempest_plugin/common/waiters.py b/designate_tempest_plugin/common/waiters.py
index affe332..cfa2d10 100644
--- a/designate_tempest_plugin/common/waiters.py
+++ b/designate_tempest_plugin/common/waiters.py
@@ -233,7 +233,7 @@
         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
diff --git a/designate_tempest_plugin/services/dns/query/query_client.py b/designate_tempest_plugin/services/dns/query/query_client.py
index 7629c51..a9e9723 100644
--- a/designate_tempest_plugin/services/dns/query/query_client.py
+++ b/designate_tempest_plugin/services/dns/query/query_client.py
@@ -24,21 +24,17 @@
 
     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]
 
 
diff --git a/designate_tempest_plugin/tests/api/v2/test_zone_tasks.py b/designate_tempest_plugin/tests/api/v2/test_zone_tasks.py
index 70a2e77..2faa83d 100644
--- a/designate_tempest_plugin/tests/api/v2/test_zone_tasks.py
+++ b/designate_tempest_plugin/tests/api/v2/test_zone_tasks.py
@@ -19,6 +19,7 @@
 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 constants as const
 from designate_tempest_plugin.common import waiters
@@ -81,6 +82,9 @@
         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(
@@ -123,6 +127,9 @@
             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')