Improve the zone import API tests
This patch improves the zone import API tests such that they will
wait for a completed status before advancing. This not only insures
the test didn't get stuck in "PENDING", but also assures the import
record has been updated with the zone ID allowing the zone to be
cleaned up at test completion.
Change-Id: Ied4d4d37b3e5428f69b6ba2b0cfecb99d7125f2c
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 b139742..1d5f89e 100644
--- a/designate_tempest_plugin/tests/api/v2/test_zones_imports.py
+++ b/designate_tempest_plugin/tests/api/v2/test_zones_imports.py
@@ -62,8 +62,9 @@
LOG.info('Create a zone import')
_, zone_import = self.client.create_zone_import()
self.addCleanup(self.clean_up_resources, zone_import['id'])
- LOG.info('Ensure we respond with PENDING')
- self.assertEqual(const.PENDING, zone_import['status'])
+ # Make sure we complete the import and have the zone_id for cleanup
+ waiters.wait_for_zone_import_status(
+ self.client, zone_import['id'], const.COMPLETE)
@decorators.idempotent_id('31eaf25a-9532-11eb-a55d-74e5f9e2a801')
def test_create_zone_import_invalid_ttl(self):
@@ -89,6 +90,9 @@
LOG.info('Create a zone import')
_, zone_import = self.client.create_zone_import()
self.addCleanup(self.clean_up_resources, zone_import['id'])
+ # Make sure we complete the import and have the zone_id for cleanup
+ waiters.wait_for_zone_import_status(
+ self.client, zone_import['id'], const.COMPLETE)
LOG.info('Re-Fetch the zone import')
resp, body = self.client.show_zone_import(zone_import['id'])
@@ -119,6 +123,9 @@
LOG.info('Create a zone import')
_, zone_import = self.client.create_zone_import()
self.addCleanup(self.clean_up_resources, zone_import['id'])
+ # Make sure we complete the import and have the zone_id for cleanup
+ waiters.wait_for_zone_import_status(
+ self.client, zone_import['id'], const.COMPLETE)
LOG.info('List zones imports')
_, body = self.client.list_zone_imports()
@@ -132,8 +139,9 @@
zone_import = self.client.create_zone_import()[1]
self.addCleanup(self.clean_up_resources, zone_import['id'])
- LOG.info('Ensure we respond with PENDING')
- self.assertEqual(const.PENDING, zone_import['status'])
+ # Make sure we complete the import and have the zone_id for cleanup
+ waiters.wait_for_zone_import_status(
+ self.client, zone_import['id'], const.COMPLETE)
LOG.info('Show a zone import for a Primary tenant, using Alt tenant. '
'Expected:404 NotFound')
@@ -172,6 +180,9 @@
LOG.info('Create import zone "A" using primary client')
zone_import = self.client.create_zone_import()[1]
self.addCleanup(self.clean_up_resources, zone_import['id'])
+ # Make sure we complete the import and have the zone_id for cleanup
+ waiters.wait_for_zone_import_status(
+ self.client, zone_import['id'], const.COMPLETE)
LOG.info('As Alt user list import zones for a Primary tenant, '
'using "x-auth-sudo-project-id" HTTP header. '