]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
GlusterFS tests: Mock out compute, don't load novaclient
authorEric Harney <eharney@redhat.com>
Thu, 19 Jun 2014 16:57:51 +0000 (12:57 -0400)
committerEric Harney <eharney@redhat.com>
Thu, 19 Jun 2014 17:01:10 +0000 (13:01 -0400)
Mock out the compute library for these tests, which prevents loading
the novaclient library.

This makes these tests more reliable, as currently the novaclient
lib interferes with our mocking of os.path.exists in these tests
in some test configurations.

This should also make the GlusterFS tests slightly more efficient
since they were previously loading the novaclient python library
but did not really need to.

Change-Id: I49e858b8536e30572b6231f209a35578460fff96

cinder/tests/test_glusterfs.py

index 82ed0321c2301480ea18f6415dfea4d89bcbb92a..3ea42b4e2eee9ca7b9d160fa5801b5e7ee6a8551 100644 (file)
@@ -27,6 +27,7 @@ from mox import stubout
 from oslo.config import cfg
 
 from cinder import brick
+from cinder import compute
 from cinder import context
 from cinder import db
 from cinder import exception
@@ -98,6 +99,7 @@ class GlusterFsDriverTestCase(test.TestCase):
             glusterfs.GlusterfsDriver(configuration=self._configuration,
                                       db=FakeDb())
         self._driver.shares = {}
+        compute.API = mock.MagicMock()
         self.addCleanup(self._mox.UnsetStubs)
 
     def stub_out_not_replaying(self, obj, attr_name):