From 1f578a07a36ec3c0bd40548873d9c7c79822ddac Mon Sep 17 00:00:00 2001 From: Vu Tran Date: Mon, 16 Jun 2014 21:44:13 -0400 Subject: glance builtin tests config location and missing packages Many glance built-in testcases failed because they can not find glance configuration files, as these testcases assume that they are run at python site-packages dir. So forcing these failure testcases to look for these confiugration file using absolute path. Also some tests fail because of missing two packages: python-psutil and qpid-python. So add these packages into glance-tests RDEPENDS Signed-off-by: Vu Tran --- ...ance-change-builtin-tests-config-location.patch | 88 ++++++++++++++++++++++ .../recipes-devtools/python/python-glance_git.bb | 8 ++ 2 files changed, 96 insertions(+) create mode 100644 meta-openstack/recipes-devtools/python/python-glance/glance-change-builtin-tests-config-location.patch (limited to 'meta-openstack/recipes-devtools/python') diff --git a/meta-openstack/recipes-devtools/python/python-glance/glance-change-builtin-tests-config-location.patch b/meta-openstack/recipes-devtools/python/python-glance/glance-change-builtin-tests-config-location.patch new file mode 100644 index 0000000..4f82a53 --- /dev/null +++ b/meta-openstack/recipes-devtools/python/python-glance/glance-change-builtin-tests-config-location.patch @@ -0,0 +1,88 @@ +glance change builtin tests config location + +Many glance built-in testcases failed because they +can not find glance configuration files, as these +testcases assume that they are run at python +site-packages dir. + +So forcing these failure testcases to look for +these configuration files using absolute path. + +Signed-off-by: Vu Tran + +diff --git a/glance/tests/functional/__init__.py b/glance/tests/functional/__init__.py +index 1256133..01adb81 100644 +--- a/glance/tests/functional/__init__.py ++++ b/glance/tests/functional/__init__.py +@@ -900,7 +900,7 @@ class FunctionalTest(test_utils.BaseTestCase): + return engine.execute(sql) + + def copy_data_file(self, file_name, dst_dir): +- src_file_name = os.path.join('glance/tests/etc', file_name) ++ src_file_name = os.path.join('%PYTHON_SITEPACKAGES_DIR%/glance/tests/etc', file_name) + shutil.copy(src_file_name, dst_dir) + dst_file_name = os.path.join(dst_dir, file_name) + return dst_file_name +diff --git a/glance/tests/unit/api/test_common.py b/glance/tests/unit/api/test_common.py +index 8892025..2aac6b7 100644 +--- a/glance/tests/unit/api/test_common.py ++++ b/glance/tests/unit/api/test_common.py +@@ -137,7 +137,7 @@ class TestMalformedRequest(test_utils.BaseTestCase): + super(TestMalformedRequest, self).setUp() + self.config(flavor='', + group='paste_deploy', +- config_file='etc/glance-api-paste.ini') ++ config_file='/etc/glance/glance-api-paste.ini') + self.api = config.load_paste_app('glance-api') + + def test_redirect_incomplete_url(self): +diff --git a/glance/tests/unit/base.py b/glance/tests/unit/base.py +index 4a19730..16ec103 100644 +--- a/glance/tests/unit/base.py ++++ b/glance/tests/unit/base.py +@@ -76,7 +76,7 @@ class IsolatedUnitTest(StoreClearingUnitTest): + registry=self.registry) + + def _copy_data_file(self, file_name, dst_dir): +- src_file_name = os.path.join('glance/tests/etc', file_name) ++ src_file_name = os.path.join('%PYTHON_SITEPACKAGES_DIR%/glance/tests/etc', file_name) + shutil.copy(src_file_name, dst_dir) + dst_file_name = os.path.join(dst_dir, file_name) + return dst_file_name +diff --git a/glance/tests/unit/common/test_config.py b/glance/tests/unit/common/test_config.py +index 2dfede1..422a458 100644 +--- a/glance/tests/unit/common/test_config.py ++++ b/glance/tests/unit/common/test_config.py +@@ -64,8 +64,7 @@ class TestPasteApp(test_utils.BaseTestCase): + + paste_to = temp_file.replace('.conf', '-paste.ini') + if not paste_config_file and make_paste_file: +- paste_from = os.path.join(os.getcwd(), +- 'etc/glance-registry-paste.ini') ++ paste_from = '/etc/glance/glance-registry-paste.ini' + _appendto(paste_from, paste_to, paste_append) + + app = config.load_paste_app('glance-registry') +@@ -90,8 +89,7 @@ class TestPasteApp(test_utils.BaseTestCase): + paste_append=pipeline) + + def test_load_paste_app_with_paste_config_file(self): +- paste_config_file = os.path.join(os.getcwd(), +- 'etc/glance-registry-paste.ini') ++ paste_config_file = '/etc/glance/glance-registry-paste.ini' + expected_middleware = context.UnauthenticatedContextMiddleware + self._do_test_load_paste_app(expected_middleware, + paste_config_file=paste_config_file) +diff --git a/glance/tests/utils.py b/glance/tests/utils.py +index 760824c..db598ba 100644 +--- a/glance/tests/utils.py ++++ b/glance/tests/utils.py +@@ -67,7 +67,7 @@ class BaseTestCase(testtools.TestCase): + self.config(property_protection_file=self.property_file) + + def _copy_data_file(self, file_name, dst_dir): +- src_file_name = os.path.join('glance/tests/etc', file_name) ++ src_file_name = os.path.join('%PYTHON_SITEPACKAGES_DIR%/glance/tests/etc', file_name) + shutil.copy(src_file_name, dst_dir) + dst_file_name = os.path.join(dst_dir, file_name) + return dst_file_name diff --git a/meta-openstack/recipes-devtools/python/python-glance_git.bb b/meta-openstack/recipes-devtools/python/python-glance_git.bb index 54aaca2..14ce2bd 100644 --- a/meta-openstack/recipes-devtools/python/python-glance_git.bb +++ b/meta-openstack/recipes-devtools/python/python-glance_git.bb @@ -10,6 +10,7 @@ SRCNAME = "glance" SRC_URI = "git://github.com/openstack/${SRCNAME}.git;branch=stable/icehouse \ file://0001-glance-store-only-load-known-stores-not-all-stores.patch \ file://glance.init \ + file://glance-change-builtin-tests-config-location.patch \ " SRCREV="556eebb7780b55af87c0fe49b76593f833ea189a" @@ -27,6 +28,12 @@ GLANCE_KNOWN_STORES ?= "glance.store.rbd.Store,\ glance.store.http.Store" +do_install_prepend() { + sed 's:%PYTHON_SITEPACKAGES_DIR%:${PYTHON_SITEPACKAGES_DIR}:g' -i ${S}/${SRCNAME}/tests/functional/__init__.py + sed 's:%PYTHON_SITEPACKAGES_DIR%:${PYTHON_SITEPACKAGES_DIR}:g' -i ${S}/${SRCNAME}/tests/unit/base.py + sed 's:%PYTHON_SITEPACKAGES_DIR%:${PYTHON_SITEPACKAGES_DIR}:g' -i ${S}/${SRCNAME}/tests/utils.py +} + do_install_append() { TEMPLATE_CONF_DIR=${S}${sysconfdir} GLANCE_CONF_DIR=${D}${sysconfdir}/glance @@ -153,6 +160,7 @@ RDEPENDS_${SRCNAME} = "${PN} \ RDEPENDS_${SRCNAME}-api = "${SRCNAME}" RDEPENDS_${SRCNAME}-registry = "${SRCNAME}" RDEPENDS_${SRCNAME}-setup = "postgresql sudo ${SRCNAME}" +RDEPENDS_${SRCNAME}-tests = "python-psutil qpid-python" INITSCRIPT_PACKAGES = "${SRCNAME}-api ${SRCNAME}-registry" INITSCRIPT_NAME_${SRCNAME}-api = "glance-api" -- cgit v1.2.3-54-g00ecf