From: Walter A. Boring IV Date: Thu, 24 Jul 2014 21:52:51 +0000 (-0700) Subject: Fix no handlers could be found issue X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=e8273cdb3f4a838aad78f298658f7685bc90d02f;p=openstack-build%2Fcinder-build.git Fix no handlers could be found issue This patch fixes the error message during unit tests for 2 issues. 1) test_migrations tries to LOG and exception before setUp is called because of the method decorator. 2) the hp_lefthand_rest_proxy tries to LOG an exception for a missing import. Change-Id: I11d2c9320c0a216b5795207488b906795d27b1e0 Closes-Bug: #1341752 --- diff --git a/cinder/tests/test_migrations.py b/cinder/tests/test_migrations.py index 156fdc362..5063d58aa 100644 --- a/cinder/tests/test_migrations.py +++ b/cinder/tests/test_migrations.py @@ -1,4 +1,3 @@ - # Copyright 2010-2011 OpenStack Foundation # All Rights Reserved. # @@ -36,11 +35,8 @@ import testtools import cinder.db.migration as migration import cinder.db.sqlalchemy.migrate_repo from cinder.db.sqlalchemy.migration import versioning_api as migration_api -from cinder.openstack.common import log as logging from cinder import test -LOG = logging.getLogger('cinder.tests.test_migrations') - def _get_connect_string(backend, user="openstack_citest", @@ -79,7 +75,6 @@ def _is_backend_avail(backend, except Exception: # intentionally catch all to handle exceptions even if we don't # have any backend code loaded. - LOG.exception("Backend %s is not available", backend) return False else: connection.close() @@ -126,7 +121,6 @@ class TestMigrations(test.TestCase): # Load test databases from the config file. Only do this # once. No need to re-run this on each test... - LOG.debug('config_path is %s' % TestMigrations.CONFIG_FILE_PATH) if not self.test_databases: if os.path.exists(TestMigrations.CONFIG_FILE_PATH): cp = ConfigParser.RawConfigParser() @@ -172,7 +166,6 @@ class TestMigrations(test.TestCase): proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True) output = proc.communicate()[0] - LOG.debug(output) self.assertEqual(0, proc.returncode) for key, engine in self.engines.items(): @@ -328,8 +321,6 @@ class TestMigrations(test.TestCase): migration_api.upgrade(engine, TestMigrations.REPOSITORY, migration.db_initial_version() + 1) - LOG.debug('latest version is %s' % TestMigrations.REPOSITORY.latest) - for version in xrange(migration.db_initial_version() + 2, TestMigrations.REPOSITORY.latest + 1): # upgrade -> downgrade -> upgrade @@ -387,8 +378,6 @@ class TestMigrations(test.TestCase): if check: check(engine, data) except Exception: - LOG.error("Failed to migrate to version %s on engine %s" % - (version, engine)) raise # migration 004 - change volume types to UUID diff --git a/cinder/volume/drivers/san/hp/hp_lefthand_rest_proxy.py b/cinder/volume/drivers/san/hp/hp_lefthand_rest_proxy.py index 3353811f0..97fe7eda5 100644 --- a/cinder/volume/drivers/san/hp/hp_lefthand_rest_proxy.py +++ b/cinder/volume/drivers/san/hp/hp_lefthand_rest_proxy.py @@ -32,7 +32,7 @@ try: from hplefthandclient import client from hplefthandclient import exceptions as hpexceptions except ImportError: - LOG.error(_('Module hplefthandclient not installed.')) + import cinder.tests.fake_hp_lefthand_client as hplefthandclient hplefthand_opts = [ cfg.StrOpt('hplefthand_api_url',