]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Tests: Fix cxt target tests opening files
authorEric Harney <eharney@redhat.com>
Wed, 18 Feb 2015 18:04:09 +0000 (13:04 -0500)
committerEric Harney <eharney@redhat.com>
Wed, 18 Feb 2015 18:06:49 +0000 (13:06 -0500)
This fixes the test_ensure_export test so that it does
not try to open files from /var/lib/cinder/.

Closes-Bug: #1423261

Change-Id: I79ed64918b2ae7fb5ea8b5cedeb1dca83898c759

cinder/tests/targets/test_cxt_driver.py

index 6182348e5f13328493e4045a38f7ba2ab233759d..e62af497c34251468487ac0a1cd643268c0bc9f7 100644 (file)
@@ -195,7 +195,10 @@ class TestCxtAdmDriver(test.TestCase):
             self.assertTrue(mock_get.called)
             self.assertTrue(mock_execute.called)
 
-    def test_ensure_export(self):
+    @mock.patch('cinder.volume.targets.cxt.CxtAdm._get_target_chap_auth')
+    def test_ensure_export(self, mock_get_chap):
+        fake_creds = ('asdf', 'qwert')
+        mock_get_chap.return_value = fake_creds
         ctxt = context.get_admin_context()
         with mock.patch.object(self.target, 'create_iscsi_target'):
             self.target.ensure_export(ctxt,
@@ -203,6 +206,6 @@ class TestCxtAdmDriver(test.TestCase):
                                       self.fake_volumes_dir)
             self.target.create_iscsi_target.assert_called_once_with(
                 'iqn.2010-10.org.openstack:testvol',
-                1, 0, self.fake_volumes_dir, None,
+                1, 0, self.fake_volumes_dir, fake_creds,
                 check_exit_code=False,
                 old_name=None)