diff options
| author | Stephen Finucane <sfinucan@redhat.com> | 2021-12-06 10:24:15 +0000 |
|---|---|---|
| committer | Stephen Finucane <sfinucan@redhat.com> | 2021-12-09 17:23:32 +0000 |
| commit | b3cb85f1123b15c1ec4fafac9dcedc9381072a8b (patch) | |
| tree | 78bfccf09c5f5a4af3cc3195ec43857aae1af9f5 /openstackclient/tests/functional/compute | |
| parent | 4e9b9298429f5db505987853f98d2388b6745b13 (diff) | |
| download | python-openstackclient-b3cb85f1123b15c1ec4fafac9dcedc9381072a8b.tar.gz | |
tests: Improve logging for executed commands
We're seeing failures in a recently added tests,
'ServerTests.test_server_add_remove_volume' from
'openstackclient/tests/functional/compute/v2/test_server.py'. These
failures are likely the result of slow CI nodes, but we don't have
enough information in the CI logs to debug them. Starting logging the
various commands executed in tests so that we can see these logs if and
when tests fail.
Change-Id: I4584dc5e6343fe8c8544431a527d8c3c7e7b3c5b
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
Diffstat (limited to 'openstackclient/tests/functional/compute')
| -rw-r--r-- | openstackclient/tests/functional/compute/v2/test_server.py | 33 |
1 files changed, 25 insertions, 8 deletions
diff --git a/openstackclient/tests/functional/compute/v2/test_server.py b/openstackclient/tests/functional/compute/v2/test_server.py index cf4bcbc2..0558ef62 100644 --- a/openstackclient/tests/functional/compute/v2/test_server.py +++ b/openstackclient/tests/functional/compute/v2/test_server.py @@ -1195,19 +1195,19 @@ class ServerTests(common.ComputeTestCase): def test_server_add_remove_volume(self): volume_wait_for = volume_common.BaseVolumeTests.wait_for_status - name = uuid.uuid4().hex + server_name = uuid.uuid4().hex cmd_output = json.loads(self.openstack( 'server create -f json ' + '--network private ' + '--flavor ' + self.flavor_name + ' ' + '--image ' + self.image_name + ' ' + '--wait ' + - name + server_name )) self.assertIsNotNone(cmd_output['id']) - self.assertEqual(name, cmd_output['name']) - self.addCleanup(self.openstack, 'server delete --wait ' + name) + self.assertEqual(server_name, cmd_output['name']) + self.addCleanup(self.openstack, 'server delete --wait ' + server_name) server_id = cmd_output['id'] volume_name = uuid.uuid4().hex @@ -1225,7 +1225,7 @@ class ServerTests(common.ComputeTestCase): cmd_output = json.loads(self.openstack( 'server add volume -f json ' + - name + ' ' + + server_name + ' ' + volume_name + ' ' + '--tag bar' )) @@ -1237,7 +1237,7 @@ class ServerTests(common.ComputeTestCase): cmd_output = json.loads(self.openstack( 'server volume list -f json ' + - name + server_name )) self.assertEqual(volume_attachment_id, cmd_output[0]['ID']) @@ -1245,8 +1245,25 @@ class ServerTests(common.ComputeTestCase): self.assertEqual(volume_id, cmd_output[0]['Volume ID']) volume_wait_for('volume', volume_name, 'in-use') - self.openstack('server remove volume ' + name + ' ' + volume_name) + + cmd_output = json.loads(self.openstack( + 'server event list -f json ' + + server_name + )) + self.assertEqual(2, len(cmd_output)) + self.assertIn('attach_volume', {x['Action'] for x in cmd_output}) + + self.openstack( + 'server remove volume ' + server_name + ' ' + volume_name + ) volume_wait_for('volume', volume_name, 'available') - raw_output = self.openstack('server volume list ' + name) + cmd_output = json.loads(self.openstack( + 'server event list -f json ' + + server_name + )) + self.assertEqual(3, len(cmd_output)) + self.assertIn('detach_volume', {x['Action'] for x in cmd_output}) + + raw_output = self.openstack('server volume list ' + server_name) self.assertEqual('\n', raw_output) |
