From 6deb3c5fcbb889302c454f02a96966e5c2767cbc Mon Sep 17 00:00:00 2001 From: Vitaly Gridnev Date: Mon, 19 Sep 2016 13:23:38 +0300 Subject: [PATCH] Fix gate jobs After change Icca91c53eabf18c3109b3931ed53f70eaaaa0e56 method "image_list_detailed" returns list of "Image" instances which inherit from openstack_dashboard.api.base.APIResourceWrapper. For getting "image_type" attribute we need to use "get" method now. Closes-bug: #1624318 Change-Id: I363ddc1bc46a1daa855d1d41920bf8a4a4df2396 --- .../data_processing/clusters/image_registry/forms.py | 3 ++- sahara_dashboard/test/integration_tests/helpers.py | 4 ++-- sahara_dashboard/test/integration_tests/horizon.conf | 2 +- sahara_dashboard/test/integration_tests/tests/test_crud.py | 4 ++-- .../integration_tests/tests/test_sahara_image_registry.py | 6 ++++-- tools/gate/integration/pre_test_hook.sh | 2 ++ 6 files changed, 13 insertions(+), 8 deletions(-) diff --git a/sahara_dashboard/content/data_processing/clusters/image_registry/forms.py b/sahara_dashboard/content/data_processing/clusters/image_registry/forms.py index 86eb8913..cc9979b4 100644 --- a/sahara_dashboard/content/data_processing/clusters/image_registry/forms.py +++ b/sahara_dashboard/content/data_processing/clusters/image_registry/forms.py @@ -66,7 +66,8 @@ class RegisterImageForm(ImageForm): images = self._get_available_images(self.request) choices = [(image.id, image.name) for image in images - if image.properties.get("image_type", '') != "snapshot"] + if image.to_dict()['properties'].get( + "image_type") != "snapshot"] if choices: choices.insert(0, ("", _("Select Image"))) else: diff --git a/sahara_dashboard/test/integration_tests/helpers.py b/sahara_dashboard/test/integration_tests/helpers.py index e1e9f946..473ab5e9 100644 --- a/sahara_dashboard/test/integration_tests/helpers.py +++ b/sahara_dashboard/test/integration_tests/helpers.py @@ -24,8 +24,8 @@ class SaharaTestCase(helpers.AdminTestCase): sahara_group = cfg.OptGroup( 'sahara', help='Sahara specific tests config group') cls.CONFIG.register_group(sahara_group) - fake_http_image = cfg.StrOpt('fake_http_image') - cls.CONFIG.register_opt(fake_http_image, group=sahara_group) + fake_image_location = cfg.StrOpt('fake_image_location') + cls.CONFIG.register_opt(fake_image_location, group=sahara_group) ssh_user = cfg.StrOpt('fake_image_ssh_user') cls.CONFIG.register_opt(ssh_user, group=sahara_group) project_name = cfg.StrOpt('project_name', default='demo') diff --git a/sahara_dashboard/test/integration_tests/horizon.conf b/sahara_dashboard/test/integration_tests/horizon.conf index 2fc0f996..d6363507 100644 --- a/sahara_dashboard/test/integration_tests/horizon.conf +++ b/sahara_dashboard/test/integration_tests/horizon.conf @@ -38,7 +38,7 @@ http_image=https://cloud-images.ubuntu.com/xenial/current/xenial-server-cloudimg [sahara] # http accessible image (string value) -fake_http_image=https://cloud-images.ubuntu.com/xenial/current/xenial-server-cloudimg-amd64-disk1.img +fake_image_location=/tmp/xenial-server-cloudimg-amd64-disk1.img # ssh username for image (string value) fake_image_ssh_user=ubuntu # Floating IP pool name (string value) diff --git a/sahara_dashboard/test/integration_tests/tests/test_crud.py b/sahara_dashboard/test/integration_tests/tests/test_crud.py index 6098cd1d..243befdb 100644 --- a/sahara_dashboard/test/integration_tests/tests/test_crud.py +++ b/sahara_dashboard/test/integration_tests/tests/test_crud.py @@ -53,8 +53,8 @@ class TestCRUDBase(SaharaTestCase): def create_image(self): image_pg = self.home_pg.go_to_compute_imagespage() - image_pg.create_image(self.image_name, - location=self.CONFIG.sahara.fake_http_image) + image_pg.create_image( + self.image_name, image_file=self.CONFIG.sahara.fake_image_location) image_pg._wait_until( lambda x: image_pg.is_image_active(self.image_name), timeout=10 * 60) diff --git a/sahara_dashboard/test/integration_tests/tests/test_sahara_image_registry.py b/sahara_dashboard/test/integration_tests/tests/test_sahara_image_registry.py index 82b4b06b..928e66e8 100644 --- a/sahara_dashboard/test/integration_tests/tests/test_sahara_image_registry.py +++ b/sahara_dashboard/test/integration_tests/tests/test_sahara_image_registry.py @@ -13,16 +13,18 @@ from openstack_dashboard.test.integration_tests import helpers from openstack_dashboard.test.integration_tests.regions import messages +from sahara_dashboard.test.integration_tests.helpers import SaharaTestCase IMAGE_NAME = helpers.gen_random_resource_name("image") -class TestSaharaImageRegistry(helpers.TestCase): +class TestSaharaImageRegistry(SaharaTestCase): def setUp(self): super(TestSaharaImageRegistry, self).setUp() image_pg = self.home_pg.go_to_compute_imagespage() - image_pg.create_image(IMAGE_NAME) + image_pg.create_image( + IMAGE_NAME, image_file=self.CONFIG.sahara.fake_image_location) image_pg.find_message_and_dismiss(messages.SUCCESS) image_pg.wait_until_image_active(IMAGE_NAME) diff --git a/tools/gate/integration/pre_test_hook.sh b/tools/gate/integration/pre_test_hook.sh index c911adc4..6d55af74 100755 --- a/tools/gate/integration/pre_test_hook.sh +++ b/tools/gate/integration/pre_test_hook.sh @@ -5,6 +5,8 @@ set -ex source commons $@ +wget https://cloud-images.ubuntu.com/xenial/current/xenial-server-cloudimg-amd64-disk1.img -O /tmp/xenial-server-cloudimg-amd64-disk1.img + cd /opt/stack/new/horizon/openstack_dashboard/local/local_settings.d mv _20_integration_tests_scaffolds.py.example _20_integration_tests_scaffolds.py