From 0c42290126da26fcd007cf44b05c3d2f2457a42a Mon Sep 17 00:00:00 2001 From: zhurong Date: Thu, 6 Jul 2017 14:40:54 +0800 Subject: [PATCH] Unskip test_deploy_app_with_volume_creation test 1.Unskip test_deploy_app_with_volume_creation test 2.change flavor from m1.small to m1.tiny, to reduce the test failing chances. Closes-Bug: #1701230 Change-Id: Ib996bf50e1b7d542b98cf9d7125b824771c143d6 --- .../Classes/resources/CinderVolume.yaml | 3 -- .../scenario/application_catalog/base.py | 41 ++++++++----------- .../test_cinder_volumes.py | 6 +-- 3 files changed, 20 insertions(+), 30 deletions(-) diff --git a/meta/io.murano/Classes/resources/CinderVolume.yaml b/meta/io.murano/Classes/resources/CinderVolume.yaml index 19fdde55e..bb40fd65b 100644 --- a/meta/io.murano/Classes/resources/CinderVolume.yaml +++ b/meta/io.murano/Classes/resources/CinderVolume.yaml @@ -99,9 +99,6 @@ Methods: outputs: format('vol-{0}-id', id($)): value: $.getRef() - format('vol-{0}-attachments', id($)): - value: - get_attr: [$.getResourceName(), attachments_list] deploy: Body: diff --git a/murano_tempest_tests/tests/scenario/application_catalog/base.py b/murano_tempest_tests/tests/scenario/application_catalog/base.py index d81c2ba5e..d158204a0 100644 --- a/murano_tempest_tests/tests/scenario/application_catalog/base.py +++ b/murano_tempest_tests/tests/scenario/application_catalog/base.py @@ -142,7 +142,7 @@ class BaseApplicationCatalogScenarioTest(test.BaseTestCase): return instance['id'] def apache( - self, attributes=None, userName=None, flavor='m1.small'): + self, attributes=None, userName=None, flavor='m1.tiny'): post_body = { "instance": { "flavor": flavor, @@ -169,7 +169,7 @@ class BaseApplicationCatalogScenarioTest(test.BaseTestCase): return post_body def vm_cinder( - self, attributes=None, userName=None, flavor='m1.small'): + self, attributes=None, userName=None, flavor='m1.tiny'): post_body = { "instance": { "flavor": flavor, @@ -197,7 +197,7 @@ class BaseApplicationCatalogScenarioTest(test.BaseTestCase): def vm_test(self, **kwargs): instance = { - "flavor": "m1.small", + "flavor": "m1.tiny", "image": self.cirros_image, "assignFloatingIp": True, "availabilityZone": "nova", @@ -221,7 +221,7 @@ class BaseApplicationCatalogScenarioTest(test.BaseTestCase): } } - def update_executor(self, flavor='m1.small'): + def update_executor(self, flavor='m1.tiny'): post_body = { "instance": { "flavor": flavor, @@ -352,28 +352,23 @@ class BaseApplicationCatalogScenarioTest(test.BaseTestCase): volume_id = output['output_value'] return self.volumes_client.show_volume(volume_id)['volume'] - def get_volume_attachments(self, environment_id): - stack = self.get_stack_id(environment_id) - stack_outputs = self.orchestration_client.\ - show_stack(stack)['stack']['outputs'] - for output in stack_outputs: - if (output['output_key'].startswith('vol-') and - output['output_key'].endswith('-attachments')): - return output['output_value'] - - def check_volume_attachments(self, environment_id): - volume_attachments = self.get_volume_attachments(environment_id) - self.assertIsInstance(volume_attachments, list) - self.assertGreater(len(volume_attachments), 0) - instance_id = self.get_instance_id('testMurano') - for attachment in volume_attachments: - self.assertEqual(attachment.get('server_id'), instance_id) - self.assertTrue(attachment.get('device').startswith('/dev/')) - - def check_volume_attached(self, name, volume_id): + def get_volume_attachments(self, name): instance_id = self.get_instance_id(name) attached_volumes = self.servers_client.\ list_volume_attachments(instance_id)['volumeAttachments'] + return attached_volumes + + def check_volume_attachments(self, name): + volume_attachments = self.get_volume_attachments(name) + self.assertIsInstance(volume_attachments, list) + self.assertGreater(len(volume_attachments), 0) + instance_id = self.get_instance_id(name) + for attachment in volume_attachments: + self.assertEqual(attachment.get('serverId'), instance_id) + self.assertTrue(attachment.get('device').startswith('/dev/')) + + def check_volume_attached(self, name, volume_id): + attached_volumes = self.get_volume_attachments(name) self.assertEqual(attached_volumes[0]['id'], volume_id) diff --git a/murano_tempest_tests/tests/scenario/application_catalog/test_cinder_volumes.py b/murano_tempest_tests/tests/scenario/application_catalog/test_cinder_volumes.py index 3c16a88c1..18e637396 100644 --- a/murano_tempest_tests/tests/scenario/application_catalog/test_cinder_volumes.py +++ b/murano_tempest_tests/tests/scenario/application_catalog/test_cinder_volumes.py @@ -14,7 +14,6 @@ import os import testtools -import unittest from tempest import config @@ -79,7 +78,7 @@ class TestCinderVolumes(base.BaseApplicationCatalogScenarioTest): create_session(environment['id']) post_body = { "instance": { - "flavor": "m1.small", + "flavor": "m1.tiny", "blockDevices": { "volume": { "?": { @@ -160,7 +159,6 @@ class TestCinderVolumes(base.BaseApplicationCatalogScenarioTest): self.check_volume_attached('testMurano', self.volume['id']) - @unittest.expectedFailure # failing, should be fixed as part of #1701230 @testtools.testcase.attr('smoke') @testtools.testcase.attr('scenario') def test_deploy_app_with_volume_creation(self): @@ -199,7 +197,7 @@ class TestCinderVolumes(base.BaseApplicationCatalogScenarioTest): volume_data = self.get_volume(environment['id']) self.check_volume_attached('testMurano', volume_data['id']) - self.check_volume_attachments(environment['id']) + self.check_volume_attachments('testMurano') self.assertEqual(volume_data['size'], 1) @testtools.testcase.attr('smoke')