Tintri: Inherit tests from BaseDriverTestCase

The Tintri tests would fail when run alone using:

tox -e py35 -- cinder.tests.unit.volume.drivers.test_tintri

This fixes that by making sure things are properly initialized by
inheriting from the BaseDriverTestCase instead of TestCase directly.

Closes-bug: #1791089

Change-Id: I7057da284edec743243a54909d313aa2910d8d0d
Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
(cherry picked from commit 9585e6a152)
This commit is contained in:
Sean McGinnis 2018-09-06 08:12:16 -05:00
parent 5c1f6c0535
commit c8baa2821b
1 changed files with 9 additions and 11 deletions

View File

@ -22,11 +22,11 @@ from oslo_utils import units
from cinder import context
from cinder import exception
from cinder import test
from cinder.tests.unit import fake_constants as fake
from cinder.tests.unit import fake_snapshot
from cinder.tests.unit import fake_volume
from cinder.tests.unit import utils as cinder_utils
from cinder.tests.unit.volume import test_driver
from cinder.volume.drivers.tintri import TClient
from cinder.volume.drivers.tintri import TintriDriver
@ -42,12 +42,17 @@ class FakeImage(object):
@ddt.ddt
class TintriDriverTestCase(test.TestCase):
class TintriDriverTestCase(test_driver.BaseDriverTestCase):
driver_name = 'cinder.volume.drivers.tintri.TintriDriver'
def setUp(self):
super(TintriDriverTestCase, self).setUp()
self.context = context.get_admin_context()
kwargs = {'configuration': self.create_configuration()}
self._driver = TintriDriver(**kwargs)
self.configuration.nfs_mount_point_base = '/mnt/test'
self.configuration.nfs_mount_options = None
self.configuration.nas_mount_options = None
self._driver = TintriDriver(configuration=self.configuration)
self._driver._hostname = 'host'
self._driver._username = 'user'
self._driver._password = 'password'
@ -57,13 +62,6 @@ class TintriDriverTestCase(test.TestCase):
self._driver._mounted_shares = [self._provider_location]
self.fake_stubs()
def create_configuration(self):
configuration = mock.Mock()
configuration.nfs_mount_point_base = '/mnt/test'
configuration.nfs_mount_options = None
configuration.nas_mount_options = None
return configuration
def fake_stubs(self):
self.mock_object(TClient, 'login', self.fake_login)
self.mock_object(TClient, 'logout', self.fake_logout)