Fix deleting zones in recordset validation tests
these tests create zones as part of the test but do clean them up
afterward slowly. This leads to these and following tests in the thread
to fail with over quota when default zone quota is sufficiently low.
Change-Id: Iab9a4308bd8e936be735ce85fdf0a419a1b68bee
diff --git a/designate_tempest_plugin/tests/api/v2/test_recordset_validation.py b/designate_tempest_plugin/tests/api/v2/test_recordset_validation.py
index 40e8928..dc70822 100644
--- a/designate_tempest_plugin/tests/api/v2/test_recordset_validation.py
+++ b/designate_tempest_plugin/tests/api/v2/test_recordset_validation.py
@@ -14,6 +14,8 @@
limitations under the License.
"""
import ddt
+from tempest import config
+from tempest.lib.common.utils import test_utils as utils
from tempest.lib import exceptions
from tempest.lib import decorators
@@ -33,6 +35,8 @@
'TXT',
]
+CONF = config.CONF
+
@ddt.ddt
class RecordsetValidationTest(base.BaseDnsV2Test):
@@ -41,6 +45,15 @@
super(RecordsetValidationTest, self).setUp()
self._zone = None
+ def tearDown(self):
+ if self._zone:
+ self.zones_client.delete_zone(self._zone['id'])
+ utils.call_until_true(self._check_zone_deleted,
+ CONF.dns.build_timeout,
+ CONF.dns.build_interval,
+ self._zone['id'])
+ super(RecordsetValidationTest, self).tearDown()
+
@classmethod
def setup_clients(cls):
super(RecordsetValidationTest, cls).setup_clients()
@@ -54,7 +67,6 @@
zone_data = data_utils.rand_zone_data()
resp, body = self.zones_client.create_zone(**zone_data)
self._zone = body
- self.addCleanup(self.zones_client.delete_zone, body['id'])
return self._zone
def create_recordset(self, data):
@@ -63,6 +75,10 @@
return body
+ def _check_zone_deleted(self, zone_id):
+ return utils.call_and_ignore_notfound_exc(self.zones_client.show_zone,
+ zone_id) is None
+
@decorators.idempotent_id('c5ef87e2-cb79-4758-b968-18eef2c251df')
@ddt.data(*RECORDSETS_DATASET)
def test_create_invalid(self, rtype):