Add API version check capabilities
This patch adds a method that allows us to get the current Designate API version under test for use in test classes to skip tests against new features introduced in a specific API version.
This patch also centralizes the "primary" zones client to be instantiated once and updates the tests to use a standardized name for the client.
Finally, it adds a missing requirement of oslo.serialization to requirements.txt.
Change-Id: I240911c0ab9b9bad7851268865d6a8e867627673
diff --git a/designate_tempest_plugin/services/dns/json/base.py b/designate_tempest_plugin/services/dns/json/base.py
index 6ac9a85..dc3eb6f 100644
--- a/designate_tempest_plugin/services/dns/json/base.py
+++ b/designate_tempest_plugin/services/dns/json/base.py
@@ -276,3 +276,41 @@
body = self.deserialize(resp, body)
return resp, body
+
+ def get_max_api_version(self):
+ """Get the maximum version available on the API endpoint.
+ :return: Maximum version string available on the endpoint.
+ """
+ response, body = self.get('/')
+ self.expected_success(200, response.status)
+
+ versions_list = json.loads(body)['versions']
+
+ # Handle the legacy version document format
+ if 'values' in versions_list:
+ versions_list = versions_list['values']
+
+ current_versions = (version for version in versions_list if
+ version['status'] == 'CURRENT')
+ max_version = '0.0'
+ for version in current_versions:
+
+ ver_string = version['id']
+ if ver_string.startswith("v"):
+ ver_string = ver_string[1:]
+
+ ver_split = list(map(int, ver_string.split('.')))
+ max_split = list(map(int, max_version.split('.')))
+
+ if len(ver_split) > 2:
+ raise lib_exc.InvalidAPIVersionString(version=ver_string)
+
+ if ver_split[0] > max_split[0] or (
+ ver_split[0] == max_split[0] and
+ ver_split[1] >= max_split[1]):
+ max_version = ver_string
+
+ if max_version == '0.0':
+ raise lib_exc.InvalidAPIVersionString(version=max_version)
+
+ return max_version
diff --git a/designate_tempest_plugin/tests/api/v2/test_blacklists.py b/designate_tempest_plugin/tests/api/v2/test_blacklists.py
index ecb5ce5..6dced4c 100644
--- a/designate_tempest_plugin/tests/api/v2/test_blacklists.py
+++ b/designate_tempest_plugin/tests/api/v2/test_blacklists.py
@@ -179,7 +179,7 @@
class TestBlacklistNotFoundAdmin(BaseBlacklistsTest):
- credentials = ["admin", "system_admin"]
+ credentials = ["admin", "system_admin", "primary"]
@classmethod
def setup_credentials(cls):
@@ -225,7 +225,7 @@
class TestBlacklistInvalidIdAdmin(BaseBlacklistsTest):
- credentials = ["admin", "system_admin"]
+ credentials = ["admin", "system_admin", "primary"]
@classmethod
def setup_credentials(cls):
diff --git a/designate_tempest_plugin/tests/api/v2/test_pool.py b/designate_tempest_plugin/tests/api/v2/test_pool.py
index 144f0d6..57f5234 100644
--- a/designate_tempest_plugin/tests/api/v2/test_pool.py
+++ b/designate_tempest_plugin/tests/api/v2/test_pool.py
@@ -195,7 +195,7 @@
class TestPoolNotFoundAdmin(BasePoolTest):
- credentials = ["admin", "system_admin"]
+ credentials = ["admin", "system_admin", "primary"]
@classmethod
def setup_credentials(cls):
@@ -241,7 +241,7 @@
class TestPoolInvalidIdAdmin(BasePoolTest):
- credentials = ["admin", "system_admin"]
+ credentials = ["admin", "system_admin", "primary"]
@classmethod
def setup_credentials(cls):
@@ -288,7 +288,7 @@
class TestPoolAdminNegative(BasePoolTest):
- credentials = ["admin", "system_admin"]
+ credentials = ["admin", "system_admin", "primary"]
@classmethod
def setup_credentials(cls):
diff --git a/designate_tempest_plugin/tests/api/v2/test_recordset.py b/designate_tempest_plugin/tests/api/v2/test_recordset.py
index 3773537..4970071 100644
--- a/designate_tempest_plugin/tests/api/v2/test_recordset.py
+++ b/designate_tempest_plugin/tests/api/v2/test_recordset.py
@@ -53,11 +53,11 @@
zone_name = dns_data_utils.rand_zone_name(name="TestZone",
suffix=cls.tld_name)
LOG.info('Create a zone: %s', zone_name)
- cls.zone = cls.zone_client.create_zone(name=zone_name)[1]
+ cls.zone = cls.zones_client.create_zone(name=zone_name)[1]
@classmethod
def resource_cleanup(cls):
- cls.zone_client.delete_zone(
+ cls.zones_client.delete_zone(
cls.zone['id'], ignore_errors=lib_exc.NotFound)
cls.admin_tld_client.delete_tld(cls.class_tld[1]['id'])
super(BaseRecordsetsTest, cls).resource_cleanup()
@@ -86,7 +86,6 @@
cls.admin_zone_client = cls.os_admin.dns_v2.ZonesClient()
cls.client = cls.os_primary.dns_v2.RecordsetClient()
cls.alt_client = cls.os_alt.dns_v2.RecordsetClient()
- cls.zone_client = cls.os_primary.dns_v2.ZonesClient()
cls.alt_zone_client = cls.os_alt.dns_v2.ZonesClient()
@decorators.attr(type='smoke')
@@ -537,9 +536,9 @@
LOG.info('Create a Zone')
zone_name = dns_data_utils.rand_zone_name(name="TestZone",
suffix=self.tld_name)
- zone = self.zone_client.create_zone(name=zone_name,
- wait_until=const.ACTIVE)[1]
- self.addCleanup(self.wait_zone_delete, self.zone_client, zone['id'])
+ zone = self.zones_client.create_zone(name=zone_name,
+ wait_until=const.ACTIVE)[1]
+ self.addCleanup(self.wait_zone_delete, self.zones_client, zone['id'])
LOG.info('Create a Recordset')
recordset_data = dns_data_utils.rand_recordset_data(
@@ -548,13 +547,13 @@
zone['id'], recordset_data, wait_until=const.ACTIVE)[1]
LOG.info("Delete a Zone and wait till it's done")
- body = self.zone_client.delete_zone(zone['id'])[1]
+ body = self.zones_client.delete_zone(zone['id'])[1]
LOG.info('Ensure we respond with DELETE+PENDING')
self.assertEqual(const.DELETE, body['action'])
self.assertEqual(const.PENDING, body['status'])
LOG.info('Ensure successful deletion of Zone')
- waiters.wait_for_zone_404(self.zone_client, zone['id'])
+ waiters.wait_for_zone_404(self.zones_client, zone['id'])
LOG.info('Ensure successful deletion of Recordset')
self.assertRaises(lib_exc.NotFound,
@@ -577,7 +576,6 @@
super(RecordsetsNegativeTest, cls).setup_clients()
cls.client = cls.os_primary.dns_v2.RecordsetClient()
cls.alt_client = cls.os_alt.dns_v2.RecordsetClient()
- cls.zone_client = cls.os_primary.dns_v2.ZonesClient()
@decorators.idempotent_id('98c94f8c-217a-4056-b996-b1f856d0753e')
@ddt.file_data("recordset_data_invalid.json")
@@ -705,7 +703,6 @@
def setup_clients(cls):
super(RootRecordsetsTests, cls).setup_clients()
cls.client = cls.os_primary.dns_v2.RecordsetClient()
- cls.zone_client = cls.os_primary.dns_v2.ZonesClient()
@classmethod
def skip_checks(cls):
@@ -752,8 +749,8 @@
LOG.info('Create another zone')
zone_name = dns_data_utils.rand_zone_name(name="list-filter",
suffix=self.tld_name)
- zone2 = self.zone_client.create_zone(name=zone_name)[1]
- self.addCleanup(self.wait_zone_delete, self.zone_client, zone2['id'])
+ zone2 = self.zones_client.create_zone(name=zone_name)[1]
+ self.addCleanup(self.wait_zone_delete, self.zones_client, zone2['id'])
LOG.info('Create another Recordset')
recordset_data = dns_data_utils.rand_recordset_data(
@@ -786,10 +783,10 @@
LOG.info('List recordsets')
zone_name = dns_data_utils.rand_zone_name(name="zone_names",
suffix=self.tld_name)
- alt_zone = self.zone_client.create_zone(
+ alt_zone = self.zones_client.create_zone(
name=zone_name, wait_until=const.ACTIVE)[1]
self.addCleanup(self.wait_zone_delete,
- self.zone_client,
+ self.zones_client,
alt_zone['id'])
body = self.client.list_zones_recordsets()[1]
@@ -821,7 +818,6 @@
cls.admin_client = cls.os_admin.dns_v2.RecordsetClient()
cls.client = cls.os_primary.dns_v2.RecordsetClient()
cls.alt_client = cls.os_alt.dns_v2.RecordsetClient()
- cls.zone_client = cls.os_primary.dns_v2.ZonesClient()
cls.alt_zone_client = cls.os_alt.dns_v2.ZonesClient()
def _create_client_recordset(self, clients_list):
@@ -835,12 +831,12 @@
# Create a zone and wait till it's ACTIVE
zone_name = dns_data_utils.rand_zone_name(name="primary",
suffix=self.tld_name)
- zone = self.zone_client.create_zone(name=zone_name)[1]
+ zone = self.zones_client.create_zone(name=zone_name)[1]
self.addCleanup(self.wait_zone_delete,
- self.zone_client,
+ self.zones_client,
zone['id'])
waiters.wait_for_zone_status(
- self.zone_client, zone['id'], const.ACTIVE)
+ self.zones_client, zone['id'], const.ACTIVE)
# Create a recordset and wait till it's ACTIVE
recordset_data = dns_data_utils.rand_recordset_data(
@@ -919,8 +915,8 @@
zone_name = dns_data_utils.rand_zone_name(suffix=self.tld_name)
LOG.info('Create a zone as a default user')
- zone = self.zone_client.create_zone(name='a.b.' + zone_name)[1]
- self.addCleanup(self.wait_zone_delete, self.zone_client, zone['id'])
+ zone = self.zones_client.create_zone(name='a.b.' + zone_name)[1]
+ self.addCleanup(self.wait_zone_delete, self.zones_client, zone['id'])
rrset_data = dns_data_utils.rand_recordset_data(
record_type='A', zone_name=zone_name)
@@ -1034,7 +1030,6 @@
else:
cls.admin_client = cls.os_admin.dns_v2.RecordsetClient()
cls.client = cls.os_primary.dns_v2.RecordsetClient()
- cls.zone_client = cls.os_primary.dns_v2.ZonesClient()
@decorators.idempotent_id('84164ff4-8e68-11ec-983f-201e8823901f')
def test_admin_updates_soa_and_ns_recordsets(self):
@@ -1047,11 +1042,11 @@
LOG.info('Primary user creates a Zone')
zone_name = dns_data_utils.rand_zone_name(name="update_soa_ns",
suffix=self.tld_name)
- zone = self.zone_client.create_zone(
+ zone = self.zones_client.create_zone(
name=zone_name,
description='Zone for "managed recordsets update" test',
wait_until=const.ACTIVE)[1]
- self.addCleanup(self.wait_zone_delete, self.zone_client, zone['id'])
+ self.addCleanup(self.wait_zone_delete, self.zones_client, zone['id'])
recordsets = self.admin_client.list_recordset(
zone['id'], headers=sudo_header)[1]['recordsets']
@@ -1089,7 +1084,6 @@
else:
cls.admin_client = cls.os_admin.dns_v2.RecordsetClient()
cls.admin_tld_client = cls.os_admin.dns_v2.TldClient()
- cls.zone_client = cls.os_primary.dns_v2.ZonesClient()
cls.recordset_client = cls.os_primary.dns_v2.RecordsetClient()
@decorators.idempotent_id('083fa738-bb1b-11ec-b581-201e8823901f')
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 63568c8..534e107 100644
--- a/designate_tempest_plugin/tests/api/v2/test_recordset_validation.py
+++ b/designate_tempest_plugin/tests/api/v2/test_recordset_validation.py
@@ -61,7 +61,6 @@
else:
cls.admin_tld_client = cls.os_admin.dns_v2.TldClient()
cls.recordset_client = cls.os_primary.dns_v2.RecordsetClient()
- cls.zones_client = cls.os_primary.dns_v2.ZonesClient()
@property
def zone(self):
diff --git a/designate_tempest_plugin/tests/api/v2/test_tld.py b/designate_tempest_plugin/tests/api/v2/test_tld.py
index 16711e4..a8b03f1 100644
--- a/designate_tempest_plugin/tests/api/v2/test_tld.py
+++ b/designate_tempest_plugin/tests/api/v2/test_tld.py
@@ -49,7 +49,6 @@
else:
cls.admin_client = cls.os_admin.dns_v2.TldClient()
cls.primary_client = cls.os_primary.dns_v2.TldClient()
- cls.primary_zone_client = cls.os_primary.dns_v2.ZonesClient()
@classmethod
def _generate_tld_name(cls, test_name):
@@ -240,7 +239,7 @@
class TestTldNotFoundAdmin(BaseTldTest):
- credentials = ["admin", "system_admin"]
+ credentials = ["admin", "system_admin", "primary"]
@classmethod
def setup_credentials(cls):
@@ -286,7 +285,7 @@
class TestTldInvalidIdAdmin(BaseTldTest):
- credentials = ["admin", "system_admin"]
+ credentials = ["admin", "system_admin", "primary"]
@classmethod
def setup_credentials(cls):
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 7696291..dfa91c1 100644
--- a/designate_tempest_plugin/tests/api/v2/test_transfer_accepts.py
+++ b/designate_tempest_plugin/tests/api/v2/test_transfer_accepts.py
@@ -67,7 +67,6 @@
super(TransferAcceptTest, cls).setup_clients()
# Primary clients
- cls.prm_zone_client = cls.os_primary.dns_v2.ZonesClient()
cls.prm_request_client = cls.os_primary.dns_v2.TransferRequestClient()
cls.prm_accept_client = cls.os_primary.dns_v2.TransferAcceptClient()
@@ -95,8 +94,8 @@
LOG.info('Create a zone')
zone_name = dns_data_utils.rand_zone_name(
name="create_transfer_accept", suffix=self.tld_name)
- zone = self.prm_zone_client.create_zone(name=zone_name,
- wait_until='ACTIVE')[1]
+ zone = self.zones_client.create_zone(name=zone_name,
+ wait_until='ACTIVE')[1]
self.addCleanup(
self.wait_zone_delete, self.admin_zone_client, zone['id'],
headers=self.all_projects_header,
@@ -142,8 +141,8 @@
LOG.info('Create a zone')
zone_name = dns_data_utils.rand_zone_name(name="show_transfer_accept",
suffix=self.tld_name)
- zone = self.prm_zone_client.create_zone(name=zone_name,
- wait_until='ACTIVE')[1]
+ zone = self.zones_client.create_zone(name=zone_name,
+ wait_until='ACTIVE')[1]
self.addCleanup(
self.wait_zone_delete, self.admin_zone_client, zone['id'],
headers=self.all_projects_header,
@@ -200,8 +199,8 @@
LOG.info('Create a Primary zone')
zone_name = dns_data_utils.rand_zone_name(
name="ownership_transferred_zone", suffix=self.tld_name)
- zone = self.prm_zone_client.create_zone(name=zone_name,
- wait_until='ACTIVE')[1]
+ zone = self.zones_client.create_zone(name=zone_name,
+ wait_until='ACTIVE')[1]
self.addCleanup(
self.wait_zone_delete, self.admin_zone_client, zone['id'],
headers=self.all_projects_header,
@@ -248,8 +247,8 @@
LOG.info('Create a Primary zone')
zone_name = dns_data_utils.rand_zone_name(
name="list_transfer_accepts", suffix=self.tld_name)
- zone = self.prm_zone_client.create_zone(name=zone_name,
- wait_until='ACTIVE')[1]
+ zone = self.zones_client.create_zone(name=zone_name,
+ wait_until='ACTIVE')[1]
self.addCleanup(
self.wait_zone_delete, self.admin_zone_client, zone['id'],
headers=self.all_projects_header,
@@ -353,8 +352,8 @@
LOG.info('Create a zone as primary tenant')
zone_name = dns_data_utils.rand_zone_name(
name="show_transfer_accept_impersonate", suffix=self.tld_name)
- zone = self.prm_zone_client.create_zone(name=zone_name,
- wait_until='ACTIVE')[1]
+ zone = self.zones_client.create_zone(name=zone_name,
+ wait_until='ACTIVE')[1]
# In case when something goes wrong with the test and E2E
# scenario fails for some reason, we'll use Admin tenant
@@ -427,7 +426,6 @@
@classmethod
def setup_clients(cls):
super(TransferAcceptTestNegative, cls).setup_clients()
- cls.zone_client = cls.os_primary.dns_v2.ZonesClient()
cls.request_client = cls.os_primary.dns_v2.TransferRequestClient()
cls.client = cls.os_primary.dns_v2.TransferAcceptClient()
@@ -436,9 +434,9 @@
LOG.info('Create a zone')
zone_name = dns_data_utils.rand_zone_name(
name="create_transfer_accept_invalid_key", suffix=self.tld_name)
- zone = self.zone_client.create_zone(name=zone_name,
- wait_until='ACTIVE')[1]
- self.addCleanup(self.wait_zone_delete, self.zone_client, zone['id'])
+ zone = self.zones_client.create_zone(name=zone_name,
+ wait_until='ACTIVE')[1]
+ self.addCleanup(self.wait_zone_delete, self.zones_client, zone['id'])
LOG.info('Create a zone transfer_request')
transfer_request = self.request_client.create_transfer_request(
@@ -463,9 +461,9 @@
LOG.info('Create a zone')
zone_name = dns_data_utils.rand_zone_name(
name="create_transfer_accept_deleted_id", suffix=self.tld_name)
- zone = self.zone_client.create_zone(name=zone_name,
- wait_until='ACTIVE')[1]
- self.addCleanup(self.wait_zone_delete, self.zone_client, zone['id'])
+ zone = self.zones_client.create_zone(name=zone_name,
+ wait_until='ACTIVE')[1]
+ self.addCleanup(self.wait_zone_delete, self.zones_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 caf1876..d7dfd2a 100644
--- a/designate_tempest_plugin/tests/api/v2/test_transfer_request.py
+++ b/designate_tempest_plugin/tests/api/v2/test_transfer_request.py
@@ -71,7 +71,6 @@
TransferRequestClient())
else:
cls.admin_client = cls.os_admin.dns_v2.TransferRequestClient()
- cls.zone_client = cls.os_primary.dns_v2.ZonesClient()
cls.alt_zone_client = cls.os_alt.dns_v2.ZonesClient()
cls.client = cls.os_primary.dns_v2.TransferRequestClient()
cls.alt_client = cls.os_alt.dns_v2.TransferRequestClient()
@@ -81,8 +80,8 @@
LOG.info('Create a zone')
zone_name = dns_data_utils.rand_zone_name(
name="create_transfer_request", suffix=self.tld_name)
- zone = self.zone_client.create_zone(name=zone_name)[1]
- self.addCleanup(self.wait_zone_delete, self.zone_client, zone['id'])
+ zone = self.zones_client.create_zone(name=zone_name)[1]
+ self.addCleanup(self.wait_zone_delete, self.zones_client, zone['id'])
# Test RBAC
expected_allowed = ['os_admin', 'os_primary', 'os_alt']
@@ -107,8 +106,8 @@
LOG.info('Create a zone')
zone_name = dns_data_utils.rand_zone_name(
name="create_transfer_request_scoped", suffix=self.tld_name)
- zone = self.zone_client.create_zone(name=zone_name)[1]
- self.addCleanup(self.wait_zone_delete, self.zone_client, zone['id'])
+ zone = self.zones_client.create_zone(name=zone_name)[1]
+ self.addCleanup(self.wait_zone_delete, self.zones_client, zone['id'])
transfer_request_data = dns_data_utils.rand_transfer_request_data(
target_project_id=self.os_alt.credentials.project_id)
@@ -127,8 +126,8 @@
LOG.info('Create a zone')
zone_name = dns_data_utils.rand_zone_name(
name="create_transfer_request_empty", suffix=self.tld_name)
- zone = self.zone_client.create_zone(name=zone_name)[1]
- self.addCleanup(self.wait_zone_delete, self.zone_client, zone['id'])
+ zone = self.zones_client.create_zone(name=zone_name)[1]
+ self.addCleanup(self.wait_zone_delete, self.zones_client, zone['id'])
LOG.info('Create a zone transfer_request')
transfer_request = self.client.create_transfer_request_empty_body(
zone['id'])[1]
@@ -143,8 +142,8 @@
LOG.info('Create a zone')
zone_name = dns_data_utils.rand_zone_name(
name="show_transfer_request", suffix=self.tld_name)
- zone = self.zone_client.create_zone(name=zone_name)[1]
- self.addCleanup(self.wait_zone_delete, self.zone_client, zone['id'])
+ zone = self.zones_client.create_zone(name=zone_name)[1]
+ self.addCleanup(self.wait_zone_delete, self.zones_client, zone['id'])
LOG.info('Create a zone transfer_request')
transfer_request = self.client.create_transfer_request(zone['id'])[1]
@@ -194,8 +193,8 @@
LOG.info('Create a zone')
zone_name = dns_data_utils.rand_zone_name(
name="show_transfer_request_impersonate", suffix=self.tld_name)
- zone = self.zone_client.create_zone(name=zone_name)[1]
- self.addCleanup(self.wait_zone_delete, self.zone_client, zone['id'])
+ zone = self.zones_client.create_zone(name=zone_name)[1]
+ self.addCleanup(self.wait_zone_delete, self.zones_client, zone['id'])
LOG.info('Create a zone transfer_request')
transfer_request = self.client.create_transfer_request(zone['id'])[1]
@@ -225,8 +224,8 @@
LOG.info('Create a zone')
zone_name = dns_data_utils.rand_zone_name(
name="create_transfer_request_as_target", suffix=self.tld_name)
- zone = self.zone_client.create_zone(name=zone_name)[1]
- self.addCleanup(self.wait_zone_delete, self.zone_client, zone['id'])
+ zone = self.zones_client.create_zone(name=zone_name)[1]
+ self.addCleanup(self.wait_zone_delete, self.zones_client, zone['id'])
transfer_request_data = dns_data_utils.rand_transfer_request_data(
target_project_id=self.os_alt.credentials.project_id)
@@ -264,8 +263,8 @@
LOG.info('Create a zone')
zone_name = dns_data_utils.rand_zone_name(
name="delete_transfer_request", suffix=self.tld_name)
- zone = self.zone_client.create_zone(name=zone_name)[1]
- self.addCleanup(self.wait_zone_delete, self.zone_client, zone['id'])
+ zone = self.zones_client.create_zone(name=zone_name)[1]
+ self.addCleanup(self.wait_zone_delete, self.zones_client, zone['id'])
LOG.info('Create a transfer_request')
transfer_request = self.client.create_transfer_request(zone['id'])[1]
@@ -293,8 +292,8 @@
LOG.info('Create a zone')
zone_name = dns_data_utils.rand_zone_name(
name="list_transfer_request", suffix=self.tld_name)
- zone = self.zone_client.create_zone(name=zone_name)[1]
- self.addCleanup(self.wait_zone_delete, self.zone_client, zone['id'])
+ zone = self.zones_client.create_zone(name=zone_name)[1]
+ self.addCleanup(self.wait_zone_delete, self.zones_client, zone['id'])
LOG.info('Create a zone transfer_request')
transfer_request = self.client.create_transfer_request(zone['id'])[1]
@@ -333,9 +332,9 @@
LOG.info('Create a Primary zone')
zone_name = dns_data_utils.rand_zone_name(
name="list_transfer_request_all_projects", suffix=self.tld_name)
- primary_zone = self.zone_client.create_zone(name=zone_name)[1]
+ primary_zone = self.zones_client.create_zone(name=zone_name)[1]
self.addCleanup(self.wait_zone_delete,
- self.zone_client, primary_zone['id'])
+ self.zones_client, primary_zone['id'])
LOG.info('Create an Alt zone')
alt_zone_name = dns_data_utils.rand_zone_name(
@@ -395,9 +394,9 @@
LOG.info('Create a Primary zone')
zone_name = dns_data_utils.rand_zone_name(
name="list_transfer_request_impersonate", suffix=self.tld_name)
- primary_zone = self.zone_client.create_zone(name=zone_name)[1]
+ primary_zone = self.zones_client.create_zone(name=zone_name)[1]
self.addCleanup(self.wait_zone_delete,
- self.zone_client, primary_zone['id'])
+ self.zones_client, primary_zone['id'])
LOG.info('Create an Alt zone')
alt_zone_name = dns_data_utils.rand_zone_name(
@@ -441,8 +440,8 @@
LOG.info('Create a zone')
zone_name = dns_data_utils.rand_zone_name(
name="update_transfer_request", suffix=self.tld_name)
- zone = self.zone_client.create_zone(name=zone_name)[1]
- self.addCleanup(self.wait_zone_delete, self.zone_client, zone['id'])
+ zone = self.zones_client.create_zone(name=zone_name)[1]
+ self.addCleanup(self.wait_zone_delete, self.zones_client, zone['id'])
LOG.info('Create a zone transfer_request')
transfer_request = self.client.create_transfer_request(zone['id'])[1]
diff --git a/designate_tempest_plugin/tests/api/v2/test_tsigkey.py b/designate_tempest_plugin/tests/api/v2/test_tsigkey.py
index 95a4e21..6ceeaca 100644
--- a/designate_tempest_plugin/tests/api/v2/test_tsigkey.py
+++ b/designate_tempest_plugin/tests/api/v2/test_tsigkey.py
@@ -72,7 +72,6 @@
cls.admin_client = cls.os_admin.dns_v2.TsigkeyClient()
cls.pool_admin_client = cls.os_admin.dns_v2.PoolClient()
- cls.zone_client = cls.os_primary.dns_v2.ZonesClient()
cls.primary_client = cls.os_primary.dns_v2.TsigkeyClient()
@decorators.idempotent_id('e7b484e3-7ed5-4840-89d7-1e696986f8e4')
@@ -80,8 +79,8 @@
LOG.info('Create a resource')
zone_name = dns_data_utils.rand_zone_name(
name="create_tsigkey_for_zone", suffix=self.tld_name)
- zone = self.zone_client.create_zone(name=zone_name)[1]
- self.addCleanup(self.wait_zone_delete, self.zone_client, zone['id'])
+ zone = self.zones_client.create_zone(name=zone_name)[1]
+ self.addCleanup(self.wait_zone_delete, self.zones_client, zone['id'])
tsigkey_data = {
"name": dns_data_utils.rand_zone_name(
@@ -137,8 +136,8 @@
LOG.info('Create a resource')
zone_name = dns_data_utils.rand_zone_name(
name="list_tsigkey", suffix=self.tld_name)
- zone = self.zone_client.create_zone(name=zone_name)[1]
- self.addCleanup(self.wait_zone_delete, self.zone_client, zone['id'])
+ zone = self.zones_client.create_zone(name=zone_name)[1]
+ self.addCleanup(self.wait_zone_delete, self.zones_client, zone['id'])
LOG.info('Create a tsigkey')
tsigkey = self.admin_client.create_tsigkey(resource_id=zone['id'])[1]
self.addCleanup(self.admin_client.delete_tsigkey, tsigkey['id'])
@@ -159,9 +158,9 @@
LOG.info('As Primary user create a zone: {} '.format(i))
zone_name = dns_data_utils.rand_zone_name(
name="list_tsigkey_limit", suffix=self.tld_name)
- zone = self.zone_client.create_zone(name=zone_name)[1]
+ zone = self.zones_client.create_zone(name=zone_name)[1]
self.addCleanup(
- self.wait_zone_delete, self.zone_client, zone['id'])
+ self.wait_zone_delete, self.zones_client, zone['id'])
LOG.info('As Admin user create a tsigkey: {} '.format(i))
tsigkey = self.admin_client.create_tsigkey(
resource_id=zone['id'])[1]
@@ -183,9 +182,9 @@
'for {}'.format(name))
zone_name = dns_data_utils.rand_zone_name(
name="list_tsigkey_marker", suffix=self.tld_name)
- zone = self.zone_client.create_zone(name=zone_name)[1]
+ zone = self.zones_client.create_zone(name=zone_name)[1]
self.addCleanup(
- self.wait_zone_delete, self.zone_client, zone['id'])
+ self.wait_zone_delete, self.zones_client, zone['id'])
LOG.info('As Admin user create "{}" tsigkey'.format(name))
tsigkey = self.admin_client.create_tsigkey(
resource_id=zone['id'], name=name)[1]
@@ -233,9 +232,9 @@
LOG.info('As Primary user create a zone for: {} '.format(name))
zone_name = dns_data_utils.rand_zone_name(
name="list_tsigkey_sort", suffix=self.tld_name)
- zone = self.zone_client.create_zone(name=zone_name)[1]
+ zone = self.zones_client.create_zone(name=zone_name)[1]
self.addCleanup(
- self.wait_zone_delete, self.zone_client, zone['id'])
+ self.wait_zone_delete, self.zones_client, zone['id'])
LOG.info('As Admin user create a tsigkey: {} '.format(name))
tsigkey = self.admin_client.create_tsigkey(
resource_id=zone['id'], name=name)[1]
@@ -289,8 +288,8 @@
LOG.info('As Primary user create a zone for: {} '.format(tsigkey_name))
zone_name = dns_data_utils.rand_zone_name(
name="list_tsigkey_filter_name", suffix=self.tld_name)
- zone = self.zone_client.create_zone(name=zone_name)[1]
- self.addCleanup(self.wait_zone_delete, self.zone_client, zone['id'])
+ zone = self.zones_client.create_zone(name=zone_name)[1]
+ self.addCleanup(self.wait_zone_delete, self.zones_client, zone['id'])
LOG.info('As Admin user create a tsigkey: {} '.format(tsigkey_name))
tsigkey = self.admin_client.create_tsigkey(
resource_id=zone['id'], name=tsigkey_name)[1]
@@ -328,8 +327,8 @@
LOG.info('Create tsigkey for a zone')
zone_name = dns_data_utils.rand_zone_name(
name="list_tsigkey_filter_scope", suffix=self.tld_name)
- zone = self.zone_client.create_zone(name=zone_name)[1]
- self.addCleanup(self.wait_zone_delete, self.zone_client, zone['id'])
+ zone = self.zones_client.create_zone(name=zone_name)[1]
+ self.addCleanup(self.wait_zone_delete, self.zones_client, zone['id'])
zone_tsigkey = self.admin_client.create_tsigkey(
resource_id=zone['id'], scope='ZONE')[1]
self.addCleanup(self.admin_client.delete_tsigkey, zone_tsigkey['id'])
@@ -396,8 +395,8 @@
LOG.info('Create a resource')
zone_name = dns_data_utils.rand_zone_name(
name="show_tsigkey", suffix=self.tld_name)
- zone = self.zone_client.create_zone(name=zone_name)[1]
- self.addCleanup(self.wait_zone_delete, self.zone_client, zone['id'])
+ zone = self.zones_client.create_zone(name=zone_name)[1]
+ self.addCleanup(self.wait_zone_delete, self.zones_client, zone['id'])
LOG.info('Create a tsigkey')
tsigkey = self.admin_client.create_tsigkey(resource_id=zone['id'])[1]
@@ -423,8 +422,8 @@
LOG.info('Create a resource')
zone_name = dns_data_utils.rand_zone_name(
name="update_tsigkey", suffix=self.tld_name)
- zone = self.zone_client.create_zone(name=zone_name)[1]
- self.addCleanup(self.wait_zone_delete, self.zone_client, zone['id'])
+ zone = self.zones_client.create_zone(name=zone_name)[1]
+ self.addCleanup(self.wait_zone_delete, self.zones_client, zone['id'])
LOG.info('Create a tsigkey')
tsigkey = self.admin_client.create_tsigkey(resource_id=zone['id'])[1]
@@ -457,8 +456,8 @@
LOG.info('Create a resource')
zone_name = dns_data_utils.rand_zone_name(
name="delete_tsigkey", suffix=self.tld_name)
- zone = self.zone_client.create_zone(name=zone_name)[1]
- self.addCleanup(self.wait_zone_delete, self.zone_client, zone['id'])
+ zone = self.zones_client.create_zone(name=zone_name)[1]
+ self.addCleanup(self.wait_zone_delete, self.zones_client, zone['id'])
LOG.info('Create a tsigkey')
tsigkey = self.admin_client.create_tsigkey(resource_id=zone['id'])[1]
@@ -488,7 +487,7 @@
class TestTsigkeyNotFoundAdmin(BaseTsigkeyTest):
- credentials = ["admin", "system_admin"]
+ credentials = ["admin", "system_admin", "primary"]
@classmethod
def setup_credentials(cls):
@@ -551,7 +550,6 @@
else:
cls.admin_client = cls.os_admin.dns_v2.TsigkeyClient()
cls.pool_admin_client = cls.os_admin.dns_v2.PoolClient()
- cls.zone_client = cls.os_primary.dns_v2.ZonesClient()
@decorators.idempotent_id('2a8dfc75-9884-4b1c-8f1f-ed835d96f2fe')
def test_show_tsigkey_invalid_uuid(self):
@@ -585,8 +583,8 @@
def test_create_tsigkey_for_zone_invalid_algorithm(self):
zone_name = dns_data_utils.rand_zone_name(
name="create_tsigkey_invalid_algo", suffix=self.tld_name)
- zone = self.zone_client.create_zone(name=zone_name)[1]
- self.addCleanup(self.wait_zone_delete, self.zone_client, zone['id'])
+ zone = self.zones_client.create_zone(name=zone_name)[1]
+ self.addCleanup(self.wait_zone_delete, self.zones_client, zone['id'])
tsigkey_data = {
"name": dns_data_utils.rand_zone_name('Example_Key'),
"algorithm": "zababun",
@@ -605,8 +603,8 @@
LOG.info('Create a zone resource')
zone_name = dns_data_utils.rand_zone_name(
name="create_tsigkey_invalid_name", suffix=self.tld_name)
- zone = self.zone_client.create_zone(name=zone_name)[1]
- self.addCleanup(self.wait_zone_delete, self.zone_client, zone['id'])
+ zone = self.zones_client.create_zone(name=zone_name)[1]
+ self.addCleanup(self.wait_zone_delete, self.zones_client, zone['id'])
tsigkey_data = {
"name": dns_data_utils.rand_zone_name(
'Example_Key') * 1000,
@@ -627,8 +625,8 @@
LOG.info('Create a zone resource')
zone_name = dns_data_utils.rand_zone_name(
name="create_tsigkey_empty_secret", suffix=self.tld_name)
- zone = self.zone_client.create_zone(name=zone_name)[1]
- self.addCleanup(self.wait_zone_delete, self.zone_client, zone['id'])
+ zone = self.zones_client.create_zone(name=zone_name)[1]
+ self.addCleanup(self.wait_zone_delete, self.zones_client, zone['id'])
tsigkey_data = {
"name": dns_data_utils.rand_zone_name('Example_Key'),
"algorithm": "hmac-sha256",
@@ -647,8 +645,8 @@
LOG.info('Create a zone resource')
zone_name = dns_data_utils.rand_zone_name(
name="create_tsigkey_invalid_scope", suffix=self.tld_name)
- zone = self.zone_client.create_zone(name=zone_name)[1]
- self.addCleanup(self.wait_zone_delete, self.zone_client, zone['id'])
+ zone = self.zones_client.create_zone(name=zone_name)[1]
+ self.addCleanup(self.wait_zone_delete, self.zones_client, zone['id'])
tsigkey_data = {
"name": dns_data_utils.rand_zone_name('Example_Key'),
"algorithm": "hmac-sha256",
@@ -667,8 +665,8 @@
LOG.info('Create a resource')
zone_name = dns_data_utils.rand_zone_name(
name="create_tsigkey_invalide_zone_id", suffix=self.tld_name)
- zone = self.zone_client.create_zone(name=zone_name)[1]
- self.addCleanup(self.wait_zone_delete, self.zone_client, zone['id'])
+ zone = self.zones_client.create_zone(name=zone_name)[1]
+ self.addCleanup(self.wait_zone_delete, self.zones_client, zone['id'])
tsigkey_data = {
"name": dns_data_utils.rand_zone_name('Example_Key'),
"algorithm": "hmac-sha256",
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 678eb29..4523c53 100644
--- a/designate_tempest_plugin/tests/api/v2/test_zone_tasks.py
+++ b/designate_tempest_plugin/tests/api/v2/test_zone_tasks.py
@@ -76,7 +76,6 @@
cls.admin_client = cls.os_system_admin.dns_v2.ZonesClient()
else:
cls.admin_client = cls.os_admin.dns_v2.ZonesClient()
- cls.client = cls.os_primary.dns_v2.ZonesClient()
cls.alt_client = cls.os_alt.dns_v2.ZonesClient()
@decorators.idempotent_id('287e2cd0-a0e7-11eb-b962-74e5f9e2a801')
@@ -87,16 +86,18 @@
LOG.info('Create a PRIMARY zone')
zone_name = dns_data_utils.rand_zone_name(
name="zone_abandon", suffix=self.tld_name)
- pr_zone = self.client.create_zone(name=zone_name)[1]
- self.addCleanup(self.wait_zone_delete, self.client, pr_zone['id'])
- waiters.wait_for_zone_status(self.client, pr_zone['id'], 'ACTIVE')
+ pr_zone = self.zones_client.create_zone(name=zone_name)[1]
+ self.addCleanup(self.wait_zone_delete, self.zones_client,
+ pr_zone['id'])
+ waiters.wait_for_zone_status(self.zones_client, pr_zone['id'],
+ 'ACTIVE')
LOG.info('Ensure we respond with CREATE+PENDING')
self.assertEqual('CREATE', pr_zone['action'])
self.assertEqual('PENDING', pr_zone['status'])
LOG.info('Fetch the zone')
- self.client.show_zone(pr_zone['id'])
+ self.zones_client.show_zone(pr_zone['id'])
LOG.info('Check that the zone was created on Nameserver/BIND')
waiters.wait_for_query(self.query_client, pr_zone['name'], "SOA")
@@ -118,7 +119,7 @@
headers={'x-auth-sudo-project-id': pr_zone['project_id']})
LOG.info('Wait for the zone to become 404/NotFound in Designate')
- waiters.wait_for_zone_404(self.client, pr_zone['id'])
+ waiters.wait_for_zone_404(self.zones_client, pr_zone['id'])
LOG.info('Check that the zone is still exists in Nameserver/BIND')
waiters.wait_for_query(
@@ -133,16 +134,18 @@
LOG.info('Create a PRIMARY zone and add to the cleanup')
zone_name = dns_data_utils.rand_zone_name(
name="zone_abandon_forbidden", suffix=self.tld_name)
- pr_zone = self.client.create_zone(name=zone_name)[1]
- self.addCleanup(self.wait_zone_delete, self.client, pr_zone['id'])
- waiters.wait_for_zone_status(self.client, pr_zone['id'], 'ACTIVE')
+ pr_zone = self.zones_client.create_zone(name=zone_name)[1]
+ self.addCleanup(self.wait_zone_delete, self.zones_client,
+ pr_zone['id'])
+ waiters.wait_for_zone_status(self.zones_client, pr_zone['id'],
+ 'ACTIVE')
LOG.info('Ensure we respond with CREATE+PENDING')
self.assertEqual('CREATE', pr_zone['action'])
self.assertEqual('PENDING', pr_zone['status'])
LOG.info('Fetch the zone')
- self.client.show_zone(pr_zone['id'])
+ self.zones_client.show_zone(pr_zone['id'])
LOG.info('Check that the zone was created on Nameserver/BIND')
waiters.wait_for_query(self.query_client, pr_zone['name'], "SOA")
@@ -150,7 +153,7 @@
LOG.info('Abandon a zone as primary client, Expected: should '
'fail with: 403 forbidden')
self.assertRaises(
- lib_exc.Forbidden, self.client.abandon_zone,
+ lib_exc.Forbidden, self.zones_client.abandon_zone,
zone_id=pr_zone['id'])
@@ -170,7 +173,6 @@
cls.admin_client = cls.os_system_admin.dns_v2.ZonesClient()
else:
cls.admin_client = cls.os_admin.dns_v2.ZonesClient()
- cls.client = cls.os_primary.dns_v2.ZonesClient()
cls.alt_client = cls.os_alt.dns_v2.ZonesClient()
def _query_nameserver(self, nameserver, query_timeout,
diff --git a/designate_tempest_plugin/tests/api/v2/test_zones.py b/designate_tempest_plugin/tests/api/v2/test_zones.py
index 3ab2601..aa7edd8 100644
--- a/designate_tempest_plugin/tests/api/v2/test_zones.py
+++ b/designate_tempest_plugin/tests/api/v2/test_zones.py
@@ -71,7 +71,6 @@
cls.pool_client = cls.os_system_admin.dns_v2.PoolClient()
else:
cls.pool_client = cls.os_admin.dns_v2.PoolClient()
- cls.client = cls.os_primary.dns_v2.ZonesClient()
cls.recordset_client = cls.os_primary.dns_v2.RecordsetClient()
@decorators.idempotent_id('9d2e20fc-e56f-4a62-9c61-9752a9ec615c')
@@ -80,25 +79,25 @@
LOG.info('Create a PRIMARY zone')
zone_name = dns_data_utils.rand_zone_name(
name="create_zones_primary", suffix=self.tld_name)
- zone = self.client.create_zone(name=zone_name)[1]
- self.addCleanup(self.wait_zone_delete, self.client, zone['id'])
+ zone = self.zones_client.create_zone(name=zone_name)[1]
+ self.addCleanup(self.wait_zone_delete, self.zones_client, zone['id'])
LOG.info('Ensure we respond with CREATE+PENDING')
self.assertEqual(const.CREATE, zone['action'])
self.assertEqual(const.PENDING, zone['status'])
# Get the Name Servers (hosts) created in PRIMARY zone
- nameservers = self.client.show_zone_nameservers(zone['id'])[1]
+ nameservers = self.zones_client.show_zone_nameservers(zone['id'])[1]
nameservers = [dic['hostname'] for dic in nameservers['nameservers']]
# Create a SECONDARY zone
LOG.info('Create a SECONDARY zone')
zone_name = dns_data_utils.rand_zone_name(
name="create_zones_secondary", suffix=self.tld_name)
- zone = self.client.create_zone(
+ zone = self.zones_client.create_zone(
name=zone_name, zone_type=const.SECONDARY_ZONE_TYPE,
primaries=nameservers)[1]
- self.addCleanup(self.wait_zone_delete, self.client, zone['id'])
+ self.addCleanup(self.wait_zone_delete, self.zones_client, zone['id'])
LOG.info('Ensure we respond with CREATE+PENDING')
self.assertEqual(const.CREATE, zone['action'])
@@ -120,7 +119,7 @@
self.check_CUD_RBAC_enforcement(
'ZonesClient', 'create_zone', expected_allowed, False,
- project_id=self.client.project_id)
+ project_id=self.zones_client.project_id)
@decorators.idempotent_id('ec150c22-f52e-11eb-b09b-74e5f9e2a801')
def test_create_zone_validate_recordsets_created(self):
@@ -128,9 +127,9 @@
LOG.info('Create a PRIMARY zone')
zone_name = dns_data_utils.rand_zone_name(
name="create_zone_validate_recordsets", suffix=self.tld_name)
- zone = self.client.create_zone(name=zone_name,
+ zone = self.zones_client.create_zone(name=zone_name,
wait_until=const.ACTIVE)[1]
- self.addCleanup(self.wait_zone_delete, self.client, zone['id'])
+ self.addCleanup(self.wait_zone_delete, self.zones_client, zone['id'])
LOG.info('Ensure we respond with CREATE+PENDING')
self.assertEqual(const.CREATE, zone['action'])
@@ -152,11 +151,11 @@
LOG.info('Create a zone')
zone_name = dns_data_utils.rand_zone_name(
name="show_zones", suffix=self.tld_name)
- zone = self.client.create_zone(name=zone_name)[1]
- self.addCleanup(self.wait_zone_delete, self.client, zone['id'])
+ zone = self.zones_client.create_zone(name=zone_name)[1]
+ self.addCleanup(self.wait_zone_delete, self.zones_client, zone['id'])
LOG.info('Fetch the zone')
- body = self.client.show_zone(zone['id'])[1]
+ body = self.zones_client.show_zone(zone['id'])[1]
LOG.info('Ensure the fetched response matches the created zone')
self.assertExpected(zone, body, self.excluded_keys)
@@ -180,7 +179,7 @@
headers=self.all_projects_header)
self.check_list_show_RBAC_enforcement(
'ZonesClient', 'show_zone', expected_allowed, False, zone['id'],
- headers={'x-auth-sudo-project-id': self.client.project_id})
+ headers={'x-auth-sudo-project-id': self.zones_client.project_id})
@decorators.attr(type='smoke')
@decorators.idempotent_id('a4791906-6cd6-4d27-9f15-32273db8bb3d')
@@ -188,8 +187,8 @@
LOG.info('Create a zone')
zone_name = dns_data_utils.rand_zone_name(
name="delete_zones", suffix=self.tld_name)
- zone = self.client.create_zone(name=zone_name)[1]
- self.addCleanup(self.wait_zone_delete, self.client, zone['id'],
+ zone = self.zones_client.create_zone(name=zone_name)[1]
+ self.addCleanup(self.wait_zone_delete, self.zones_client, zone['id'],
ignore_errors=lib_exc.NotFound)
# Test RBAC
@@ -210,10 +209,10 @@
headers=self.all_projects_header)
self.check_CUD_RBAC_enforcement(
'ZonesClient', 'delete_zone', expected_allowed, False, zone['id'],
- headers={'x-auth-sudo-project-id': self.client.project_id})
+ headers={'x-auth-sudo-project-id': self.zones_client.project_id})
LOG.info('Delete the zone')
- body = self.client.delete_zone(zone['id'])[1]
+ body = self.zones_client.delete_zone(zone['id'])[1]
LOG.info('Ensure we respond with DELETE+PENDING')
self.assertEqual(const.DELETE, body['action'])
@@ -224,11 +223,11 @@
LOG.info('Create a zone')
zone_name = dns_data_utils.rand_zone_name(
name="list_zones", suffix=self.tld_name)
- zone = self.client.create_zone(name=zone_name)[1]
- self.addCleanup(self.wait_zone_delete, self.client, zone['id'])
+ zone = self.zones_client.create_zone(name=zone_name)[1]
+ self.addCleanup(self.wait_zone_delete, self.zones_client, zone['id'])
LOG.info('List zones')
- body = self.client.list_zones()[1]
+ body = self.zones_client.list_zones()[1]
# TODO(kiall): We really want to assert that out newly created zone is
# present in the response.
@@ -265,21 +264,21 @@
headers=self.all_projects_header)
self.check_list_IDs_RBAC_enforcement(
'ZonesClient', 'list_zones', expected_allowed, [zone['id']],
- headers={'x-auth-sudo-project-id': self.client.project_id})
+ headers={'x-auth-sudo-project-id': self.zones_client.project_id})
@decorators.idempotent_id('123f51cb-19d5-48a9-aacc-476742c02141')
def test_update_zone(self):
LOG.info('Create a zone')
zone_name = dns_data_utils.rand_zone_name(
name="update_zone", suffix=self.tld_name)
- zone = self.client.create_zone(name=zone_name)[1]
- self.addCleanup(self.wait_zone_delete, self.client, zone['id'])
+ zone = self.zones_client.create_zone(name=zone_name)[1]
+ self.addCleanup(self.wait_zone_delete, self.zones_client, zone['id'])
# Generate a random description
description = data_utils.rand_name()
LOG.info('Update the zone')
- zone = self.client.update_zone(
+ zone = self.zones_client.update_zone(
zone['id'], description=description)[1]
LOG.info('Ensure we respond with UPDATE+PENDING')
@@ -310,7 +309,7 @@
self.check_CUD_RBAC_enforcement(
'ZonesClient', 'update_zone', expected_allowed, False,
zone['id'], description=description,
- headers={'x-auth-sudo-project-id': self.client.project_id})
+ headers={'x-auth-sudo-project-id': self.zones_client.project_id})
@decorators.idempotent_id('3acddc86-62cc-4bfa-8589-b99e5d239bf2')
@decorators.skip_because(bug="1960487")
@@ -318,12 +317,12 @@
LOG.info('Create a zone')
zone_name = dns_data_utils.rand_zone_name(
name="serial_changes_on_update", suffix=self.tld_name)
- zone = self.client.create_zone(name=zone_name,
+ zone = self.zones_client.create_zone(name=zone_name,
wait_until=const.ACTIVE)[1]
- self.addCleanup(self.wait_zone_delete, self.client, zone['id'])
+ self.addCleanup(self.wait_zone_delete, self.zones_client, zone['id'])
LOG.info("Update Zone's email")
- update_email = self.client.update_zone(
+ update_email = self.zones_client.update_zone(
zone['id'], email=dns_data_utils.rand_email())[1]
self.assertNotEqual(
zone['serial'], update_email['serial'],
@@ -331,7 +330,7 @@
"on Email update.")
LOG.info("Update Zone's TTL")
- update_ttl = self.client.update_zone(
+ update_ttl = self.zones_client.update_zone(
zone['id'], ttl=dns_data_utils.rand_ttl())[1]
self.assertNotEqual(
update_email['serial'], update_ttl['serial'],
@@ -339,7 +338,7 @@
"on TTL update.")
LOG.info("Update Zone's email and description")
- update_email_description = self.client.update_zone(
+ update_email_description = self.zones_client.update_zone(
zone['id'],
email=dns_data_utils.rand_email(),
description=data_utils.rand_name())[1]
@@ -349,7 +348,7 @@
"when the Email and Description are updated")
LOG.info("Update Zone's description")
- update_description = self.client.update_zone(
+ update_description = self.zones_client.update_zone(
zone['id'], description=data_utils.rand_name())[1]
self.assertEqual(
update_email_description['serial'], update_description['serial'],
@@ -362,12 +361,13 @@
LOG.info('Create a zone')
zone_name = dns_data_utils.rand_zone_name(
name="get_primary_nameservers", suffix=self.tld_name)
- zone = self.client.create_zone(name=zone_name)[1]
- self.addCleanup(self.wait_zone_delete, self.client, zone['id'])
+ zone = self.zones_client.create_zone(name=zone_name)[1]
+ self.addCleanup(self.wait_zone_delete, self.zones_client, zone['id'])
zone_pool_id = zone['pool_id']
# Get zone's Name Servers using dedicated API request
- zone_nameservers = self.client.show_zone_nameservers(zone['id'])[1]
+ zone_nameservers = self.zones_client.show_zone_nameservers(
+ zone['id'])[1]
zone_nameservers = zone_nameservers['nameservers']
LOG.info('Zone Name Servers are: {}'.format(zone_nameservers))
self.assertIsNot(
@@ -405,22 +405,22 @@
self.check_list_show_RBAC_enforcement(
'ZonesClient', 'show_zone_nameservers', expected_allowed,
False, zone['id'],
- headers={'x-auth-sudo-project-id': self.client.project_id})
+ headers={'x-auth-sudo-project-id': self.zones_client.project_id})
@decorators.idempotent_id('9970b632-f2db-11ec-a757-201e8823901f')
def test_create_zone_ttl_zero(self):
LOG.info('Create a PRIMARY zone')
zone_name = dns_data_utils.rand_zone_name(
name="test_create_zone_ttl_zero", suffix=self.tld_name)
- zone = self.client.create_zone(name=zone_name, ttl=0)[1]
- self.addCleanup(self.wait_zone_delete, self.client, zone['id'])
+ zone = self.zones_client.create_zone(name=zone_name, ttl=0)[1]
+ self.addCleanup(self.wait_zone_delete, self.zones_client, zone['id'])
LOG.info('Ensure we respond with CREATE+PENDING')
self.assertEqual(const.CREATE, zone['action'])
self.assertEqual(const.PENDING, zone['status'])
LOG.info('Fetch the zone, ensure TTL is Zero')
- body = self.client.show_zone(zone['id'])[1]
+ body = self.zones_client.show_zone(zone['id'])[1]
self.assertEqual(
0, body['ttl'],
"Failed, actual Zone's TTL:{} "
@@ -443,7 +443,6 @@
cls.admin_client = cls.os_system_admin.dns_v2.ZonesClient()
else:
cls.admin_client = cls.os_admin.dns_v2.ZonesClient()
- cls.client = cls.os_primary.dns_v2.ZonesClient()
cls.alt_client = cls.os_alt.dns_v2.ZonesClient()
@decorators.idempotent_id('f6fe8cce-8b04-11eb-a861-74e5f9e2a801')
@@ -451,8 +450,8 @@
LOG.info('Create zone "A" using primary client')
zone_name = dns_data_utils.rand_zone_name(
name="show_zone_impersonate", suffix=self.tld_name)
- zone = self.client.create_zone(name=zone_name)[1]
- self.addCleanup(self.wait_zone_delete, self.client, zone['id'])
+ zone = self.zones_client.create_zone(name=zone_name)[1]
+ self.addCleanup(self.wait_zone_delete, self.zones_client, zone['id'])
LOG.info('As Alt tenant show zone created by Primary tenant. '
'Expected: 404 NotFound')
@@ -488,10 +487,10 @@
LOG.info('Create zone "A" using Primary client')
zone_name = dns_data_utils.rand_zone_name(
name="list_zone_all_projects_A", suffix=self.tld_name)
- primary_zone = self.client.create_zone(name=zone_name,
+ primary_zone = self.zones_client.create_zone(name=zone_name,
wait_until=const.ACTIVE)[1]
self.addCleanup(
- self.wait_zone_delete, self.client, primary_zone['id'])
+ self.wait_zone_delete, self.zones_client, primary_zone['id'])
LOG.info('Create zone "B" using Alt client')
zone_name = dns_data_utils.rand_zone_name(
@@ -542,7 +541,6 @@
@classmethod
def setup_clients(cls):
super(ZoneOwnershipTest, cls).setup_clients()
- cls.client = cls.os_primary.dns_v2.ZonesClient()
cls.alt_client = cls.os_alt.dns_v2.ZonesClient()
@decorators.idempotent_id('5d28580a-a012-4b57-b211-e077b1a01340')
@@ -550,12 +548,12 @@
LOG.info('Create a zone as a default user')
zone_name = dns_data_utils.rand_zone_name(
name="no_create_duplicate", suffix=self.tld_name)
- zone = self.client.create_zone(name=zone_name)[1]
- self.addCleanup(self.wait_zone_delete, self.client, zone['id'])
+ zone = self.zones_client.create_zone(name=zone_name)[1]
+ self.addCleanup(self.wait_zone_delete, self.zones_client, zone['id'])
LOG.info('Create a zone as an default with existing domain')
self.assertRaises(lib_exc.Conflict,
- self.client.create_zone, name=zone['name'])
+ self.zones_client.create_zone, name=zone['name'])
LOG.info('Create a zone as an alt user with existing domain')
self.assertRaises(lib_exc.Conflict,
@@ -566,8 +564,8 @@
LOG.info('Create a zone as a default user')
zone_name = dns_data_utils.rand_zone_name(
name="no_create_subdomain_by_alt", suffix=self.tld_name)
- zone = self.client.create_zone(name=zone_name)[1]
- self.addCleanup(self.wait_zone_delete, self.client, zone['id'])
+ zone = self.zones_client.create_zone(name=zone_name)[1]
+ self.addCleanup(self.wait_zone_delete, self.zones_client, zone['id'])
LOG.info('Create a zone as an alt user with existing subdomain')
self.assertRaises(lib_exc.Forbidden,
@@ -581,8 +579,8 @@
name="no_create_superdomain_by_alt", suffix=self.tld_name)
LOG.info('Create a zone as a default user')
- zone = self.client.create_zone(name='a.b.' + zone_name)[1]
- self.addCleanup(self.wait_zone_delete, self.client, zone['id'])
+ zone = self.zones_client.create_zone(name='a.b.' + zone_name)[1]
+ self.addCleanup(self.wait_zone_delete, self.zones_client, zone['id'])
LOG.info('Create a zone as an alt user with existing superdomain')
self.assertRaises(lib_exc.Forbidden,
@@ -598,11 +596,6 @@
cls.set_network_resources()
super(ZonesNegativeTest, cls).setup_credentials()
- @classmethod
- def setup_clients(cls):
- super(ZonesNegativeTest, cls).setup_clients()
- cls.client = cls.os_primary.dns_v2.ZonesClient()
-
@decorators.idempotent_id('551853c0-8593-11eb-8c8a-74e5f9e2a801')
def test_no_valid_zone_name(self):
no_valid_names = ['a' * 1000, '___', '!^%&^#%^!@#', 'ggg', '.a', '']
@@ -610,7 +603,7 @@
LOG.info('Trying to create a zone named: {} '.format(name))
self.assertRaisesDns(
lib_exc.BadRequest, 'invalid_object', 400,
- self.client.create_zone, name=name)
+ self.zones_client.create_zone, name=name)
@decorators.idempotent_id('551853c0-8593-11eb-8c8a-74e5f9e2a801')
def test_no_valid_email(self):
@@ -622,7 +615,7 @@
' value: '.format(email))
self.assertRaisesDns(
lib_exc.BadRequest, 'invalid_object', 400,
- self.client.create_zone, email=email)
+ self.zones_client.create_zone, email=email)
@decorators.idempotent_id('551853c0-8593-11eb-8c8a-74e5f9e2a801')
def test_no_valid_ttl(self):
@@ -635,44 +628,44 @@
' value: '.format(ttl))
self.assertRaisesDns(
lib_exc.BadRequest, 'invalid_object', 400,
- self.client.create_zone, ttl=ttl)
+ self.zones_client.create_zone, ttl=ttl)
@decorators.idempotent_id('a3b0a928-a682-11eb-9899-74e5f9e2a801')
def test_huge_size_description(self):
LOG.info('Trying to create a zone using huge size description')
self.assertRaisesDns(
lib_exc.BadRequest, 'invalid_object', 400,
- self.client.create_zone,
+ self.zones_client.create_zone,
description=dns_data_utils.rand_zone_name() * 10000)
@decorators.idempotent_id('49268b24-92de-11eb-9d02-74e5f9e2a801')
def test_show_not_existing_zone(self):
LOG.info('Fetch non existing zone')
self.assertRaises(lib_exc.NotFound,
- lambda: self.client.show_zone(uuid.uuid1()))
+ lambda: self.zones_client.show_zone(uuid.uuid1()))
@decorators.idempotent_id('736e3b50-92e0-11eb-9d02-74e5f9e2a801')
def test_use_invalid_id_to_show_zone(self):
LOG.info('Fetch the zone using invalid zone ID')
with self.assertRaisesDns(lib_exc.BadRequest, 'invalid_uuid', 400):
- self.client.show_zone(uuid='zahlabut')
+ self.zones_client.show_zone(uuid='zahlabut')
@decorators.idempotent_id('79921370-92e1-11eb-9d02-74e5f9e2a801')
def test_delete_non_existing_zone(self):
LOG.info('Delete non existing zone')
self.assertRaises(lib_exc.NotFound,
- lambda: self.client.delete_zone(uuid.uuid1()))
+ lambda: self.zones_client.delete_zone(uuid.uuid1()))
@decorators.idempotent_id('e391e30a-92e0-11eb-9d02-74e5f9e2a801')
def test_update_non_existing_zone(self):
LOG.info('Update non existing zone')
self.assertRaises(lib_exc.NotFound,
- lambda: self.client.update_zone(
+ lambda: self.zones_client.update_zone(
uuid.uuid1(), description=data_utils.rand_name()))
@decorators.idempotent_id('925192f2-0ed8-4591-8fe7-a9fa028f90a0')
def test_list_zones_dot_json_fails(self):
- uri = self.client.get_uri('zones.json')
+ uri = self.zones_client.get_uri('zones.json')
self.assertRaises(lib_exc.NotFound,
- lambda: self.client.get(uri))
+ lambda: self.zones_client.get(uri))
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 55bd38c..d1e37fe 100644
--- a/designate_tempest_plugin/tests/api/v2/test_zones_exports.py
+++ b/designate_tempest_plugin/tests/api/v2/test_zones_exports.py
@@ -72,7 +72,6 @@
cls.admin_client = cls.os_system_admin.dns_v2.ZoneExportsClient()
else:
cls.admin_client = cls.os_admin.dns_v2.ZoneExportsClient()
- cls.zone_client = cls.os_primary.dns_v2.ZonesClient()
cls.alt_zone_client = cls.os_alt.dns_v2.ZonesClient()
cls.client = cls.os_primary.dns_v2.ZoneExportsClient()
cls.alt_client = cls.os_alt.dns_v2.ZoneExportsClient()
@@ -81,8 +80,8 @@
LOG.info('Create a zone')
zone_name = dns_data_utils.rand_zone_name(
name=test_name, suffix=self.tld_name)
- zone = self.zone_client.create_zone(name=zone_name)[1]
- self.addCleanup(self.wait_zone_delete, self.zone_client, zone['id'])
+ zone = self.zones_client.create_zone(name=zone_name)[1]
+ 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'])[1]
@@ -143,8 +142,8 @@
LOG.info('Create a zone')
zone_name = dns_data_utils.rand_zone_name(
name='show_zone_export_impersonate', suffix=self.tld_name)
- zone = self.zone_client.create_zone(name=zone_name)[1]
- self.addCleanup(self.wait_zone_delete, self.zone_client, zone['id'])
+ zone = self.zones_client.create_zone(name=zone_name)[1]
+ self.addCleanup(self.wait_zone_delete, self.zones_client, zone['id'])
LOG.info('Create a zone export using primary client')
resp, zone_export = self.client.create_zone_export(zone['id'])
@@ -179,8 +178,8 @@
LOG.info('Create a zone')
zone_name = dns_data_utils.rand_zone_name(
name='delete_zone_export', suffix=self.tld_name)
- zone = self.zone_client.create_zone(name=zone_name)[1]
- self.addCleanup(self.wait_zone_delete, self.zone_client, zone['id'],
+ zone = self.zones_client.create_zone(name=zone_name)[1]
+ self.addCleanup(self.wait_zone_delete, self.zones_client, zone['id'],
ignore_errors=lib_exc.NotFound)
LOG.info('Create a zone export')
@@ -263,9 +262,9 @@
LOG.info('Create a primary zone and its export')
zone_name = dns_data_utils.rand_zone_name(
name='list_zone_exports_all_projects', suffix=self.tld_name)
- primary_zone = self.zone_client.create_zone(name=zone_name)[1]
+ primary_zone = self.zones_client.create_zone(name=zone_name)[1]
self.addCleanup(
- self.wait_zone_delete, self.zone_client, primary_zone['id'])
+ self.wait_zone_delete, self.zones_client, primary_zone['id'])
primary_export = self.client.create_zone_export(primary_zone['id'])[1]
self.addCleanup(self.client.delete_zone_export, primary_export['id'])
@@ -311,9 +310,9 @@
LOG.info('Create a primary zone and its export')
zone_name = dns_data_utils.rand_zone_name(
name='list_zone_exports_filter', suffix=self.tld_name)
- primary_zone = self.zone_client.create_zone(name=zone_name)[1]
+ primary_zone = self.zones_client.create_zone(name=zone_name)[1]
self.addCleanup(
- self.wait_zone_delete, self.zone_client, primary_zone['id'])
+ self.wait_zone_delete, self.zones_client, primary_zone['id'])
primary_export = self.client.create_zone_export(primary_zone['id'])[1]
self.addCleanup(self.client.delete_zone_export, primary_export['id'])
@@ -377,7 +376,6 @@
@classmethod
def setup_clients(cls):
super(ZonesExportTestNegative, cls).setup_clients()
- cls.zone_client = cls.os_primary.dns_v2.ZonesClient()
cls.client = cls.os_primary.dns_v2.ZoneExportsClient()
cls.alt_client = cls.os_alt.dns_v2.ZoneExportsClient()
@@ -385,8 +383,8 @@
LOG.info('Create a zone')
zone_name = dns_data_utils.rand_zone_name(name=test_name,
suffix=self.tld_name)
- zone = self.zone_client.create_zone(name=zone_name)[1]
- self.addCleanup(self.wait_zone_delete, self.zone_client, zone['id'])
+ zone = self.zones_client.create_zone(name=zone_name)[1]
+ 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'])[1]
@@ -406,9 +404,9 @@
LOG.info('Create a primary zone.')
zone_name = dns_data_utils.rand_zone_name(name='export_not_your_zone',
suffix=self.tld_name)
- primary_zone = self.zone_client.create_zone(name=zone_name)[1]
+ primary_zone = self.zones_client.create_zone(name=zone_name)[1]
self.addCleanup(
- self.wait_zone_delete, self.zone_client, primary_zone['id'])
+ self.wait_zone_delete, self.zones_client, primary_zone['id'])
LOG.info('Make sure that "404 NotFound" status code is raised.')
self.assertRaises(
@@ -420,12 +418,12 @@
LOG.info('Create a zone')
zone_name = dns_data_utils.rand_zone_name(name='export_deleted_zone',
suffix=self.tld_name)
- zone = self.zone_client.create_zone(name=zone_name)[1]
- self.addCleanup(self.wait_zone_delete, self.zone_client, zone['id'],
+ zone = self.zones_client.create_zone(name=zone_name)[1]
+ self.addCleanup(self.wait_zone_delete, self.zones_client, zone['id'],
ignore_errors=lib_exc.NotFound)
LOG.info("Delete the zone and wait till it's done.")
- self.zone_client.delete_zone(zone['id'])[1]
- self.wait_zone_delete(self.zone_client, zone['id'])
+ self.zones_client.delete_zone(zone['id'])[1]
+ self.wait_zone_delete(self.zones_client, zone['id'])
LOG.info('Ensure we respond with NotFound exception')
self.assertRaises(
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 8e03845..8fdfb26 100644
--- a/designate_tempest_plugin/tests/api/v2/test_zones_imports.py
+++ b/designate_tempest_plugin/tests/api/v2/test_zones_imports.py
@@ -71,7 +71,6 @@
cls.admin_client = cls.os_system_admin.dns_v2.ZoneImportsClient()
else:
cls.admin_client = cls.os_admin.dns_v2.ZoneImportsClient()
- cls.zone_client = cls.os_primary.dns_v2.ZonesClient()
cls.client = cls.os_primary.dns_v2.ZoneImportsClient()
cls.alt_client = cls.os_alt.dns_v2.ZoneImportsClient()
@@ -81,7 +80,7 @@
waiters.wait_for_zone_import_status(
self.client, zone_import_id, const.COMPLETE)
self.client.delete_zone_import(zone_import['id'])
- self.wait_zone_delete(self.zone_client, zone_import['zone_id'])
+ self.wait_zone_delete(self.zones_client, zone_import['zone_id'])
else: # Import has failed and zone wasn't created.
self.client.delete_zone_import(zone_import['id'])
@@ -180,7 +179,7 @@
const.COMPLETE)
zone_import = self.client.show_zone_import(zone_import['id'])[1]
self.addCleanup(self.wait_zone_delete,
- self.zone_client,
+ self.zones_client,
zone_import['zone_id'])
# Test RBAC
@@ -387,7 +386,6 @@
@classmethod
def setup_clients(cls):
super(ZonesImportTestNegative, cls).setup_clients()
- cls.zone_client = cls.os_primary.dns_v2.ZonesClient()
cls.client = cls.os_primary.dns_v2.ZoneImportsClient()
def _clean_up_resources(self, zone_import_id):
@@ -396,7 +394,7 @@
waiters.wait_for_zone_import_status(
self.client, zone_import_id, const.COMPLETE)
self.client.delete_zone_import(zone_import['id'])
- self.wait_zone_delete(self.zone_client, zone_import['zone_id'])
+ self.wait_zone_delete(self.zones_client, zone_import['zone_id'])
else: # Import has failed and zone wasn't created.
self.client.delete_zone_import(zone_import['id'])
@@ -434,9 +432,9 @@
LOG.info('Create a Zone named: "...zone_to_update..."')
zone_name = dns_data_utils.rand_zone_name(
name='zone_to_update', suffix=self.tld_name)
- zone = self.zone_client.create_zone(
+ zone = self.zones_client.create_zone(
name=zone_name, wait_until=const.ACTIVE)[1]
- self.addCleanup(self.wait_zone_delete, self.zone_client, zone['id'])
+ self.addCleanup(self.wait_zone_delete, self.zones_client, zone['id'])
LOG.info('Use zone import to update an existing zone, expected: zone'
' import gets into the ERROR status ')
zone_import_data = dns_data_utils.rand_zonefile_data(name=zone_name)
diff --git a/designate_tempest_plugin/tests/base.py b/designate_tempest_plugin/tests/base.py
index 24156d8..26f1f03 100644
--- a/designate_tempest_plugin/tests/base.py
+++ b/designate_tempest_plugin/tests/base.py
@@ -103,6 +103,17 @@
build_interval=CONF.dns.build_interval,
build_timeout=CONF.dns.build_timeout,
)
+ # Most tests need a "primary" zones client and we need it for the
+ # API version check, so create one instance here.
+ cls.zones_client = cls.os_primary.dns_v2.ZonesClient()
+
+ @classmethod
+ def resource_setup(cls):
+ """Setup resources needed by the tests."""
+ super(BaseDnsTest, cls).resource_setup()
+
+ # The credential does not matter here.
+ cls.api_version = cls.zones_client.get_max_api_version()
def assertExpected(self, expected, actual, excluded_keys):
for key, value in expected.items():
diff --git a/designate_tempest_plugin/tests/scenario/v2/test_blacklists.py b/designate_tempest_plugin/tests/scenario/v2/test_blacklists.py
index a485f5b..85d5d5a 100644
--- a/designate_tempest_plugin/tests/scenario/v2/test_blacklists.py
+++ b/designate_tempest_plugin/tests/scenario/v2/test_blacklists.py
@@ -71,7 +71,6 @@
else:
cls.admin_blacklist_client = cls.os_admin.dns_v2.BlacklistsClient()
cls.admin_zone_client = cls.os_admin.dns_v2.ZonesClient()
- cls.primary_zone_client = cls.os_primary.dns_v2.ZonesClient()
@decorators.idempotent_id('22b1ee72-d8d2-11eb-bcdc-74e5f9e2a801')
def test_primary_fails_to_create_zone_matches_blacklist_regex(self):
@@ -87,7 +86,7 @@
'"blacklistregextest".')
self.assertRaisesDns(
lib_exc.BadRequest, 'invalid_zone_name', 400,
- self.primary_zone_client.create_zone,
+ self.zones_client.create_zone,
name='blacklistregextest' + dns_data_utils.rand_zone_name())
@decorators.idempotent_id('6956f20c-d8d5-11eb-bcdc-74e5f9e2a801')
@@ -104,7 +103,7 @@
LOG.info('Try to create a zone named:{}'.format(zone_name))
self.assertRaisesDns(
lib_exc.BadRequest, 'invalid_zone_name', 400,
- self.primary_zone_client.create_zone, name=zone_name)
+ self.zones_client.create_zone, name=zone_name)
@decorators.idempotent_id('de030088-d97e-11eb-8ab8-74e5f9e2a801')
def test_admin_creates_zone_matches_blacklist_name_or_regex(self):
@@ -126,27 +125,27 @@
' Expected: FAIL')
with self.assertRaisesDns(
lib_exc.BadRequest, 'invalid_zone_name', 400):
- self.primary_zone_client.create_zone(name=zone_name_to_deny)
+ self.zones_client.create_zone(name=zone_name_to_deny)
LOG.info('Admin tries to create a zone that is blacklisted by name '
'for a Primary user. Expected: FAIL')
zone = self.admin_zone_client.create_zone(
name=zone_name_to_deny,
- project_id=self.primary_zone_client.project_id)[1]
+ project_id=self.zones_client.project_id)[1]
self.addCleanup(
- self.wait_zone_delete, self.primary_zone_client, zone['id'])
+ self.wait_zone_delete, self.zones_client, zone['id'])
LOG.info('Primary tries to create a zone that is blacklisted by regex.'
' Expected: FAIL')
with self.assertRaisesDns(
lib_exc.BadRequest, 'invalid_zone_name', 400):
- self.primary_zone_client.create_zone(
+ self.zones_client.create_zone(
name='blacklistnameregextest2{}'.format(zone_name_to_deny))
LOG.info('Admin tries to create a zone that is blacklisted by regex'
' for a Primary user. Expected: FAIL')
zone = self.admin_zone_client.create_zone(
name='blacklistnameregextest2{}'.format(zone_name_to_deny),
- project_id=self.primary_zone_client.project_id)[1]
+ project_id=self.zones_client.project_id)[1]
self.addCleanup(
- self.wait_zone_delete, self.primary_zone_client, zone['id'])
+ self.wait_zone_delete, self.zones_client, zone['id'])
diff --git a/designate_tempest_plugin/tests/scenario/v2/test_quotas.py b/designate_tempest_plugin/tests/scenario/v2/test_quotas.py
index 2b20db5..bc6a8cd 100644
--- a/designate_tempest_plugin/tests/scenario/v2/test_quotas.py
+++ b/designate_tempest_plugin/tests/scenario/v2/test_quotas.py
@@ -63,7 +63,6 @@
cls.admin_tld_client = cls.os_admin.dns_v2.TldClient()
cls.quotas_client = cls.os_primary.dns_v2.QuotasClient()
cls.alt_client = cls.os_alt.dns_v2.QuotasClient()
- cls.zone_client = cls.os_primary.dns_v2.ZonesClient()
cls.alt_zone_client = cls.os_alt.dns_v2.ZonesClient()
cls.recordset_client = cls.os_primary.dns_v2.RecordsetClient()
@@ -101,17 +100,17 @@
if quota_type == 'zones_quota':
zone_name = dns_data_utils.rand_zone_name(
name="_reach_quota_limit", suffix=self.tld_name)
- zone = self.zone_client.create_zone(
+ zone = self.zones_client.create_zone(
name=zone_name,
description='Test zone for:{}'.format(quota_type))[1]
self.addCleanup(
self.wait_zone_delete,
- self.zone_client, zone['id'])
+ self.zones_client, zone['id'])
else:
if quota_type == 'zone_recordsets':
max_number_of_records = 10
prj_quota = self.admin_client.show_quotas(
- project_id=self.zone_client.project_id,
+ project_id=self.zones_client.project_id,
headers=self.all_projects_header)[1][
'zone_records']
if max_number_of_records > prj_quota:
@@ -152,15 +151,15 @@
quotas = dns_data_utils.rand_quotas()
quotas['api_export_size'] = self.test_quota_limit
self._set_quota_for_project(
- self.zone_client.project_id, quotas)
+ self.zones_client.project_id, quotas)
LOG.info('Create a Zone, wait until ACTIVE and add:{}'
' Recordsets'.format(self.test_quota_limit + 1))
- zone = self.zone_client.create_zone(
+ zone = self.zones_client.create_zone(
description='Zone for test_api_export_size_quota',
wait_until=const.ACTIVE)[1]
self.addCleanup(
self.wait_zone_delete,
- self.zone_client, zone['id'])
+ self.zones_client, zone['id'])
for i in range(self.test_quota_limit + 1):
recordset_data = dns_data_utils.rand_recordset_data(
record_type='A', zone_name=zone['name'])
@@ -194,17 +193,17 @@
quotas = dns_data_utils.rand_quotas()
quotas['recordset_records'] = self.test_quota_limit
self._set_quota_for_project(
- self.zone_client.project_id, quotas)
+ self.zones_client.project_id, quotas)
LOG.info('Create a Zone and wait until ACTIVE')
zone_name = dns_data_utils.rand_zone_name(
name="test_recordset_records_quota", suffix=self.tld_name)
- zone = self.zone_client.create_zone(
+ zone = self.zones_client.create_zone(
name=zone_name,
description='Zone for test_recordset_records_quota',
wait_until=const.ACTIVE)[1]
self.addCleanup(
self.wait_zone_delete,
- self.zone_client, zone['id'])
+ self.zones_client, zone['id'])
LOG.info(
'Create recordset data with:{} records and try to create'
' a recordset. Expected:"413 over_quota"'.format(
@@ -224,19 +223,19 @@
LOG.info('Create a Zone and wait until ACTIVE')
zone_name = dns_data_utils.rand_zone_name(
name="test_zone_records_quota", suffix=self.tld_name)
- zone = self.zone_client.create_zone(
+ zone = self.zones_client.create_zone(
name=zone_name,
description='Zone for test_zone_records_quota',
wait_until=const.ACTIVE)[1]
self.addCleanup(
self.wait_zone_delete,
- self.zone_client, zone['id'])
+ self.zones_client, zone['id'])
LOG.info('Admin sets "zone_records:{}" quota for Primary '
'user'.format(self.test_quota_limit))
quotas = dns_data_utils.rand_quotas()
quotas['zone_records'] = self.test_quota_limit
self._set_quota_for_project(
- self.zone_client.project_id, quotas)
+ self.zones_client.project_id, quotas)
LOG.info(
'Try to add:{} recordsets (with a single record) to the Zone in'
' loop. Expected:"413 over_quota"'.format(
@@ -250,19 +249,19 @@
LOG.info('Create a Zone and wait until ACTIVE')
zone_name = dns_data_utils.rand_zone_name(
name="test_zone_recordsets_quota", suffix=self.tld_name)
- zone = self.zone_client.create_zone(
+ zone = self.zones_client.create_zone(
name=zone_name,
description='Zone for test_zone_recordsets_quota',
wait_until=const.ACTIVE)[1]
self.addCleanup(
self.wait_zone_delete,
- self.zone_client, zone['id'])
+ self.zones_client, zone['id'])
LOG.info('Admin sets "zone_recordsets:{}" quota for Primary '
'user'.format(self.test_quota_limit))
quotas = dns_data_utils.rand_quotas()
quotas['zone_recordsets'] = self.test_quota_limit
self._set_quota_for_project(
- self.zone_client.project_id, quotas)
+ self.zones_client.project_id, quotas)
LOG.info(
'Try to add:{} recordsets (with a random number of records) to a'
' Zone in loop. Expected:"413 over_quota"'.format(
@@ -278,14 +277,14 @@
quotas = dns_data_utils.rand_quotas()
quotas['zones'] = self.test_quota_limit
self._set_quota_for_project(
- self.zone_client.project_id, quotas)
+ self.zones_client.project_id, quotas)
LOG.info('Try to create Zones. Expected:"413 over_quota"')
self._reach_quota_limit(self.test_quota_limit, 'zones_quota')
class QuotasBoundary(base.BaseDnsV2Test, tempest.test.BaseTestCase):
- credentials = ['admin', 'system_admin']
+ credentials = ['admin', 'system_admin', 'primary']
@classmethod
def setup_credentials(cls):
@@ -308,14 +307,14 @@
cls.admin_tld_client = cls.os_system_admin.dns_v2.TldClient()
cls.quota_client = cls.os_system_admin.dns_v2.QuotasClient()
cls.project_client = cls.os_system_admin.projects_client
- cls.zone_client = cls.os_system_admin.dns_v2.ZonesClient()
cls.recordset_client = cls.os_system_admin.dns_v2.RecordsetClient()
cls.export_zone_client = (
cls.os_system_admin.dns_v2.ZoneExportsClient())
+ cls.admin_zones_client = cls.os_system_admin.dns_v2.ZonesClient()
else:
cls.quota_client = cls.os_admin.dns_v2.QuotasClient()
cls.project_client = cls.os_admin.projects_client
- cls.zone_client = cls.os_admin.dns_v2.ZonesClient()
+ cls.admin_zones_client = cls.os_admin.dns_v2.ZonesClient()
cls.recordset_client = cls.os_admin.dns_v2.RecordsetClient()
cls.export_zone_client = cls.os_admin.dns_v2.ZoneExportsClient()
cls.admin_tld_client = cls.os_admin.dns_v2.TldClient()
@@ -353,15 +352,16 @@
# Create a first Zone --> Should PASS
zone_name = dns_data_utils.rand_zone_name(
name="test_zone_quota_boundary_attempt_1", suffix=self.tld_name)
- zone = self.zone_client.create_zone(
+ zone = self.admin_zones_client.create_zone(
name=zone_name, project_id=tenant_id)[1]
- self.addCleanup(self.wait_zone_delete, self.zone_client, zone['id'])
+ self.addCleanup(self.wait_zone_delete, self.admin_zones_client,
+ zone['id'])
# Create a second zone --> should FAIL on: 413 over_quota
zone_name = dns_data_utils.rand_zone_name(
name="test_zone_quota_boundary_attempt_2", suffix=self.tld_name)
try:
- response_headers, zone = self.zone_client.create_zone(
+ response_headers, zone = self.admin_zones_client.create_zone(
name=zone_name, project_id=tenant_id)
if response_headers['status'] != 413:
raise exceptions.InvalidStatusError(
@@ -372,6 +372,6 @@
finally:
self.addCleanup(
self.wait_zone_delete,
- self.zone_client, zone['id'],
+ self.admin_zones_client, zone['id'],
headers=sudo_header,
ignore_errors=lib_exc.NotFound)
diff --git a/designate_tempest_plugin/tests/scenario/v2/test_recordsets.py b/designate_tempest_plugin/tests/scenario/v2/test_recordsets.py
index dcdf0b0..a84077b 100644
--- a/designate_tempest_plugin/tests/scenario/v2/test_recordsets.py
+++ b/designate_tempest_plugin/tests/scenario/v2/test_recordsets.py
@@ -45,7 +45,6 @@
else:
cls.admin_client = cls.os_admin.dns_v2.RecordsetClient()
cls.admin_tld_client = cls.os_admin.dns_v2.TldClient()
- cls.client = cls.os_primary.dns_v2.ZonesClient()
cls.recordset_client = cls.os_primary.dns_v2.RecordsetClient()
@classmethod
@@ -55,7 +54,7 @@
zone_id = CONF.dns.zone_id
if zone_id:
LOG.info('Retrieve info from a zone')
- zone = cls.client.show_zone(zone_id)[1]
+ zone = cls.zones_client.show_zone(zone_id)[1]
else:
# Make sure we have an allowed TLD available
tld_name = dns_data_utils.rand_zone_name(name="RecordsetsTest")
@@ -65,13 +64,13 @@
LOG.info('Create a new zone')
zone_name = dns_data_utils.rand_zone_name(
name="recordsets_test_setup", suffix=cls.tld_name)
- zone = cls.client.create_zone(name=zone_name)[1]
+ zone = cls.zones_client.create_zone(name=zone_name)[1]
cls.addClassResourceCleanup(
test_utils.call_and_ignore_notfound_exc,
- cls.client.delete_zone, zone['id'])
+ cls.zones_client.delete_zone, zone['id'])
LOG.info('Ensure we respond with ACTIVE')
- waiters.wait_for_zone_status(cls.client, zone['id'], 'ACTIVE')
+ waiters.wait_for_zone_status(cls.zones_client, zone['id'], 'ACTIVE')
cls.zone = zone
diff --git a/designate_tempest_plugin/tests/scenario/v2/test_tld.py b/designate_tempest_plugin/tests/scenario/v2/test_tld.py
index 8dc6d70..bc90c90 100644
--- a/designate_tempest_plugin/tests/scenario/v2/test_tld.py
+++ b/designate_tempest_plugin/tests/scenario/v2/test_tld.py
@@ -43,7 +43,6 @@
else:
cls.admin_tld_client = cls.os_admin.dns_v2.TldClient()
cls.primary_tld_client = cls.os_primary.dns_v2.TldClient()
- cls.primary_zone_client = cls.os_primary.dns_v2.ZonesClient()
@classmethod
def resource_setup(cls):
@@ -63,10 +62,10 @@
zone_name = dns_data_utils.rand_zone_name(
name='existing_tld_zone', prefix='rand',
suffix='.{}.'.format(self.tld_suffix))
- zone = self.primary_zone_client.create_zone(
+ zone = self.zones_client.create_zone(
name=zone_name, wait_until=const.ACTIVE)[1]
self.addCleanup(
- self.wait_zone_delete, self.primary_zone_client, zone['id'])
+ self.wait_zone_delete, self.zones_client, zone['id'])
@decorators.idempotent_id('06deced8-d4de-11eb-b8ee-74e5f9e2a801')
def test_create_zone_using_not_existing_tld(self):
@@ -76,5 +75,5 @@
name='not_existing_tld_zone', prefix='rand',
suffix='.{}.'.format(self.tld_suffix)[::-1])
self.assertRaises(
- lib_exc.BadRequest, self.primary_zone_client.create_zone,
+ lib_exc.BadRequest, self.zones_client.create_zone,
name=zone_name)
diff --git a/designate_tempest_plugin/tests/scenario/v2/test_zones.py b/designate_tempest_plugin/tests/scenario/v2/test_zones.py
index f305094..98b2f9c 100644
--- a/designate_tempest_plugin/tests/scenario/v2/test_zones.py
+++ b/designate_tempest_plugin/tests/scenario/v2/test_zones.py
@@ -46,7 +46,6 @@
else:
cls.admin_tld_client = cls.os_admin.dns_v2.TldClient()
cls.rec_client = cls.os_admin.dns_v2.RecordsetClient()
- cls.client = cls.os_primary.dns_v2.ZonesClient()
cls.primary_client = cls.os_primary.dns_v2.BlacklistsClient()
@classmethod
@@ -69,8 +68,8 @@
LOG.info('Create a zone')
zone_name = dns_data_utils.rand_zone_name(
name="create_and_delete_zone", suffix=self.tld_name)
- zone = self.client.create_zone(name=zone_name)[1]
- self.addCleanup(self.wait_zone_delete, self.client, zone['id'],
+ zone = self.zones_client.create_zone(name=zone_name)[1]
+ self.addCleanup(self.wait_zone_delete, self.zones_client, zone['id'],
ignore_errors=lib_exc.NotFound)
LOG.info('Ensure we respond with CREATE+PENDING')
@@ -78,23 +77,23 @@
self.assertEqual(const.PENDING, zone['status'])
waiters.wait_for_zone_status(
- self.client, zone['id'], const.ACTIVE)
+ self.zones_client, zone['id'], const.ACTIVE)
LOG.info('Re-Fetch the zone')
- zone = self.client.show_zone(zone['id'])[1]
+ zone = self.zones_client.show_zone(zone['id'])[1]
LOG.info('Ensure we respond with NONE+ACTIVE')
self.assertEqual(const.NONE, zone['action'])
self.assertEqual(const.ACTIVE, zone['status'])
LOG.info('Delete the zone')
- zone = self.client.delete_zone(zone['id'])[1]
+ zone = self.zones_client.delete_zone(zone['id'])[1]
LOG.info('Ensure we respond with DELETE+PENDING')
self.assertEqual(const.DELETE, zone['action'])
self.assertEqual(const.PENDING, zone['status'])
- waiters.wait_for_zone_404(self.client, zone['id'])
+ waiters.wait_for_zone_404(self.zones_client, zone['id'])
@decorators.attr(type='slow')
@decorators.idempotent_id('cabd6334-ba37-11ec-9d8c-201e8823901f')
@@ -105,22 +104,22 @@
orig_description = 'test_create_and_update_zone: org description'
zone_name = dns_data_utils.rand_zone_name(
name="create_and_update_zone", suffix=self.tld_name)
- zone = self.client.create_zone(
+ zone = self.zones_client.create_zone(
name=zone_name,
ttl=orig_ttl, description=orig_description,
wait_until=const.ACTIVE)[1]
- self.addCleanup(self.wait_zone_delete, self.client, zone['id'],
+ self.addCleanup(self.wait_zone_delete, self.zones_client, zone['id'],
ignore_errors=lib_exc.NotFound)
LOG.info("Update zone's: TTL and Description, wait until ACTIVE")
updated_ttl = 777
updated_description = dns_data_utils.rand_string(20)
- self.client.update_zone(
+ self.zones_client.update_zone(
zone['id'], ttl=updated_ttl, description=updated_description,
wait_until=const.ACTIVE)
LOG.info('Re-Fetch/Show the zone')
- show_zone = self.client.show_zone(zone['id'])[1]
+ show_zone = self.zones_client.show_zone(zone['id'])[1]
LOG.info('Ensure that the Description and TLL has been updated')
self.assertEqual(
@@ -138,8 +137,8 @@
LOG.info('Create a zone')
zone_name = dns_data_utils.rand_zone_name(
name="delete_zone_pending_create", suffix=self.tld_name)
- zone = self.client.create_zone(name=zone_name)[1]
- self.addCleanup(self.wait_zone_delete, self.client, zone['id'],
+ zone = self.zones_client.create_zone(name=zone_name)[1]
+ self.addCleanup(self.wait_zone_delete, self.zones_client, zone['id'],
ignore_errors=lib_exc.NotFound)
# NOTE(kiall): This is certainly a little racey, it's entirely
@@ -148,13 +147,13 @@
# Theres not a huge amount we can do, given this is
# black-box testing.
LOG.info('Delete the zone while it is still pending')
- zone = self.client.delete_zone(zone['id'])[1]
+ zone = self.zones_client.delete_zone(zone['id'])[1]
LOG.info('Ensure we respond with DELETE+PENDING')
self.assertEqual(const.DELETE, zone['action'])
self.assertEqual(const.PENDING, zone['status'])
- waiters.wait_for_zone_404(self.client, zone['id'])
+ waiters.wait_for_zone_404(self.zones_client, zone['id'])
@decorators.attr(type='slow')
@decorators.idempotent_id('ad8d1f5b-da66-46a0-bbee-14dc84a5d791')
@@ -165,10 +164,11 @@
LOG.info('Create a zone')
zone_name = dns_data_utils.rand_zone_name(
name="zone_create_propagates", suffix=self.tld_name)
- zone = self.client.create_zone(name=zone_name)[1]
- self.addCleanup(self.wait_zone_delete, self.client, zone['id'])
+ zone = self.zones_client.create_zone(name=zone_name)[1]
+ self.addCleanup(self.wait_zone_delete, self.zones_client, zone['id'])
- waiters.wait_for_zone_status(self.client, zone['id'], const.ACTIVE)
+ waiters.wait_for_zone_status(self.zones_client, zone['id'],
+ const.ACTIVE)
waiters.wait_for_query(self.query_client, zone['name'], const.SOA)
@decorators.attr(type='slow')
@@ -180,17 +180,18 @@
LOG.info('Create a zone')
zone_name = dns_data_utils.rand_zone_name(
name="zone_delete_propagates", suffix=self.tld_name)
- zone = self.client.create_zone(name=zone_name)[1]
- self.addCleanup(self.wait_zone_delete, self.client, zone['id'],
+ zone = self.zones_client.create_zone(name=zone_name)[1]
+ self.addCleanup(self.wait_zone_delete, self.zones_client, zone['id'],
ignore_errors=lib_exc.NotFound)
- waiters.wait_for_zone_status(self.client, zone['id'], const.ACTIVE)
+ waiters.wait_for_zone_status(self.zones_client, zone['id'],
+ const.ACTIVE)
waiters.wait_for_query(self.query_client, zone['name'], const.SOA)
LOG.info('Delete the zone')
- self.client.delete_zone(zone['id'])
+ self.zones_client.delete_zone(zone['id'])
- waiters.wait_for_zone_404(self.client, zone['id'])
+ waiters.wait_for_zone_404(self.zones_client, zone['id'])
waiters.wait_for_query(self.query_client, zone['name'], const.SOA,
found=False)
@@ -210,10 +211,11 @@
' and SOA Refresh values')
zone_name = dns_data_utils.rand_zone_name(
name="test_notify_msg_sent_to_nameservers", suffix=self.tld_name)
- zone = self.client.create_zone(name=zone_name, wait_until='ACTIVE')[1]
+ zone = self.zones_client.create_zone(name=zone_name,
+ wait_until='ACTIVE')[1]
org_serial = zone['serial']
- self.addCleanup(self.wait_zone_delete, self.client, zone['id'])
+ self.addCleanup(self.wait_zone_delete, self.zones_client, zone['id'])
try:
soa = [
rec['records'] for rec in self.rec_client.list_recordset(
@@ -232,9 +234,9 @@
LOG.info("Update Zone's TTL, wait until ACTIVE and"
" ensure Zone's Serial has changed")
- self.client.update_zone(
+ self.zones_client.update_zone(
zone['id'], ttl=dns_data_utils.rand_ttl(), wait_until='ACTIVE')
- new_serial = self.client.show_zone(zone['id'])[1]['serial']
+ new_serial = self.zones_client.show_zone(zone['id'])[1]['serial']
self.assertNotEqual(
new_serial, org_serial,
"Failed, expected behaviour is that the Designate DNS changes the"
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 67e5f32..8c8d674 100644
--- a/designate_tempest_plugin/tests/scenario/v2/test_zones_export.py
+++ b/designate_tempest_plugin/tests/scenario/v2/test_zones_export.py
@@ -46,7 +46,6 @@
else:
cls.admin_client = cls.os_admin.dns_v2.ZoneExportsClient()
cls.client = cls.os_primary.dns_v2.ZoneExportsClient()
- cls.zones_client = cls.os_primary.dns_v2.ZonesClient()
cls.recordset_client = cls.os_primary.dns_v2.RecordsetClient()
def _create_zone_export(self, test_name):
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 2142158..9518d82 100644
--- a/designate_tempest_plugin/tests/scenario/v2/test_zones_import.py
+++ b/designate_tempest_plugin/tests/scenario/v2/test_zones_import.py
@@ -32,7 +32,6 @@
super(ZonesImportTest, cls).setup_clients()
cls.client = cls.os_primary.dns_v2.ZoneImportsClient()
- cls.zones_client = cls.os_primary.dns_v2.ZonesClient()
@decorators.attr(type='slow')
@decorators.idempotent_id('679f38d0-2f2f-49c5-934e-8fe0c452f56e')
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 78aaabc..8527e46 100644
--- a/designate_tempest_plugin/tests/scenario/v2/test_zones_transfer.py
+++ b/designate_tempest_plugin/tests/scenario/v2/test_zones_transfer.py
@@ -40,7 +40,6 @@
cls.admin_accept_client = (
cls.os_admin.dns_v2.TransferAcceptClient())
cls.admin_tld_client = cls.os_admin.dns_v2.TldClient()
- cls.zones_client = cls.os_primary.dns_v2.ZonesClient()
cls.alt_zones_client = cls.os_alt.dns_v2.ZonesClient()
cls.request_client = cls.os_primary.dns_v2.TransferRequestClient()
cls.alt_request_client = cls.os_alt.dns_v2.TransferRequestClient()
diff --git a/requirements.txt b/requirements.txt
index 3a1f2f3..d9c89bf 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -4,5 +4,6 @@
dnspython>=1.16.0 # http://www.dnspython.org/LICENSE
ddt>=1.0.1 # MIT
+oslo.serialization>=2.25.0 # Apache-2.0
testtools>=2.2.0 # MIT
tempest>=17.1.0 # Apache-2.0