Neutron&Designate DNS integration - some enhancements

1) Increase "build_timeout" for stability purposes
2) Extend "test_port_with_publishing_subnet", so it will now
   cover IPV4 missing test case, it means:"subnet-dns-publish-fixed-ip"
   is set to True for IPV4 subnet.
3) Minor code changes:
   - Using provided by Designate Plugin "wait_until" to reduce
     some code lines
   - Giving names to created instances for debug purposes

Change-Id: I3ff8d4543ae02f107553d621dd18f6f8367b4c61
This commit is contained in:
Arkady Shtempler 2024-09-23 13:17:15 +03:00
parent 5c51c5fe64
commit 489408a1f5

View File

@ -39,6 +39,8 @@ LOG = log.getLogger(__name__)
# when designate_tempest_plugin is not available # when designate_tempest_plugin is not available
dns_base = testtools.try_import('designate_tempest_plugin.tests.base') dns_base = testtools.try_import('designate_tempest_plugin.tests.base')
dns_waiters = testtools.try_import('designate_tempest_plugin.common.waiters') dns_waiters = testtools.try_import('designate_tempest_plugin.common.waiters')
dns_data_utils = testtools.try_import('designate_tempest_plugin.data_utils')
if dns_base: if dns_base:
DNSMixin = dns_base.BaseDnsV2Test DNSMixin = dns_base.BaseDnsV2Test
else: else:
@ -53,7 +55,7 @@ class BaseDNSIntegrationTests(base.BaseTempestTestCase, DNSMixin):
super(BaseDNSIntegrationTests, cls).setup_clients() super(BaseDNSIntegrationTests, cls).setup_clients()
cls.zone_client = cls.os_tempest.dns_v2.ZonesClient() cls.zone_client = cls.os_tempest.dns_v2.ZonesClient()
cls.recordset_client = cls.os_tempest.dns_v2.RecordsetClient() cls.recordset_client = cls.os_tempest.dns_v2.RecordsetClient()
cls.query_client.build_timeout = 30 cls.query_client.build_timeout = 60
@classmethod @classmethod
def skip_checks(cls): def skip_checks(cls):
@ -68,12 +70,13 @@ class BaseDNSIntegrationTests(base.BaseTempestTestCase, DNSMixin):
@utils.requires_ext(extension="dns-integration", service="network") @utils.requires_ext(extension="dns-integration", service="network")
def resource_setup(cls): def resource_setup(cls):
super(BaseDNSIntegrationTests, cls).resource_setup() super(BaseDNSIntegrationTests, cls).resource_setup()
cls.zone = cls.zone_client.create_zone()[1] cls.zone_name = dns_data_utils.rand_zone_name(
cls.addClassResourceCleanup(cls.zone_client.delete_zone, name="basednsintegrationtests")
cls.zone['id'], ignore_errors=lib_exc.NotFound) cls.zone = cls.zone_client.create_zone(
dns_waiters.wait_for_zone_status( name=cls.zone_name, wait_until='ACTIVE')[1]
cls.zone_client, cls.zone['id'], 'ACTIVE') cls.addClassResourceCleanup(
cls.zone_client.delete_zone, cls.zone['id'],
ignore_errors=lib_exc.NotFound)
cls.network = cls.create_network(dns_domain=cls.zone['name']) cls.network = cls.create_network(dns_domain=cls.zone['name'])
cls.subnet = cls.create_subnet(cls.network) cls.subnet = cls.create_subnet(cls.network)
cls.subnet_v6 = cls.create_subnet(cls.network, ip_version=6) cls.subnet_v6 = cls.create_subnet(cls.network, ip_version=6)
@ -250,8 +253,9 @@ class DNSIntegrationExtraTests(BaseDNSIntegrationTests):
@classmethod @classmethod
def resource_setup(cls): def resource_setup(cls):
super(DNSIntegrationExtraTests, cls).resource_setup() super(DNSIntegrationExtraTests, cls).resource_setup()
cls.network2 = cls.create_network() cls.network2 = cls.create_network(
cls.subnet2 = cls.create_subnet(cls.network2) name=data_utils.rand_name('dns_integration_net'))
cls.subnet2 = cls.create_subnet(cls.network2, cidr='10.123.151.0/24')
cls.subnet2_v6 = cls.create_subnet(cls.network2, cls.subnet2_v6 = cls.create_subnet(cls.network2,
ip_version=6, ip_version=6,
dns_publish_fixed_ip=True) dns_publish_fixed_ip=True)
@ -274,6 +278,16 @@ class DNSIntegrationExtraTests(BaseDNSIntegrationTests):
self.client.delete_port(port['id']) self.client.delete_port(port['id'])
self._verify_dns_records(addr_v6, name, record_type='AAAA', self._verify_dns_records(addr_v6, name, record_type='AAAA',
found=False) found=False)
self.client.update_subnet(
self.subnet2['id'], dns_publish_fixed_ip=True)
port = self.create_port(self.network2,
dns_domain=self.zone['name'],
dns_name=name)
addr_v4 = port['fixed_ips'][1 - v6_index]['ip_address']
self._verify_dns_records(addr_v4, name, record_type='A')
self.client.delete_port(port['id'])
self._verify_dns_records(addr_v4, name, record_type='A',
found=False)
class DNSIntegrationDomainPerProjectTests(BaseDNSIntegrationTests): class DNSIntegrationDomainPerProjectTests(BaseDNSIntegrationTests):
@ -286,19 +300,15 @@ class DNSIntegrationDomainPerProjectTests(BaseDNSIntegrationTests):
@classmethod @classmethod
def resource_setup(cls): def resource_setup(cls):
super(BaseDNSIntegrationTests, cls).resource_setup() super(BaseDNSIntegrationTests, cls).resource_setup()
cls.name = data_utils.rand_name('test-domain')
name = data_utils.rand_name('test-domain') cls.zone_name = "%s.%s.%s.zone." % (cls.client.user_id,
zone_name = "%s.%s.%s.zone." % (cls.client.user_id,
cls.client.project_id, cls.client.project_id,
name) cls.name)
dns_domain_template = "<user_id>.<project_id>.%s.zone." % name dns_domain_template = "<user_id>.<project_id>.%s.zone." % cls.name
cls.zone = cls.zone_client.create_zone(
cls.zone = cls.zone_client.create_zone(name=zone_name)[1] name=cls.zone_name, wait_until='ACTIVE')[1]
cls.addClassResourceCleanup(cls.zone_client.delete_zone, cls.addClassResourceCleanup(cls.zone_client.delete_zone,
cls.zone['id'], ignore_errors=lib_exc.NotFound) cls.zone['id'], ignore_errors=lib_exc.NotFound)
dns_waiters.wait_for_zone_status(
cls.zone_client, cls.zone['id'], 'ACTIVE')
cls.network = cls.create_network(dns_domain=dns_domain_template) cls.network = cls.create_network(dns_domain=dns_domain_template)
cls.subnet = cls.create_subnet(cls.network, cls.subnet = cls.create_subnet(cls.network,
dns_publish_fixed_ip=True) dns_publish_fixed_ip=True)