Add a zone export scenario test
This renames a couple of the zone export client methods. It also
fixes an issue with the (newly named) `show_exported_zone` function
which wasn't passing the right number of arguments.
Change-Id: Ie0cce8710e0ef17dc391cb5bdd150a63b57d2f72
diff --git a/designate_tempest_plugin/common/waiters.py b/designate_tempest_plugin/common/waiters.py
index efd3625..d13465d 100644
--- a/designate_tempest_plugin/common/waiters.py
+++ b/designate_tempest_plugin/common/waiters.py
@@ -116,6 +116,39 @@
raise lib_exc.TimeoutException(message)
+def wait_for_zone_export_status(client, zone_export_id, status):
+ """Waits for an exported zone to reach the given status."""
+ LOG.info('Waiting for zone export %s to reach %s', zone_export_id, status)
+
+ _, zone_export = client.show_zone_export(zone_export_id)
+ start = int(time.time())
+
+ while zone_export['status'] != status:
+ time.sleep(client.build_interval)
+ _, zone_export = client.show_zone_export(zone_export_id)
+ status_curr = zone_export['status']
+ if status_curr == status:
+ LOG.info('Zone export %s reached %s', zone_export_id, status)
+ return
+
+ if int(time.time()) - start >= client.build_timeout:
+ message = ('Zone export %(zone_export_id)s failed to reach '
+ 'status=%(status)s within the required time '
+ '(%(timeout)s s). Current '
+ 'status: %(status_curr)s' %
+ {'zone_export_id': zone_export_id,
+ 'status': status,
+ 'status_curr': status_curr,
+ 'timeout': client.build_timeout})
+
+ caller = misc_utils.find_test_caller()
+
+ if caller:
+ message = '(%s) %s' % (caller, message)
+
+ raise lib_exc.TimeoutException(message)
+
+
def wait_for_recordset_status(client, recordset_id, status):
"""Waits for a recordset to reach the given status."""
LOG.info('Waiting for recordset %s to reach %s',