Esempio n. 1
0
    def test_get_config_for_backend_not_configured(self):
        self.mock_object(data_motion, "CONF")
        data_motion.CONF.list_all_sections.return_value = []

        config = data_motion.get_backend_configuration(self.backend)

        self.assertIsNone(config)
Esempio n. 2
0
    def test_get_config_for_backend(self):
        self.mock_object(data_motion, "CONF")
        data_motion.CONF.list_all_sections.return_value = [self.backend]

        config = data_motion.get_backend_configuration(self.backend)

        self.assertEqual(self.backend, config.share_backend_name)
Esempio n. 3
0
    def test_get_config_for_backend(self):
        self.mock_object(data_motion, "CONF")
        CONF.set_override("netapp_vserver", 'fake_vserver', group=self.backend)
        data_motion.CONF.list_all_sections.return_value = [self.backend]

        config = data_motion.get_backend_configuration(self.backend)

        self.assertEqual('fake_vserver', config.netapp_vserver)
Esempio n. 4
0
    def test_get_config_for_backend_different_backend_name(self):
        self.mock_object(data_motion, "CONF")
        CONF.set_override("netapp_vserver",
                          'fake_vserver',
                          group=self.backend,
                          enforce_type=True)
        CONF.set_override("share_backend_name",
                          "fake_backend_name",
                          group=self.backend,
                          enforce_type=True)
        data_motion.CONF.list_all_sections.return_value = [self.backend]

        config = data_motion.get_backend_configuration(self.backend)

        self.assertEqual('fake_vserver', config.netapp_vserver)
        self.assertEqual('fake_backend_name', config.share_backend_name)
Esempio n. 5
0
    def test_get_config_for_backend_share_backend_name_mismatch(self):
        self.mock_object(data_motion, "CONF")
        configuration.Configuration(driver.share_opts,
                                    config_group='my_happy_stanza')
        self.config.append_config_values(na_opts.netapp_cluster_opts)
        self.config.append_config_values(na_opts.netapp_connection_opts)
        self.config.append_config_values(na_opts.netapp_basicauth_opts)
        self.config.append_config_values(na_opts.netapp_transport_opts)
        self.config.append_config_values(na_opts.netapp_support_opts)
        self.config.append_config_values(na_opts.netapp_provisioning_opts)
        self.config.append_config_values(na_opts.netapp_replication_opts)
        CONF.set_override("share_backend_name",
                          self.backend,
                          group='my_happy_stanza')
        data_motion.CONF.list_all_sections.return_value = ['my_happy_stanza']

        config = data_motion.get_backend_configuration(self.backend)

        self.assertEqual(self.backend, config.share_backend_name)