]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Fix no handlers could be found issue
authorWalter A. Boring IV <walter.boring@hp.com>
Thu, 24 Jul 2014 21:52:51 +0000 (14:52 -0700)
committerWalter A. Boring IV <walter.boring@hp.com>
Fri, 25 Jul 2014 00:01:58 +0000 (17:01 -0700)
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

cinder/tests/test_migrations.py
cinder/volume/drivers/san/hp/hp_lefthand_rest_proxy.py

index 156fdc36260d8cddda73ecdc14f67ee5175a03cd..5063d58aa696f5f260ca8e83b5f5146ec04063ea 100644 (file)
@@ -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
index 3353811f078851709b886a4cb0b428db45f09894..97fe7eda59e02cd47fdba38abc5857703fc15335 100644 (file)
@@ -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',