Fix deleting zones after 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: Iebe15ca6d0d3101237a92e011b081c38647a8de6
Related-prod: PROD-22810
diff --git a/designate_tempest_plugin/tests/api/v2/test_recordset.py b/designate_tempest_plugin/tests/api/v2/test_recordset.py
index 2a2e483..fd05e73 100644
--- a/designate_tempest_plugin/tests/api/v2/test_recordset.py
+++ b/designate_tempest_plugin/tests/api/v2/test_recordset.py
@@ -40,11 +40,11 @@
@classmethod
def resource_cleanup(cls):
- super(BaseRecordsetsTest, cls).resource_cleanup()
-
cls.zone_client.delete_zone(
cls.zone['id'], ignore_errors=lib_exc.NotFound)
+ super(BaseRecordsetsTest, cls).resource_cleanup()
+
@ddt.ddt
class RecordsetsTest(BaseRecordsetsTest):
@@ -232,7 +232,7 @@
def test_get_nonexistent_recordset(self):
LOG.info('Create a zone')
_, zone = self.zone_client.create_zone()
- self.addCleanup(self.zone_client.delete_zone, zone['id'])
+ self.addCleanup(self.wait_zone_delete, self.zone_client, zone['id'])
LOG.info('Attempt to get an invalid Recordset')
with self.assertRaisesDns(
@@ -243,7 +243,7 @@
def test_get_nonexistent_recordset_invalid_id(self):
LOG.info('Create a zone')
_, zone = self.zone_client.create_zone()
- self.addCleanup(self.zone_client.delete_zone, zone['id'])
+ self.addCleanup(self.wait_zone_delete, self.zone_client, zone['id'])
LOG.info('Attempt to get an invalid Recordset')
with self.assertRaisesDns(lib_exc.BadRequest, 'invalid_uuid', 400):
@@ -253,7 +253,7 @@
def test_update_nonexistent_recordset(self):
LOG.info('Create a zone')
_, zone = self.zone_client.create_zone()
- self.addCleanup(self.zone_client.delete_zone, zone['id'])
+ self.addCleanup(self.wait_zone_delete, self.zone_client, zone['id'])
recordset_data = data_utils.rand_recordset_data('A', zone['name'])
@@ -267,7 +267,7 @@
def test_update_nonexistent_recordset_invalid_id(self):
LOG.info('Create a zone')
_, zone = self.zone_client.create_zone()
- self.addCleanup(self.zone_client.delete_zone, zone['id'])
+ self.addCleanup(self.wait_zone_delete, self.zone_client, zone['id'])
recordset_data = data_utils.rand_recordset_data('A', zone['name'])
@@ -280,7 +280,7 @@
def test_delete_nonexistent_recordset(self):
LOG.info('Create a zone')
_, zone = self.zone_client.create_zone()
- self.addCleanup(self.zone_client.delete_zone, zone['id'])
+ self.addCleanup(self.wait_zone_delete, self.zone_client, zone['id'])
LOG.info('Attempt to delete an invalid Recordset')
with self.assertRaisesDns(
@@ -292,7 +292,7 @@
def test_delete_nonexistent_recordset_invalid_id(self):
LOG.info('Create a zone')
_, zone = self.zone_client.create_zone()
- self.addCleanup(self.zone_client.delete_zone, zone['id'])
+ self.addCleanup(self.wait_zone_delete, self.zone_client, zone['id'])
LOG.info('Attempt to get an invalid Recordset')
with self.assertRaisesDns(lib_exc.BadRequest, 'invalid_uuid', 400):
@@ -347,7 +347,7 @@
LOG.info('Create another zone')
_, zone2 = self.zone_client.create_zone()
- self.addCleanup(self.zone_client.delete_zone, zone2['id'])
+ self.addCleanup(self.wait_zone_delete, self.zone_client, zone2['id'])
LOG.info('Create another Recordset')
recordset_data = data_utils.rand_recordset_data(
@@ -376,7 +376,7 @@
def test_list_zones_recordsets_zone_names(self):
LOG.info('Create another zone')
_, zone2 = self.zone_client.create_zone()
- self.addCleanup(self.zone_client.delete_zone, zone2['id'])
+ self.addCleanup(self.wait_zone_delete, self.zone_client, zone2['id'])
LOG.info('List recordsets')
_, body = self.client.list_zones_recordsets()
@@ -421,7 +421,7 @@
LOG.info('Create a zone as a default user')
_, zone = self.zone_client.create_zone(name='a.b.' + zone_name)
- self.addCleanup(self.zone_client.delete_zone, zone['id'])
+ self.addCleanup(self.wait_zone_delete, self.zone_client, zone['id'])
rrset_data = data_utils.rand_recordset_data(
record_type='A', zone_name=zone_name)
@@ -436,6 +436,12 @@
def test_no_create_recordset_via_alt_domain(self):
_, zone = self.zone_client.create_zone()
_, alt_zone = self.alt_zone_client.create_zone()
+ self.addCleanup(self.wait_zone_delete,
+ self.zone_client,
+ zone['id'])
+ self.addCleanup(self.wait_zone_delete,
+ self.alt_zone_client,
+ alt_zone['id'])
# alt attempts to create record with name A12345.{zone}
recordset_data = data_utils.rand_recordset_data(
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 dc70822..81c1353 100644
--- a/designate_tempest_plugin/tests/api/v2/test_recordset_validation.py
+++ b/designate_tempest_plugin/tests/api/v2/test_recordset_validation.py
@@ -14,8 +14,6 @@
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
@@ -35,8 +33,6 @@
'TXT',
]
-CONF = config.CONF
-
@ddt.ddt
class RecordsetValidationTest(base.BaseDnsV2Test):
@@ -45,15 +41,6 @@
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()
@@ -67,6 +54,9 @@
zone_data = data_utils.rand_zone_data()
resp, body = self.zones_client.create_zone(**zone_data)
self._zone = body
+ self.addCleanup(self.wait_zone_delete,
+ self.zones_client,
+ body['id'])
return self._zone
def create_recordset(self, data):
@@ -75,10 +65,6 @@
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):
diff --git a/designate_tempest_plugin/tests/api/v2/test_transfer_accepts.py b/designate_tempest_plugin/tests/api/v2/test_transfer_accepts.py
index 0972a24..918b1c0 100644
--- a/designate_tempest_plugin/tests/api/v2/test_transfer_accepts.py
+++ b/designate_tempest_plugin/tests/api/v2/test_transfer_accepts.py
@@ -37,7 +37,7 @@
def test_create_transfer_accept(self):
LOG.info('Create a zone')
_, zone = self.zone_client.create_zone()
- self.addCleanup(self.zone_client.delete_zone, zone['id'])
+ self.addCleanup(self.wait_zone_delete, self.zone_client, zone['id'])
LOG.info('Create a zone transfer_request')
_, transfer_request = self.request_client.create_transfer_request(
@@ -59,7 +59,7 @@
def test_show_transfer_accept(self):
LOG.info('Create a zone')
_, zone = self.zone_client.create_zone()
- self.addCleanup(self.zone_client.delete_zone, zone['id'])
+ self.addCleanup(self.wait_zone_delete, self.zone_client, zone['id'])
LOG.info('Create a zone transfer_request')
_, transfer_request = self.request_client.create_transfer_request(
diff --git a/designate_tempest_plugin/tests/api/v2/test_transfer_request.py b/designate_tempest_plugin/tests/api/v2/test_transfer_request.py
index af81cfc..cd2426a 100644
--- a/designate_tempest_plugin/tests/api/v2/test_transfer_request.py
+++ b/designate_tempest_plugin/tests/api/v2/test_transfer_request.py
@@ -41,7 +41,7 @@
def test_create_transfer_request(self):
LOG.info('Create a zone')
_, zone = self.zone_client.create_zone()
- self.addCleanup(self.zone_client.delete_zone, zone['id'])
+ self.addCleanup(self.wait_zone_delete, self.zone_client, zone['id'])
LOG.info('Create a zone transfer_request')
_, transfer_request = self.client.create_transfer_request(zone['id'])
@@ -55,7 +55,7 @@
def test_create_transfer_request_scoped(self):
LOG.info('Create a zone')
_, zone = self.zone_client.create_zone()
- self.addCleanup(self.zone_client.delete_zone, zone['id'])
+ self.addCleanup(self.wait_zone_delete, self.zone_client, zone['id'])
transfer_request_data = dns_data_utils.rand_transfer_request_data(
target_project_id=self.os_alt.credentials.project_id)
@@ -73,7 +73,7 @@
def test_create_transfer_request_empty_body(self):
LOG.info('Create a zone')
_, zone = self.zone_client.create_zone()
- self.addCleanup(self.zone_client.delete_zone, zone['id'])
+ self.addCleanup(self.wait_zone_delete, self.zone_client, zone['id'])
LOG.info('Create a zone transfer_request')
_, transfer_request = self.client.create_transfer_request_empty_body(
zone['id'])
@@ -87,7 +87,7 @@
def test_show_transfer_request(self):
LOG.info('Create a zone')
_, zone = self.zone_client.create_zone()
- self.addCleanup(self.zone_client.delete_zone, zone['id'])
+ self.addCleanup(self.wait_zone_delete, self.zone_client, zone['id'])
LOG.info('Create a zone transfer_request')
_, transfer_request = self.client.create_transfer_request(zone['id'])
@@ -107,7 +107,7 @@
# the request.
LOG.info('Create a zone')
_, zone = self.zone_client.create_zone()
- self.addCleanup(self.zone_client.delete_zone, zone['id'])
+ self.addCleanup(self.wait_zone_delete, self.zone_client, zone['id'])
transfer_request_data = dns_data_utils.rand_transfer_request_data(
target_project_id=self.os_alt.credentials.project_id)
@@ -131,7 +131,7 @@
def test_delete_transfer_request(self):
LOG.info('Create a zone')
_, zone = self.zone_client.create_zone()
- self.addCleanup(self.zone_client.delete_zone, zone['id'])
+ self.addCleanup(self.wait_zone_delete, self.zone_client, zone['id'])
LOG.info('Create a transfer_request')
_, transfer_request = self.client.create_transfer_request(zone['id'])
@@ -148,7 +148,7 @@
def test_list_transfer_requests(self):
LOG.info('Create a zone')
_, zone = self.zone_client.create_zone()
- self.addCleanup(self.zone_client.delete_zone, zone['id'])
+ self.addCleanup(self.wait_zone_delete, self.zone_client, zone['id'])
LOG.info('Create a zone transfer_request')
_, transfer_request = self.client.create_transfer_request(zone['id'])
@@ -164,7 +164,7 @@
def test_update_transfer_request(self):
LOG.info('Create a zone')
_, zone = self.zone_client.create_zone()
- self.addCleanup(self.zone_client.delete_zone, zone['id'])
+ self.addCleanup(self.wait_zone_delete, self.zone_client, zone['id'])
LOG.info('Create a zone transfer_request')
_, transfer_request = self.client.create_transfer_request(zone['id'])
diff --git a/designate_tempest_plugin/tests/api/v2/test_tsigkey.py b/designate_tempest_plugin/tests/api/v2/test_tsigkey.py
index 129c576..6f7a311 100644
--- a/designate_tempest_plugin/tests/api/v2/test_tsigkey.py
+++ b/designate_tempest_plugin/tests/api/v2/test_tsigkey.py
@@ -39,7 +39,7 @@
def test_create_tsigkey(self):
LOG.info('Create a resource')
_, zone = self.zone_client.create_zone()
- self.addCleanup(self.zone_client.delete_zone, zone['id'])
+ self.addCleanup(self.wait_zone_delete, self.zone_client, zone['id'])
tsigkey_data = {
"name": "Example tsigkey",
@@ -61,7 +61,7 @@
def test_list_tsigkey(self):
LOG.info('Create a resource')
_, zone = self.zone_client.create_zone()
- self.addCleanup(self.zone_client.delete_zone, zone['id'])
+ self.addCleanup(self.wait_zone_delete, self.zone_client, zone['id'])
LOG.info('Create a tsigkey')
_, tsigkey = self.admin_client.create_tsigkey(resource_id=zone['id'])
self.addCleanup(self.admin_client.delete_tsigkey, tsigkey['id'])
@@ -72,7 +72,7 @@
def test_show_tsigkey(self):
LOG.info('Create a resource')
_, zone = self.zone_client.create_zone()
- self.addCleanup(self.zone_client.delete_zone, zone['id'])
+ self.addCleanup(self.wait_zone_delete, self.zone_client, zone['id'])
LOG.info('Create a tsigkey')
_, tsigkey = self.admin_client.create_tsigkey(resource_id=zone['id'])
@@ -88,7 +88,7 @@
def test_update_tsigkey(self):
LOG.info('Create a resource')
_, zone = self.zone_client.create_zone()
- self.addCleanup(self.zone_client.delete_zone, zone['id'])
+ self.addCleanup(self.wait_zone_delete, self.zone_client, zone['id'])
LOG.info('Create a tsigkey')
_, tsigkey = self.admin_client.create_tsigkey(resource_id=zone['id'])
@@ -113,7 +113,7 @@
def test_delete_tsigkey(self):
LOG.info('Create a resource')
_, zone = self.zone_client.create_zone()
- self.addCleanup(self.zone_client.delete_zone, zone['id'])
+ self.addCleanup(self.wait_zone_delete, self.zone_client, zone['id'])
LOG.info('Create a tsigkey')
_, tsigkey = self.admin_client.create_tsigkey(resource_id=zone['id'])
diff --git a/designate_tempest_plugin/tests/api/v2/test_zones.py b/designate_tempest_plugin/tests/api/v2/test_zones.py
index 326aa48..cb7d205 100644
--- a/designate_tempest_plugin/tests/api/v2/test_zones.py
+++ b/designate_tempest_plugin/tests/api/v2/test_zones.py
@@ -38,7 +38,7 @@
def test_create_zone(self):
LOG.info('Create a zone')
_, zone = self.client.create_zone()
- self.addCleanup(self.client.delete_zone, zone['id'])
+ self.addCleanup(self.wait_zone_delete, self.client, zone['id'])
LOG.info('Ensure we respond with CREATE+PENDING')
self.assertEqual('CREATE', zone['action'])
@@ -48,7 +48,7 @@
def test_show_zone(self):
LOG.info('Create a zone')
_, zone = self.client.create_zone()
- self.addCleanup(self.client.delete_zone, zone['id'])
+ self.addCleanup(self.wait_zone_delete, self.client, zone['id'])
LOG.info('Fetch the zone')
_, body = self.client.show_zone(zone['id'])
@@ -61,7 +61,7 @@
def test_delete_zone(self):
LOG.info('Create a zone')
_, zone = self.client.create_zone()
- self.addCleanup(self.client.delete_zone, zone['id'],
+ self.addCleanup(self.wait_zone_delete, self.client, zone['id'],
ignore_errors=lib_exc.NotFound)
LOG.info('Delete the zone')
@@ -75,7 +75,7 @@
def test_list_zones(self):
LOG.info('Create a zone')
_, zone = self.client.create_zone()
- self.addCleanup(self.client.delete_zone, zone['id'])
+ self.addCleanup(self.wait_zone_delete, self.client, zone['id'])
LOG.info('List zones')
_, body = self.client.list_zones()
@@ -88,7 +88,7 @@
def test_update_zone(self):
LOG.info('Create a zone')
_, zone = self.client.create_zone()
- self.addCleanup(self.client.delete_zone, zone['id'])
+ self.addCleanup(self.wait_zone_delete, self.client, zone['id'])
# Generate a random description
description = data_utils.rand_name()
@@ -126,7 +126,7 @@
def test_get_other_tenant_zone(self):
LOG.info('Create a zone as a user')
_, zone = self.client.create_zone()
- self.addCleanup(self.client.delete_zone, zone['id'])
+ self.addCleanup(self.wait_zone_delete, self.client, zone['id'])
LOG.info('Fetch the zone as an admin')
_, body = self.admin_client.show_zone(
@@ -150,7 +150,7 @@
def test_no_create_duplicate_domain(self):
LOG.info('Create a zone as a default user')
_, zone = self.client.create_zone()
- self.addCleanup(self.client.delete_zone, zone['id'])
+ self.addCleanup(self.wait_zone_delete, self.client, zone['id'])
LOG.info('Create a zone as an default with existing domain')
self.assertRaises(lib_exc.Conflict,
@@ -164,7 +164,7 @@
def test_no_create_subdomain_by_alt_user(self):
LOG.info('Create a zone as a default user')
_, zone = self.client.create_zone()
- self.addCleanup(self.client.delete_zone, zone['id'])
+ self.addCleanup(self.wait_zone_delete, self.client, zone['id'])
LOG.info('Create a zone as an alt user with existing subdomain')
self.assertRaises(lib_exc.Forbidden,
@@ -178,7 +178,7 @@
LOG.info('Create a zone as a default user')
_, zone = self.client.create_zone(name='a.b.' + zone_name)
- self.addCleanup(self.client.delete_zone, zone['id'])
+ self.addCleanup(self.wait_zone_delete, self.client, zone['id'])
LOG.info('Create a zone as an alt user with existing superdomain')
self.assertRaises(lib_exc.Forbidden,
diff --git a/designate_tempest_plugin/tests/api/v2/test_zones_exports.py b/designate_tempest_plugin/tests/api/v2/test_zones_exports.py
index de5b5fe..5b302d2 100644
--- a/designate_tempest_plugin/tests/api/v2/test_zones_exports.py
+++ b/designate_tempest_plugin/tests/api/v2/test_zones_exports.py
@@ -38,10 +38,11 @@
def test_create_zone_export(self):
LOG.info('Create a zone')
_, zone = self.zone_client.create_zone()
- self.addCleanup(self.zone_client.delete_zone, zone['id'])
+ self.addCleanup(self.wait_zone_delete, self.zone_client, zone['id'])
LOG.info('Create a zone export')
_, zone_export = self.client.create_zone_export(zone['id'])
+ self.addCleanup(self.client.delete_zone_export, zone_export['id'])
LOG.info('Ensure we respond with PENDING')
self.assertEqual('PENDING', zone_export['status'])
@@ -51,10 +52,11 @@
def test_show_zone_export(self):
LOG.info('Create a zone')
_, zone = self.zone_client.create_zone()
- self.addCleanup(self.zone_client.delete_zone, zone['id'])
+ self.addCleanup(self.wait_zone_delete, self.zone_client, zone['id'])
LOG.info('Create a zone export')
resp, zone_export = self.client.create_zone_export(zone['id'])
+ self.addCleanup(self.client.delete_zone_export, zone_export['id'])
LOG.info('Re-Fetch the zone export')
_, body = self.client.show_zone_export(zone_export['id'])
@@ -66,7 +68,7 @@
def test_delete_zone_export(self):
LOG.info('Create a zone')
_, zone = self.zone_client.create_zone()
- self.addCleanup(self.zone_client.delete_zone, zone['id'],
+ self.addCleanup(self.wait_zone_delete, self.zone_client, zone['id'],
ignore_errors=lib_exc.NotFound)
LOG.info('Create a zone export')
@@ -83,9 +85,10 @@
def test_list_zone_exports(self):
LOG.info('Create a zone')
_, zone = self.zone_client.create_zone()
- self.addCleanup(self.zone_client.delete_zone, zone['id'])
+ self.addCleanup(self.wait_zone_delete, self.zone_client, zone['id'])
_, export = self.client.create_zone_export(zone['id'])
+ self.addCleanup(self.client.delete_zone_export, export['id'])
LOG.info('List zone exports')
_, body = self.client.list_zone_exports()
diff --git a/designate_tempest_plugin/tests/api/v2/test_zones_imports.py b/designate_tempest_plugin/tests/api/v2/test_zones_imports.py
index 42a20dc..ed7f3f9 100644
--- a/designate_tempest_plugin/tests/api/v2/test_zones_imports.py
+++ b/designate_tempest_plugin/tests/api/v2/test_zones_imports.py
@@ -16,6 +16,7 @@
from tempest.lib import decorators
from tempest.lib import exceptions as lib_exc
+from designate_tempest_plugin.common import waiters
from designate_tempest_plugin.tests import base
LOG = logging.getLogger(__name__)
@@ -30,13 +31,22 @@
@classmethod
def setup_clients(cls):
super(ZonesImportTest, cls).setup_clients()
- cls.client = cls.os.zone_imports_client
+
+ cls.client = cls.os_primary.zone_imports_client
+ cls.zone_client = cls.os_primary.zones_client
+
+ def clean_up_resources(self, zone_import_id):
+ waiters.wait_for_zone_import_status(self.client, zone_import_id,
+ "COMPLETE")
+ _, zone_import = self.client.show_zone_import(zone_import_id)
+ self.client.delete_zone_import(zone_import['id'])
+ self.wait_zone_delete(self.zone_client, zone_import['zone_id'])
@decorators.idempotent_id('2e2d907d-0609-405b-9c96-3cb2b87e3dce')
def test_create_zone_import(self):
LOG.info('Create a zone import')
_, zone_import = self.client.create_zone_import()
- self.addCleanup(self.client.delete_zone_import, zone_import['id'])
+ self.addCleanup(self.clean_up_resources, zone_import['id'])
LOG.info('Ensure we respond with PENDING')
self.assertEqual('PENDING', zone_import['status'])
@@ -46,7 +56,7 @@
def test_show_zone_import(self):
LOG.info('Create a zone import')
_, zone_import = self.client.create_zone_import()
- self.addCleanup(self.client.delete_zone_import, zone_import['id'])
+ self.addCleanup(self.clean_up_resources, zone_import['id'])
LOG.info('Re-Fetch the zone import')
resp, body = self.client.show_zone_import(zone_import['id'])
@@ -58,6 +68,12 @@
def test_delete_zone_import(self):
LOG.info('Create a zone import')
_, zone_import = self.client.create_zone_import()
+ waiters.wait_for_zone_import_status(self.client, zone_import['id'],
+ "COMPLETE")
+ _, zone_import = self.client.show_zone_import(zone_import['id'])
+ self.addCleanup(self.wait_zone_delete,
+ self.zone_client,
+ zone_import['zone_id'])
LOG.info('Delete the zone')
resp, body = self.client.delete_zone_import(zone_import['id'])
@@ -69,7 +85,8 @@
@decorators.idempotent_id('9eab76af-1995-485f-a2ef-8290c1863aba')
def test_list_zones_imports(self):
LOG.info('Create a zone import')
- _, zone = self.client.create_zone_import()
+ _, zone_import = self.client.create_zone_import()
+ self.addCleanup(self.clean_up_resources, zone_import['id'])
LOG.info('List zones imports')
_, body = self.client.list_zone_imports()
diff --git a/designate_tempest_plugin/tests/base.py b/designate_tempest_plugin/tests/base.py
index 43579dc..b088f43 100644
--- a/designate_tempest_plugin/tests/base.py
+++ b/designate_tempest_plugin/tests/base.py
@@ -14,6 +14,7 @@
import six
from tempest import test
from tempest import config
+from tempest.lib.common.utils import test_utils as utils
from designate_tempest_plugin import clients
@@ -103,6 +104,18 @@
with context:
callable_(*args, **kwargs)
+ def wait_zone_delete(self, zone_client, zone_id, **kwargs):
+ zone_client.delete_zone(zone_id, **kwargs)
+ utils.call_until_true(self._check_zone_deleted,
+ CONF.dns.build_timeout,
+ CONF.dns.build_interval,
+ zone_client,
+ zone_id)
+
+ def _check_zone_deleted(self, zone_client, zone_id):
+ return utils.call_and_ignore_notfound_exc(zone_client.show_zone,
+ zone_id) is None
+
class BaseDnsV1Test(BaseDnsTest):
"""Base class for DNS V1 API tests."""
diff --git a/designate_tempest_plugin/tests/scenario/v2/test_zones.py b/designate_tempest_plugin/tests/scenario/v2/test_zones.py
index 94665a8..e51f563 100644
--- a/designate_tempest_plugin/tests/scenario/v2/test_zones.py
+++ b/designate_tempest_plugin/tests/scenario/v2/test_zones.py
@@ -38,7 +38,7 @@
def test_create_and_delete_zone(self):
LOG.info('Create a zone')
_, zone = self.client.create_zone()
- self.addCleanup(self.client.delete_zone, zone['id'],
+ self.addCleanup(self.wait_zone_delete, self.client, zone['id'],
ignore_errors=lib_exc.NotFound)
LOG.info('Ensure we respond with CREATE+PENDING')
@@ -69,7 +69,7 @@
def test_delete_zone_pending_create(self):
LOG.info('Create a zone')
_, zone = self.client.create_zone()
- self.addCleanup(self.client.delete_zone, zone['id'],
+ self.addCleanup(self.wait_zone_delete, self.client, zone['id'],
ignore_errors=lib_exc.NotFound)
# NOTE(kiall): This is certainly a little racey, it's entirely
@@ -95,7 +95,7 @@
def test_zone_create_propagates_to_nameservers(self):
LOG.info('Create a zone')
_, zone = self.client.create_zone()
- self.addCleanup(self.client.delete_zone, zone['id'])
+ self.addCleanup(self.wait_zone_delete, self.client, zone['id'])
waiters.wait_for_zone_status(self.client, zone['id'], "ACTIVE")
waiters.wait_for_query(self.query_client, zone['name'], "SOA")
@@ -109,7 +109,7 @@
def test_zone_delete_propagates_to_nameservers(self):
LOG.info('Create a zone')
_, zone = self.client.create_zone()
- self.addCleanup(self.client.delete_zone, zone['id'],
+ self.addCleanup(self.wait_zone_delete, self.client, zone['id'],
ignore_errors=lib_exc.NotFound)
waiters.wait_for_zone_status(self.client, zone['id'], "ACTIVE")
diff --git a/designate_tempest_plugin/tests/scenario/v2/test_zones_export.py b/designate_tempest_plugin/tests/scenario/v2/test_zones_export.py
index b8002de..8c1b90f 100644
--- a/designate_tempest_plugin/tests/scenario/v2/test_zones_export.py
+++ b/designate_tempest_plugin/tests/scenario/v2/test_zones_export.py
@@ -36,10 +36,12 @@
def test_create_zone_export_and_show_exported_zonefile(self):
LOG.info('Create a zone to be exported')
_, zone = self.zones_client.create_zone()
- self.addCleanup(self.zones_client.delete_zone, zone['id'])
+ self.addCleanup(self.wait_zone_delete, self.zones_client, zone['id'])
LOG.info('Create a zone export')
_, zone_export = self.client.create_zone_export(zone['id'])
+ self.addCleanup(self.client.delete_zone_export, zone_export['id'])
+
self.assertEqual('PENDING', zone_export['status'])
self.assertEqual(zone['id'], zone_export['zone_id'])
self.assertIsNone(zone_export['links'].get('export'))
@@ -51,6 +53,7 @@
LOG.info('Check the zone export looks good')
_, zone_export = self.client.show_zone_export(zone_export['id'])
+
self.assertEqual('COMPLETE', zone_export['status'])
self.assertEqual(zone['id'], zone_export['zone_id'])
self.assertIsNotNone(zone_export['links'].get('export'))
diff --git a/designate_tempest_plugin/tests/scenario/v2/test_zones_import.py b/designate_tempest_plugin/tests/scenario/v2/test_zones_import.py
index 4406059..b08f829 100644
--- a/designate_tempest_plugin/tests/scenario/v2/test_zones_import.py
+++ b/designate_tempest_plugin/tests/scenario/v2/test_zones_import.py
@@ -27,8 +27,9 @@
@classmethod
def setup_clients(cls):
super(ZonesImportTest, cls).setup_clients()
- cls.client = cls.os.zone_imports_client
- cls.zones_client = cls.os.zones_client
+
+ cls.client = cls.os_primary.zone_imports_client
+ cls.zones_client = cls.os_primary.zones_client
@decorators.attr(type='slow')
@decorators.idempotent_id('679f38d0-2f2f-49c5-934e-8fe0c452f56e')
@@ -46,6 +47,10 @@
LOG.info('Check the zone import looks good')
_, zone_import = self.client.show_zone_import(zone_import['id'])
+ self.addCleanup(self.wait_zone_delete,
+ self.zones_client,
+ zone_import['zone_id'])
+
self.assertEqual('COMPLETE', zone_import['status'])
self.assertIsNotNone(zone_import['zone_id'])
self.assertIsNotNone(zone_import['links'].get('zone'))
diff --git a/designate_tempest_plugin/tests/scenario/v2/test_zones_transfer.py b/designate_tempest_plugin/tests/scenario/v2/test_zones_transfer.py
index 4870307..b59967d 100644
--- a/designate_tempest_plugin/tests/scenario/v2/test_zones_transfer.py
+++ b/designate_tempest_plugin/tests/scenario/v2/test_zones_transfer.py
@@ -37,14 +37,14 @@
def test_zone_transfer(self):
LOG.info('Create a zone as primary tenant')
_, zone = self.zones_client.create_zone()
- self.addCleanup(self.zones_client.delete_zone, zone['id'],
- ignore_errors=lib_exc.NotFound)
- self.addCleanup(self.alt_zones_client.delete_zone, zone['id'],
+ self.addCleanup(self.wait_zone_delete, self.zones_client, zone['id'],
ignore_errors=lib_exc.NotFound)
LOG.info('Create a zone transfer_request for zone as primary tenant')
_, transfer_request = \
self.request_client.create_transfer_request_empty_body(zone['id'])
+ self.addCleanup(self.request_client.delete_transfer_request,
+ transfer_request['id'])
accept_data = {
"key": transfer_request['key'],
@@ -55,7 +55,10 @@
self.alt_accept_client.create_transfer_accept(accept_data)
LOG.info('Fetch the zone as alt tenant')
- self.alt_zones_client.show_zone(zone['id'])
+ _, alt_zone = self.alt_zones_client.show_zone(zone['id'])
+ self.addCleanup(self.wait_zone_delete,
+ self.alt_zones_client,
+ alt_zone['id'])
LOG.info('Ensure 404 when fetching the zone as primary tenant')
self.assertRaises(lib_exc.NotFound,