Improve logging

This commit is contained in:
Aurelien Lourot
2020-09-22 16:18:09 +02:00
parent 1ab3aea3a5
commit 49268243ba
2 changed files with 10 additions and 11 deletions
@@ -63,7 +63,7 @@ class CinderBackupTest(test_utils.OpenStackBaseTest):
self.cinder_client.volumes,
vol_new.id,
expected_status="available",
msg="Volume status wait")
msg="Extended volume")
def test_410_cinder_vol_create_backup_delete_restore_pool_inspect(self):
"""Create, backup, delete, restore a ceph-backed cinder volume.
@@ -99,7 +99,7 @@ class CinderBackupTest(test_utils.OpenStackBaseTest):
wait_iteration_max_time=180,
stop_after_attempt=30,
expected_status='available',
msg='Volume status wait')
msg='ceph-backed cinder volume')
# Backup the volume
vol_backup = self.cinder_client.backups.create(
@@ -111,7 +111,7 @@ class CinderBackupTest(test_utils.OpenStackBaseTest):
wait_iteration_max_time=180,
stop_after_attempt=30,
expected_status='available',
msg='Volume status wait')
msg='Backup volume')
# Delete the volume
openstack_utils.delete_volume(self.cinder_client, cinder_vol.id)
# Restore the volume
@@ -122,7 +122,7 @@ class CinderBackupTest(test_utils.OpenStackBaseTest):
wait_iteration_max_time=180,
stop_after_attempt=15,
expected_status='available',
msg='Backup status wait')
msg='Restored backup volume')
# Delete the backup
openstack_utils.delete_volume_backup(
self.cinder_client,
+6 -7
View File
@@ -1896,14 +1896,13 @@ def _resource_reaches_status(resource, resource_id,
:param expected_status: status to expect resource to reach
:type expected_status: str
:param msg: text to identify purpose in logging
:type msy: str
:type msg: str
:raises: AssertionError
"""
resource_status = resource.get(resource_id).status
logging.info(resource_status)
assert resource_status == expected_status, (
"Resource in {} state, waiting for {}" .format(resource_status,
expected_status,))
logging.info("{}: resource {} in {} state, waiting for {}".format(
msg, resource_id, resource_status, expected_status))
assert resource_status == expected_status
def resource_reaches_status(resource,
@@ -1965,8 +1964,8 @@ def _resource_removed(resource, resource_id, msg="resource"):
:raises: AssertionError
"""
matching = [r for r in resource.list() if r.id == resource_id]
logging.debug("Resource {} still present".format(resource_id))
assert len(matching) == 0, "Resource {} still present".format(resource_id)
logging.debug("{}: resource {} still present".format(msg, resource_id))
assert len(matching) == 0
def resource_removed(resource,