Merge "Ensure VNX unit tests don't sleep"
This commit is contained in:
commit
c811de3066
@ -18,10 +18,8 @@ import re
|
||||
|
||||
from oslo_config import cfg
|
||||
|
||||
from cinder import context
|
||||
from cinder import exception
|
||||
from cinder.objects import fields
|
||||
from cinder import test
|
||||
from cinder.tests.unit import fake_constants
|
||||
from cinder.tests.unit import utils as test_utils
|
||||
from cinder.tests.unit.volume.drivers.dell_emc.vnx import fake_exception \
|
||||
@ -29,24 +27,19 @@ from cinder.tests.unit.volume.drivers.dell_emc.vnx import fake_exception \
|
||||
from cinder.tests.unit.volume.drivers.dell_emc.vnx import fake_storops \
|
||||
as storops
|
||||
from cinder.tests.unit.volume.drivers.dell_emc.vnx import res_mock
|
||||
from cinder.tests.unit.volume.drivers.dell_emc.vnx import test_base
|
||||
from cinder.tests.unit.volume.drivers.dell_emc.vnx import utils
|
||||
from cinder.volume import configuration as conf
|
||||
from cinder.volume.drivers.dell_emc.vnx import adapter
|
||||
from cinder.volume.drivers.dell_emc.vnx import client
|
||||
from cinder.volume.drivers.dell_emc.vnx import common
|
||||
from cinder.volume.drivers.dell_emc.vnx import utils as vnx_utils
|
||||
|
||||
|
||||
class TestCommonAdapter(test.TestCase):
|
||||
class TestCommonAdapter(test_base.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(TestCommonAdapter, self).setUp()
|
||||
self.configuration = conf.Configuration(None)
|
||||
vnx_utils.init_ops(self.configuration)
|
||||
self.configuration.san_ip = '192.168.1.1'
|
||||
self.configuration.storage_vnx_authentication_type = 'global'
|
||||
self.configuration.config_group = 'vnx_backend'
|
||||
self.ctxt = context.get_admin_context()
|
||||
|
||||
@res_mock.mock_driver_input
|
||||
@res_mock.patch_common_adapter
|
||||
@ -1427,18 +1420,14 @@ class TestCommonAdapter(test.TestCase):
|
||||
common_adapter._normalize_config)
|
||||
|
||||
|
||||
class TestISCSIAdapter(test.TestCase):
|
||||
class TestISCSIAdapter(test_base.TestCase):
|
||||
STORAGE_PROTOCOL = common.PROTOCOL_ISCSI
|
||||
|
||||
def setUp(self):
|
||||
super(TestISCSIAdapter, self).setUp()
|
||||
self.configuration = conf.Configuration(None)
|
||||
vnx_utils.init_ops(self.configuration)
|
||||
self.configuration.storage_protocol = self.STORAGE_PROTOCOL
|
||||
|
||||
def tearDown(self):
|
||||
super(TestISCSIAdapter, self).tearDown()
|
||||
|
||||
@res_mock.patch_iscsi_adapter
|
||||
def test_validate_ports_iscsi(self, vnx_iscsi, mocked):
|
||||
all_iscsi_ports = vnx_iscsi.client.get_iscsi_targets()
|
||||
@ -1560,18 +1549,14 @@ class TestISCSIAdapter(test.TestCase):
|
||||
adapter.terminate_connection_cleanup.assert_called()
|
||||
|
||||
|
||||
class TestFCAdapter(test.TestCase):
|
||||
class TestFCAdapter(test_base.TestCase):
|
||||
STORAGE_PROTOCOL = common.PROTOCOL_FC
|
||||
|
||||
def setUp(self):
|
||||
super(TestFCAdapter, self).setUp()
|
||||
self.configuration = conf.Configuration(None)
|
||||
vnx_utils.init_ops(self.configuration)
|
||||
self.configuration.storage_protocol = self.STORAGE_PROTOCOL
|
||||
|
||||
def tearDown(self):
|
||||
super(TestFCAdapter, self).tearDown()
|
||||
|
||||
@res_mock.patch_fc_adapter
|
||||
def test_validate_ports_fc(self, vnx_fc, mocked):
|
||||
all_fc_ports = vnx_fc.client.get_fc_targets()
|
||||
|
31
cinder/tests/unit/volume/drivers/dell_emc/vnx/test_base.py
Normal file
31
cinder/tests/unit/volume/drivers/dell_emc/vnx/test_base.py
Normal file
@ -0,0 +1,31 @@
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
"""Common VNC test needs."""
|
||||
|
||||
from cinder import context
|
||||
from cinder import test
|
||||
from cinder.volume import configuration as conf
|
||||
from cinder.volume.drivers.dell_emc.vnx import common
|
||||
|
||||
|
||||
class TestCase(test.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(TestCase, self).setUp()
|
||||
self.configuration = conf.Configuration(None)
|
||||
self.configuration.san_ip = '192.168.1.1'
|
||||
self.configuration.storage_vnx_authentication_type = 'global'
|
||||
self.configuration.config_group = 'vnx_backend'
|
||||
self.ctxt = context.get_admin_context()
|
||||
common.DEFAULT_TIMEOUT = 0
|
||||
common.INTERVAL_30_SEC = 0
|
@ -15,18 +15,18 @@
|
||||
import unittest
|
||||
|
||||
from cinder import exception
|
||||
from cinder import test
|
||||
from cinder.tests.unit.volume.drivers.dell_emc.vnx import fake_exception \
|
||||
as storops_ex
|
||||
from cinder.tests.unit.volume.drivers.dell_emc.vnx import fake_storops \
|
||||
as storops
|
||||
from cinder.tests.unit.volume.drivers.dell_emc.vnx import res_mock
|
||||
from cinder.tests.unit.volume.drivers.dell_emc.vnx import test_base
|
||||
from cinder.tests.unit.volume.drivers.dell_emc.vnx import utils
|
||||
from cinder.volume.drivers.dell_emc.vnx import client as vnx_client
|
||||
from cinder.volume.drivers.dell_emc.vnx import common as vnx_common
|
||||
|
||||
|
||||
class TestCondition(test.TestCase):
|
||||
class TestCondition(test_base.TestCase):
|
||||
@res_mock.patch_client
|
||||
def test_is_lun_io_ready_false(self, client, mocked):
|
||||
r = vnx_client.Condition.is_lun_io_ready(mocked['lun'])
|
||||
@ -44,17 +44,7 @@ class TestCondition(test.TestCase):
|
||||
mocked['lun'])
|
||||
|
||||
|
||||
class TestClient(test.TestCase):
|
||||
def setUp(self):
|
||||
super(TestClient, self).setUp()
|
||||
self.origin_timeout = vnx_common.DEFAULT_TIMEOUT
|
||||
vnx_common.DEFAULT_TIMEOUT = 0
|
||||
vnx_common.INTERVAL_30_SEC = 0
|
||||
|
||||
def tearDown(self):
|
||||
super(TestClient, self).tearDown()
|
||||
vnx_common.DEFAULT_TIMEOUT = self.origin_timeout
|
||||
vnx_common.INTERVAL_30_SEC = 30
|
||||
class TestClient(test_base.TestCase):
|
||||
|
||||
@res_mock.patch_client
|
||||
def test_create_lun(self, client, mocked):
|
||||
|
@ -16,15 +16,15 @@
|
||||
import mock
|
||||
|
||||
from cinder import exception
|
||||
from cinder import test
|
||||
from cinder.tests.unit.volume.drivers.dell_emc.vnx import fake_storops \
|
||||
as storops
|
||||
from cinder.tests.unit.volume.drivers.dell_emc.vnx import res_mock
|
||||
from cinder.tests.unit.volume.drivers.dell_emc.vnx import test_base
|
||||
from cinder.volume.drivers.dell_emc.vnx import client
|
||||
from cinder.volume.drivers.dell_emc.vnx import common
|
||||
|
||||
|
||||
class TestExtraSpecs(test.TestCase):
|
||||
class TestExtraSpecs(test_base.TestCase):
|
||||
def test_valid_extra_spec(self):
|
||||
extra_spec = {
|
||||
'provisioning:type': 'deduplicated',
|
||||
@ -186,7 +186,7 @@ class FakeConfiguration(object):
|
||||
self.replication_device = []
|
||||
|
||||
|
||||
class TestReplicationDeviceList(test.TestCase):
|
||||
class TestReplicationDeviceList(test_base.TestCase):
|
||||
def setUp(self):
|
||||
super(TestReplicationDeviceList, self).setUp()
|
||||
self.configuration = FakeConfiguration()
|
||||
@ -244,7 +244,7 @@ class TestReplicationDeviceList(test.TestCase):
|
||||
self.assertIn('array_id_1', backend_ids)
|
||||
|
||||
|
||||
class TestVNXMirrorView(test.TestCase):
|
||||
class TestVNXMirrorView(test_base.TestCase):
|
||||
def setUp(self):
|
||||
super(TestVNXMirrorView, self).setUp()
|
||||
self.primary_client = mock.create_autospec(client.Client)
|
||||
|
@ -15,15 +15,13 @@
|
||||
|
||||
import mock
|
||||
|
||||
from cinder import test
|
||||
from cinder.volume import configuration as conf
|
||||
from cinder.tests.unit.volume.drivers.dell_emc.vnx import test_base
|
||||
from cinder.volume.drivers.dell_emc.vnx import driver
|
||||
|
||||
|
||||
class TestVNXDriver(test.TestCase):
|
||||
class TestVNXDriver(test_base.TestCase):
|
||||
def setUp(self):
|
||||
super(TestVNXDriver, self).setUp()
|
||||
self.configuration = conf.Configuration(None)
|
||||
self.fc_adapter_patcher = mock.patch(
|
||||
'cinder.volume.drivers.dell_emc.vnx.adapter.FCAdapter',
|
||||
autospec=True)
|
||||
|
@ -15,24 +15,18 @@
|
||||
|
||||
import mock
|
||||
|
||||
from cinder import context
|
||||
from cinder.objects import fields
|
||||
from cinder import test
|
||||
from cinder.tests.unit.volume.drivers.dell_emc.vnx import res_mock
|
||||
from cinder.tests.unit.volume.drivers.dell_emc.vnx import test_base
|
||||
from cinder.tests.unit.volume.drivers.dell_emc.vnx import utils
|
||||
from cinder.volume import configuration as conf
|
||||
from cinder.volume.drivers.dell_emc.vnx import utils as vnx_utils
|
||||
|
||||
|
||||
class TestReplicationAdapter(test.TestCase):
|
||||
class TestReplicationAdapter(test_base.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(TestReplicationAdapter, self).setUp()
|
||||
self.configuration = conf.Configuration(None)
|
||||
vnx_utils.init_ops(self.configuration)
|
||||
self.configuration.san_ip = '192.168.1.1'
|
||||
self.configuration.storage_vnx_authentication_type = 'global'
|
||||
self.ctxt = context.get_admin_context()
|
||||
|
||||
@utils.patch_group_specs({
|
||||
'consistent_group_replication_enabled': '<is> True'})
|
||||
|
@ -17,14 +17,14 @@ import taskflow.engines
|
||||
from taskflow.patterns import linear_flow
|
||||
from taskflow.types import failure
|
||||
|
||||
from cinder import test
|
||||
from cinder.tests.unit.volume.drivers.dell_emc.vnx import fake_exception \
|
||||
as vnx_ex
|
||||
from cinder.tests.unit.volume.drivers.dell_emc.vnx import res_mock
|
||||
from cinder.tests.unit.volume.drivers.dell_emc.vnx import test_base
|
||||
import cinder.volume.drivers.dell_emc.vnx.taskflows as vnx_taskflow
|
||||
|
||||
|
||||
class TestTaskflow(test.TestCase):
|
||||
class TestTaskflow(test_base.TestCase):
|
||||
def setUp(self):
|
||||
super(TestTaskflow, self).setUp()
|
||||
self.work_flow = linear_flow.Flow('test_task')
|
||||
|
@ -16,12 +16,12 @@
|
||||
import mock
|
||||
|
||||
from cinder import exception
|
||||
from cinder import test
|
||||
from cinder.tests.unit.volume.drivers.dell_emc.vnx import fake_exception \
|
||||
as storops_ex
|
||||
from cinder.tests.unit.volume.drivers.dell_emc.vnx import fake_storops \
|
||||
as storops
|
||||
from cinder.tests.unit.volume.drivers.dell_emc.vnx import res_mock
|
||||
from cinder.tests.unit.volume.drivers.dell_emc.vnx import test_base
|
||||
from cinder.tests.unit.volume.drivers.dell_emc.vnx import utils as ut_utils
|
||||
from cinder.volume.drivers.dell_emc.vnx import common
|
||||
from cinder.volume.drivers.dell_emc.vnx import utils as vnx_utils
|
||||
@ -35,15 +35,7 @@ class FakeDriver(object):
|
||||
return True
|
||||
|
||||
|
||||
class TestUtils(test.TestCase):
|
||||
def setUp(self):
|
||||
super(TestUtils, self).setUp()
|
||||
self.origin_timeout = common.DEFAULT_TIMEOUT
|
||||
common.DEFAULT_TIMEOUT = 0.05
|
||||
|
||||
def tearDown(self):
|
||||
super(TestUtils, self).tearDown()
|
||||
common.DEFAULT_TIMEOUT = self.origin_timeout
|
||||
class TestUtils(test_base.TestCase):
|
||||
|
||||
def test_wait_until(self):
|
||||
mock_testmethod = mock.Mock(return_value=True)
|
||||
|
Loading…
x
Reference in New Issue
Block a user