Example #1
0
    def setUp(self):
        self.cfg = mock.Mock(spec=conf.Configuration)
        self.cfg.san_ip = '127.0.0.1'
        self.cfg.datera_api_port = '7717'
        self.cfg.san_is_local = True
        self.cfg.datera_num_replicas = 1
        self.cfg.datera_503_timeout = 0.01
        self.cfg.datera_503_interval = 0.001
        self.cfg.datera_debug = False
        self.cfg.san_login = '******'
        self.cfg.san_password = '******'
        self.cfg.datera_tenant_id = '/root/test-tenant'
        self.cfg.driver_client_cert = None
        self.cfg.driver_client_cert_key = None
        self.cfg.datera_disable_profiler = False
        self.cfg.datera_ldap_server = ""
        self.cfg.datera_volume_type_defaults = {}
        self.cfg.datera_disable_template_override = False
        self.cfg.datera_disable_extended_metadata = False
        self.cfg.datera_enable_image_cache = False
        self.cfg.datera_image_cache_volume_type_id = ""
        self.cfg.filter_function = lambda: None
        self.cfg.goodness_function = lambda: None
        self.cfg.use_chap_auth = False
        self.cfg.chap_username = ""
        self.cfg.chap_password = ""

        super(DateraVolumeTestCasev22, self).setUp()
        mock_exec = mock.Mock()
        mock_exec.return_value = ('', '')

        self.driver = datera.DateraDriver(execute=mock_exec,
                                          configuration=self.cfg)
        self.driver.api = mock.MagicMock()
        self.driver.apiv = "2.2"

        self.driver.set_initialized()
        # No-op config getter
        self.driver.configuration.get = lambda *args, **kwargs: {}
        # self.addCleanup(self.api_patcher.stop)
        self.driver.datera_version = "3.3.3"
Example #2
0
    def setUp(self):
        super(DateraVolumeTestCasev2, self).setUp()

        self.cfg = mock.Mock(spec=conf.Configuration)
        self.cfg.san_ip = '127.0.0.1'
        self.cfg.san_is_local = True
        self.cfg.datera_api_token = 'secret'
        self.cfg.datera_api_port = '7717'
        self.cfg.datera_num_replicas = '2'
        self.cfg.datera_503_timeout = 0.01
        self.cfg.datera_503_interval = 0.001
        self.cfg.datera_acl_allow_all = False
        self.cfg.datera_debug = False
        self.cfg.san_login = '******'
        self.cfg.san_password = '******'
        self.cfg.datera_tenant_id = 'test-tenant'
        self.cfg.driver_client_cert = None
        self.cfg.driver_client_cert_key = None

        mock_exec = mock.Mock()
        mock_exec.return_value = ('', '')

        self.driver = datera.DateraDriver(execute=mock_exec,
                                          configuration=self.cfg)
        self.driver.set_initialized()
        self.driver.configuration.get = _config_getter
        self.volume = _stub_volume()
        self.api_patcher = mock.patch('cinder.volume.drivers.datera.'
                                      'datera_iscsi.DateraDriver.'
                                      '_issue_api_request')
        self.driver._request = mock.Mock()
        m = mock.Mock()
        m.json.return_value = {'api_versions': ['v2']}
        self.driver._request.return_value = m
        self.mock_api = self.api_patcher.start()
        self._apiv = "2"
        self._tenant = None

        self.addCleanup(self.api_patcher.stop)