Merge "Add a multipool 2025.1 stable job"
diff --git a/designate_tempest_plugin/data_utils.py b/designate_tempest_plugin/data_utils.py
index 31989b7..9a368ea 100644
--- a/designate_tempest_plugin/data_utils.py
+++ b/designate_tempest_plugin/data_utils.py
@@ -49,6 +49,27 @@
return name + suffix
+def rand_dns_name_by_size(name_size, label_size=63):
+ """Generates label based DNS name, by given characters size
+ :param name_size: size in characters
+ :param label_size: the max number of characters to be used
+ for label. Max value according the RFC is 63
+ https://datatracker.ietf.org/doc/html/rfc1035#
+ section-2.3.4in
+ :return: DNS name
+ """
+ template = ''
+ while len(template) < name_size:
+ remaining_length = name_size - len(template)
+ template += '{}.'.format(rand_string(
+ min(remaining_length - 1, label_size)))
+ if template.endswith('..'):
+ raise Exception("There is no way to generate a valid DNS name "
+ "using provided set of values:{},{}, consider "
+ "changing those values".format(name_size, label_size))
+ return template
+
+
def rand_email(domain=None):
"""Generate a random zone name
:return: a random zone name e.g. example.org.
diff --git a/designate_tempest_plugin/tests/api/v2/test_recordset.py b/designate_tempest_plugin/tests/api/v2/test_recordset.py
index f4ce02b..eb167af 100644
--- a/designate_tempest_plugin/tests/api/v2/test_recordset.py
+++ b/designate_tempest_plugin/tests/api/v2/test_recordset.py
@@ -12,6 +12,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from oslo_log import log as logging
+from oslo_utils import versionutils
from tempest import config
from tempest.lib import decorators
from tempest.lib import exceptions as lib_exc
@@ -178,7 +179,82 @@
@decorators.idempotent_id('8e7ecedb-5c35-46f8-ae0e-39e4aaabc97d')
def test_create_recordset_type_TXT(self):
self._test_create_recordset_type(
- "www", "TXT", ["\"Any Old Text Goes Here\""])
+ "sample", "TXT", ["\"Any Old Text Goes Here\""])
+
+ @decorators.idempotent_id('521ae1b0-f115-4d3c-8bcd-e54ef53bb2b9')
+ def test_create_recordset_type_SVCB(self):
+ if not versionutils.is_compatible('2.2', self.api_version,
+ same_major=False):
+ raise self.skipException(
+ 'SVCB record tests require Designate API version 2.2 or '
+ 'newer. Skipping test_create_recordset_type_SVCB test.')
+
+ ipv61 = '2001:db8:3333:4444:5555:6666:7777:8888'
+ ipv6hint = f'{ipv61},2001:db8:3333:4444:cccc:dddd:eeee:ffff'
+ ipv4hint = "1.2.3.4,9.8.7.6"
+ alpn = "h3,h2,http/1.1"
+ port = "888"
+ target = "sample.example.org."
+ doh = '/dns-query{?dns}'
+ self._test_create_recordset_type(
+ None,
+ "SVCB",
+ [f"1 {target} alpn={alpn} ipv4hint={ipv4hint}"
+ f" ipv6hint={ipv6hint} port={port} dohpath={doh}"]
+ )
+
+ @decorators.idempotent_id('ebb3c1e2-fa33-4520-bba5-2888886d84f5')
+ def test_create_recordset_type_HTTPS(self):
+ if not versionutils.is_compatible('2.2', self.api_version,
+ same_major=False):
+ raise self.skipException(
+ 'HTTPS record tests require Designate API version 2.2 or '
+ 'newer. Skipping test_create_recordset_type_HTTPS test.')
+
+ ipv61 = '2001:db8:3333:4444:5555:6666:7777:8888'
+ ipv6hint = f'{ipv61},2001:db8:3333:4444:cccc:dddd:eeee:ffff'
+ ipv4hint = "1.2.3.4,9.8.7.6"
+ alpn = "h3,h2,http/1.1"
+ port = "888"
+ target = "sample.example.org."
+ self._test_create_recordset_type(
+ "sample",
+ "HTTPS",
+ [f"1 {target} alpn={alpn} ipv4hint={ipv4hint}"
+ f" ipv6hint={ipv6hint} port={port}"]
+ )
+
+ @decorators.idempotent_id('64f3a41b-065c-47f8-8a73-2a0cd62ed196')
+ def test_create_recordset_type_HTTPS_no_default_alpn(self):
+ if not versionutils.is_compatible('2.2', self.api_version,
+ same_major=False):
+ raise self.skipException(
+ 'HTTPS record tests require Designate API version 2.2 or '
+ 'newer. Skipping '
+ 'test_create_recordset_type_HTTPS_no_default_alpntest.')
+
+ self._test_create_recordset_type(
+ "sample", "HTTPS", ['1 sample.example.org. alpn=http/1.1 '
+ 'no-default-alpn port=8000']
+ )
+
+ @decorators.idempotent_id('4d399592-5d37-43ba-99ac-e7665c2c1f8f')
+ def test_create_recordset_type_HTTPS_mandatory(self):
+ if not versionutils.is_compatible('2.2', self.api_version,
+ same_major=False):
+ raise self.skipException(
+ 'HTTPS record tests require Designate API version 2.2 or '
+ 'newer. Skipping test_create_recordset_type_HTTPS_mandatory '
+ 'test.')
+
+ ipv6 = "2001:db8:3333:4444:5555:6666:7777:8888"
+ self._test_create_recordset_type(
+ "sample",
+ "HTTPS",
+ [f'1 sample.example.org. ipv4hint=192.168.1.2 ipv6hint={ipv6}'
+ f' alpn=h2 mandatory=alpn'
+ ]
+ )
def _test_create_wildcard_recordset(self, name, type, records):
if name is not None:
@@ -731,6 +807,85 @@
lib_exc.NotFound, lambda: self.alt_client.create_recordset(
self.zone['id'], recordset_data))
+ @decorators.idempotent_id('f236a24a-a3c6-4a0c-a54c-ebf8a312b908')
+ def test_create_recordset_invalid_HTTPS_alpn(self):
+ if not versionutils.is_compatible('2.2', self.api_version,
+ same_major=False):
+ raise self.skipException(
+ 'HTTPS record tests require Designate API version 2.2 or '
+ 'newer. Skipping test_create_recordset_invalid_HTTPS_alpn '
+ 'test.')
+
+ self._test_create_recordset_invalid(
+ None, 'HTTPS', ["1 sample.example.org. alpn=foo"])
+
+ @decorators.idempotent_id('d680ef3a-4406-47c5-a994-483138c5e975')
+ def test_create_recordset_invalid_HTTPS_port(self):
+ if not versionutils.is_compatible('2.2', self.api_version,
+ same_major=False):
+ raise self.skipException(
+ 'HTTPS record tests require Designate API version 2.2 or '
+ 'newer. Skipping test_create_recordset_invalid_HTTPS_port '
+ 'test.')
+
+ self._test_create_recordset_invalid(
+ None, 'HTTPS', ["1 sample.example.org. port=foo"])
+
+ @decorators.idempotent_id('a33fc327-8d37-4582-9d2b-be83f6ee38d3')
+ def test_create_recordset_invalid_HTTPS_ech(self):
+ if not versionutils.is_compatible('2.2', self.api_version,
+ same_major=False):
+ raise self.skipException(
+ 'HTTPS record tests require Designate API version 2.2 or '
+ 'newer. Skipping test_create_recordset_invalid_HTTPS_ech '
+ 'test.')
+
+ self._test_create_recordset_invalid(
+ None, 'HTTPS', ["1 sample.example.org. port=8888 ech=foo//"])
+
+ @decorators.idempotent_id('1869737f-1a1b-4712-93da-2d680cd45cd8')
+ def test_create_recordset_invalid_SVCB_mandatory(self):
+ if not versionutils.is_compatible('2.2', self.api_version,
+ same_major=False):
+ raise self.skipException(
+ 'SVCB record tests require Designate API version 2.2 or '
+ 'newer. Skipping test_create_recordset_invalid_SVCB_mandatory '
+ 'test.')
+
+ ipv6hint = "2001:db8:3333:4444:5555:6666:7777:8888"
+ self._test_create_recordset_invalid(
+ None, 'SVCB', [
+ f"1 sample.example.org."
+ f" ipv6hint={ipv6hint} mandatory=alpn,ipv4hint"
+ ]
+ )
+
+ @decorators.idempotent_id('5bae6c22-7a37-48a5-b6b3-089d83a8f2ce')
+ def test_create_recordset_invalid_SVCB_ipv4hint(self):
+ if not versionutils.is_compatible('2.2', self.api_version,
+ same_major=False):
+ raise self.skipException(
+ 'SVCB record tests require Designate API version 2.2 or '
+ 'newer. Skipping test_create_recordset_invalid_SVCB_ipv4hint '
+ 'test.')
+
+ self._test_create_recordset_invalid(
+ None, 'SVCB',
+ ['1 sample.example.org. ipv4hint=foo,192.168.1.2'])
+
+ @decorators.idempotent_id('72dce8ca-f2fa-4054-b2b7-7bccfe3a02c1')
+ def test_create_recordset_invalid_SVCB_ipv6hint(self):
+ if not versionutils.is_compatible('2.2', self.api_version,
+ same_major=False):
+ raise self.skipException(
+ 'SVCB record tests require Designate API version 2.2 or '
+ 'newer. Skipping test_create_recordset_invalid_SVCB_ipv6hint'
+ 'test.')
+
+ self._test_create_recordset_invalid(
+ None, 'SVCB', ['1 sample.example.org. ipv6hint=foo']
+ )
+
class RootRecordsetsTests(BaseRecordsetsTest):
credentials = ["admin", "primary", "alt"]
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 8675b66..22174a6 100644
--- a/designate_tempest_plugin/tests/api/v2/test_recordset_validation.py
+++ b/designate_tempest_plugin/tests/api/v2/test_recordset_validation.py
@@ -14,6 +14,7 @@
limitations under the License.
"""
from oslo_log import log as logging
+from oslo_utils import versionutils
from tempest import config
from tempest.lib import decorators
@@ -222,3 +223,52 @@
self.recordset_client.create_recordset,
self.zone['id'], post_model,
)
+
+ @decorators.idempotent_id('193be0fb-ac25-44a3-ae12-f7776048c31a')
+ def test_create_SVCB_with(self):
+ if not versionutils.is_compatible('2.2', self.api_version,
+ same_major=False):
+ raise self.skipException(
+ 'SVCB record tests require Designate API version 2.2 or '
+ 'newer. Skipping test_create_SVCB_with test.')
+
+ ipv4hint = "1.2.3.4,9.8.7.6"
+ alpn = "h3,h2,http/1.1"
+ port = "888"
+ target = f"sample.{self.zone['name']}"
+ doh = '/dns-query{?dns}'
+ svcb_data_records = [f"1 {target} alpn={alpn} ipv4hint={ipv4hint}"
+ f" port={port} dohpath={doh}"]
+ recordset_data = {
+ 'name': "svcb" + "." + self.zone['name'],
+ 'type': "SVCB",
+ 'records': svcb_data_records,
+ }
+ recordset = self.create_recordset(recordset_data)
+ waiters.wait_for_recordset_status(
+ self.recordset_client, self.zone['id'],
+ recordset['id'], 'ACTIVE')
+
+ @decorators.idempotent_id('758c4367-88a6-4657-908e-4c0785428cf9')
+ def test_create_HTTPS_with(self):
+ if not versionutils.is_compatible('2.2', self.api_version,
+ same_major=False):
+ raise self.skipException(
+ 'HTTPS record tests require Designate API version 2.2 or '
+ 'newer. Skipping test_create_HTTPS_with test.')
+
+ ipv4hint = "1.2.3.4,9.8.7.6"
+ alpn = "h3,h2,http/1.1"
+ port = "4443"
+ target = f"sample.{self.zone['name']}"
+ https_data_records = [f"1 {target} alpn={alpn} ipv4hint={ipv4hint}"
+ f" port={port}"]
+ recordset_data = {
+ 'name': "https" + "." + self.zone['name'],
+ 'type': "HTTPS",
+ 'records': https_data_records,
+ }
+ recordset = self.create_recordset(recordset_data)
+ waiters.wait_for_recordset_status(
+ self.recordset_client, self.zone['id'],
+ recordset['id'], 'ACTIVE')
diff --git a/designate_tempest_plugin/tests/scenario/v2/test_limits.py b/designate_tempest_plugin/tests/scenario/v2/test_limits.py
new file mode 100644
index 0000000..19d5d26
--- /dev/null
+++ b/designate_tempest_plugin/tests/scenario/v2/test_limits.py
@@ -0,0 +1,127 @@
+# Copyright 2021 Red Hat.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+from oslo_log import log as logging
+from tempest import config
+from tempest.lib import decorators
+from tempest.lib import exceptions as lib_exc
+from designate_tempest_plugin.common import constants as const
+from designate_tempest_plugin import data_utils as dns_data_utils
+from designate_tempest_plugin.tests import base
+
+CONF = config.CONF
+LOG = logging.getLogger(__name__)
+
+
+class DesignateLimit(base.BaseDnsV2Test):
+
+ credentials = ["primary", "admin"]
+
+ @classmethod
+ def setup_clients(cls):
+ super(DesignateLimit, cls).setup_clients()
+ cls.limit_client = cls.os_primary.dns_v2.DesignateLimitClient()
+ cls.zone_client = cls.os_primary.dns_v2.ZonesClient()
+ cls.recordset_client = cls.os_primary.dns_v2.RecordsetClient()
+ if CONF.enforce_scope.designate:
+ cls.admin_tld_client = cls.os_system_admin.dns_v2.TldClient()
+ else:
+ cls.admin_tld_client = cls.os_admin.dns_v2.TldClient()
+
+ @classmethod
+ def resource_setup(cls):
+ super(DesignateLimit, cls).resource_setup()
+ cls.project_limits = cls.limit_client.list_designate_limits()
+ cls.tld = cls.admin_tld_client.create_tld(
+ tld_name=dns_data_utils.rand_string(5))[1]
+
+ @classmethod
+ def resource_cleanup(cls):
+ cls.admin_tld_client.delete_tld(cls.tld['id'])
+ super(DesignateLimit, cls).resource_cleanup()
+
+ @decorators.idempotent_id('3d1b09a2-b8be-11ec-86fe-201e8823901f')
+ def test_max_zone_name_length(self):
+ allowed_limit = self.project_limits[
+ 'max_zone_name_length'] - 1 # The final root null byte
+ LOG.info(
+ 'Attempting to create a Zone of length:{}, expected: zone is'
+ ' successfully created'.format(allowed_limit))
+ zone_name = dns_data_utils.rand_dns_name_by_size(allowed_limit)
+ # Use class TLD at the end of generated Zone Name
+ zone_name = zone_name[:-(
+ len(self.tld['name']) + 2)] + '.' + 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'])
+
+ LOG.info(
+ 'Attempting to create a Zone of length:{}, expected: zone is '
+ 'failed to be created'.format(allowed_limit + 1))
+ zone_name = dns_data_utils.rand_dns_name_by_size(allowed_limit + 1)
+ self.assertRaisesDns(
+ lib_exc.BadRequest, 'invalid_object', 400,
+ self.zone_client.create_zone,
+ name=zone_name
+ )
+
+ @decorators.idempotent_id('86646744-b98a-11ec-b3a4-201e8823901f')
+ def test_max_recordset_name_length(self):
+ # The full recordset name is a combination of its short name
+ # and the zone name. e.g., "www" + "example.com." = "www.example.com."
+ # In this section, we'll set the lengths needed for testing.
+ allowed_recordset_limit = self.project_limits[
+ 'max_recordset_name_length'] - 1 # The final root null byte
+ reserved_recordset_length = 10 # Reserved for recordset's host part.
+ zone_name_size = allowed_recordset_limit - reserved_recordset_length
+ zone_name = dns_data_utils.rand_dns_name_by_size(
+ name_size=zone_name_size)
+ # Use class TLD at the end of generated Zone Name
+ zone_name = zone_name[:-(
+ len(self.tld['name']) + 2)] + '.' + self.tld['name'] + '.'
+ max_valid_record_name_size = allowed_recordset_limit - len(zone_name)
+
+ LOG.info('Create a Zone')
+ 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'])
+
+ LOG.info('Recordset name of length:{} is successfully '
+ 'created'.format(allowed_recordset_limit))
+ recordset_data = dns_data_utils.rand_recordset_data(
+ record_type='A',
+ zone_name=zone_name,
+ # Reserve 1 char for the dot between the record name and zone name.
+ name=dns_data_utils.rand_string(
+ max_valid_record_name_size - 1) + '.' + zone_name)
+ recordset = self.recordset_client.create_recordset(
+ zone['id'], recordset_data)[1]
+ self.addCleanup(
+ self.wait_recordset_delete, self.recordset_client,
+ zone['id'], recordset['id'])
+ LOG.info(
+ 'Attempting to create a Recordset of length:{}, expected:'
+ ' Recordset is failed to be created'.format(
+ allowed_recordset_limit + 1))
+ recordset_data = dns_data_utils.rand_recordset_data(
+ record_type='A',
+ zone_name=zone_name,
+ name=dns_data_utils.rand_string(
+ max_valid_record_name_size) + '.' + zone_name)
+
+ self.assertRaisesDns(
+ lib_exc.BadRequest, 'invalid_object', 400,
+ self.recordset_client.create_recordset,
+ zone_uuid=zone['id'],
+ recordset_data=recordset_data)