Exemple #1
0
 def setUp(self):
     super(GuestAgentManagerTest, self).setUp()
     self.manager = Manager()
     self.context = TroveContext()
     self.patcher_rs = patch(
         'trove.guestagent.strategies.replication.get_instance')
     self.mock_rs_class = self.patcher_rs.start()
Exemple #2
0
 def setUp(self):
     super(GuestAgentManagerTest, self).setUp()
     self.manager = Manager()
     self.context = trove_testtools.TroveTestContext(self)
     self.patcher_rs = patch(self.manager.replication_namespace + "." +
                             self.manager.replication_strategy)
     self.mock_rs_class = self.patcher_rs.start()
Exemple #3
0
    def setUp(self):
        super(GuestAgentManagerTest, self).setUp()
        self.manager = Manager()
        self.context = TroveContext()
        self.patcher_rs = patch(
            'trove.guestagent.strategies.replication.get_instance')
        self.mock_rs_class = self.patcher_rs.start()

        status_patcher = patch.object(dbaas.PXCAppStatus,
                                      'get',
                                      return_value=MagicMock())
        self.addCleanup(status_patcher.stop)
        self.status_get_mock = status_patcher.start()
Exemple #4
0
 def setUp(self):
     super(GuestAgentManagerTest, self).setUp()
     self.manager = Manager()
     self.context = TroveContext()
     self.patcher_rs = patch(
         'trove.guestagent.strategies.replication.get_instance')
     self.mock_rs_class = self.patcher_rs.start()
Exemple #5
0
 def setUp(self):
     super(GuestAgentManagerTest, self).setUp()
     self.manager = Manager()
     self.context = TroveContext()
     self.patcher_rs = patch(self.manager.replication_namespace + "." +
                             self.manager.replication_strategy)
     self.mock_rs_class = self.patcher_rs.start()
Exemple #6
0
class GuestAgentManagerTest(trove_testtools.TestCase):

    def setUp(self):
        super(GuestAgentManagerTest, self).setUp()
        self.manager = Manager()
        self.context = TroveContext()
        self.patcher_rs = patch(
            'trove.guestagent.strategies.replication.get_instance')
        self.mock_rs_class = self.patcher_rs.start()

        status_patcher = patch.object(dbaas.PXCAppStatus, 'get',
                                      return_value=MagicMock())
        self.addCleanup(status_patcher.stop)
        self.status_get_mock = status_patcher.start()

    def tearDown(self):
        super(GuestAgentManagerTest, self).tearDown()
        self.patcher_rs.stop()

    @patch.object(dbaas.PXCApp, 'install_cluster')
    def test_install_cluster(self, install_cluster_mock):
        replication_user = "******"
        configuration = "configuration"
        bootstrap = True
        self.manager.install_cluster(self.context, replication_user,
                                     configuration, bootstrap)
        self.status_get_mock.assert_any_call()
        install_cluster_mock.assert_called_with(
            replication_user, configuration, bootstrap)

    @patch.object(dbaas.PXCApp, 'reset_admin_password')
    def test_reset_admin_password(self, reset_admin_pwd):
        admin_password = "******"
        self.manager.reset_admin_password(self.context, admin_password)
        self.status_get_mock.assert_any_call()
        reset_admin_pwd.assert_called_with(admin_password)

    @patch.object(dbaas.PXCApp, 'get_cluster_context')
    def test_get_cluster_context(self, get_cluster_ctxt):
        get_cluster_ctxt.return_value = {'cluster': 'info'}
        self.manager.get_cluster_context(self.context)
        self.status_get_mock.assert_any_call()
        get_cluster_ctxt.assert_any_call()

    @patch.object(dbaas.PXCApp, 'write_cluster_configuration_overrides')
    def test_write_cluster_configuration_overrides(self, conf_overries):
        cluster_configuration = "cluster_configuration"
        self.manager.write_cluster_configuration_overrides(
            self.context, cluster_configuration)
        self.status_get_mock.assert_any_call()
        conf_overries.assert_called_with(cluster_configuration)
Exemple #7
0
class GuestAgentManagerTest(trove_testtools.TestCase):
    def setUp(self):
        super(GuestAgentManagerTest, self).setUp()
        self.manager = Manager()
        self.context = TroveContext()
        self.patcher_rs = patch(
            'trove.guestagent.strategies.replication.get_instance')
        self.mock_rs_class = self.patcher_rs.start()

        status_patcher = patch.object(dbaas.PXCAppStatus,
                                      'get',
                                      return_value=MagicMock())
        self.addCleanup(status_patcher.stop)
        self.status_get_mock = status_patcher.start()

    def tearDown(self):
        super(GuestAgentManagerTest, self).tearDown()
        self.patcher_rs.stop()

    @patch.object(dbaas.PXCApp, 'install_cluster')
    def test_install_cluster(self, install_cluster_mock):
        replication_user = "******"
        configuration = "configuration"
        bootstrap = True
        self.manager.install_cluster(self.context, replication_user,
                                     configuration, bootstrap)
        self.status_get_mock.assert_any_call()
        install_cluster_mock.assert_called_with(replication_user,
                                                configuration, bootstrap)

    @patch.object(dbaas.PXCApp, 'reset_admin_password')
    def test_reset_admin_password(self, reset_admin_pwd):
        admin_password = "******"
        self.manager.reset_admin_password(self.context, admin_password)
        self.status_get_mock.assert_any_call()
        reset_admin_pwd.assert_called_with(admin_password)

    @patch.object(dbaas.PXCApp, 'get_cluster_context')
    def test_get_cluster_context(self, get_cluster_ctxt):
        get_cluster_ctxt.return_value = {'cluster': 'info'}
        self.manager.get_cluster_context(self.context)
        self.status_get_mock.assert_any_call()
        get_cluster_ctxt.assert_any_call()

    @patch.object(dbaas.PXCApp, 'write_cluster_configuration_overrides')
    def test_write_cluster_configuration_overrides(self, conf_overries):
        cluster_configuration = "cluster_configuration"
        self.manager.write_cluster_configuration_overrides(
            self.context, cluster_configuration)
        self.status_get_mock.assert_any_call()
        conf_overries.assert_called_with(cluster_configuration)
Exemple #8
0
    def setUp(self):
        super(GuestAgentManagerTest, self).setUp()
        self.manager = Manager()
        self.context = TroveContext()
        self.patcher_rs = patch(
            'trove.guestagent.strategies.replication.get_instance')
        self.mock_rs_class = self.patcher_rs.start()

        status_patcher = patch.object(dbaas.PXCAppStatus, 'get',
                                      return_value=MagicMock())
        self.addCleanup(status_patcher.stop)
        self.status_get_mock = status_patcher.start()
Exemple #9
0
class GuestAgentManagerTest(testtools.TestCase):

    def setUp(self):
        super(GuestAgentManagerTest, self).setUp()
        self.manager = Manager()
        self.context = TroveContext()
        self.patcher_rs = patch(
            'trove.guestagent.strategies.replication.get_instance')
        self.mock_rs_class = self.patcher_rs.start()

    def tearDown(self):
        super(GuestAgentManagerTest, self).tearDown()
        self.patcher_rs.stop()

    def test_install_cluster(self):
        mock_status = MagicMock()
        dbaas.PXCAppStatus.get = MagicMock(return_value=mock_status)

        dbaas.PXCApp.install_cluster = MagicMock(return_value=None)

        replication_user = "******"
        configuration = "configuration"
        bootstrap = True
        self.manager.install_cluster(self.context, replication_user,
                                     configuration, bootstrap)
        dbaas.PXCAppStatus.get.assert_any_call()
        dbaas.PXCApp.install_cluster.assert_called_with(
            replication_user, configuration, bootstrap)

    def test_reset_admin_password(self):
        mock_status = MagicMock()
        dbaas.PXCAppStatus.get = MagicMock(return_value=mock_status)

        dbaas.PXCApp.reset_admin_password = MagicMock(return_value=None)

        admin_password = "******"
        self.manager.reset_admin_password(self.context, admin_password)
        dbaas.PXCAppStatus.get.assert_any_call()
        dbaas.PXCApp.reset_admin_password.assert_called_with(
            admin_password)
Exemple #10
0
class GuestAgentManagerTest(testtools.TestCase):

    def setUp(self):
        super(GuestAgentManagerTest, self).setUp()
        self.manager = Manager()
        self.context = TroveContext()
        self.patcher_rs = patch(self.manager.replication_namespace + "." +
                                self.manager.replication_strategy)
        self.mock_rs_class = self.patcher_rs.start()

    def tearDown(self):
        super(GuestAgentManagerTest, self).tearDown()
        self.patcher_rs.stop()

    def test_install_cluster(self):
        mock_status = MagicMock()
        dbaas.PXCAppStatus.get = MagicMock(return_value=mock_status)

        dbaas.PXCApp.install_cluster = MagicMock(return_value=None)

        replication_user = "******"
        configuration = "configuration"
        bootstrap = True
        self.manager.install_cluster(self.context, replication_user,
                                     configuration, bootstrap)
        dbaas.PXCAppStatus.get.assert_any_call()
        dbaas.PXCApp.install_cluster.assert_called_with(
            replication_user, configuration, bootstrap)

    def test_reset_admin_password(self):
        mock_status = MagicMock()
        dbaas.PXCAppStatus.get = MagicMock(return_value=mock_status)

        dbaas.PXCApp.reset_admin_password = MagicMock(return_value=None)

        admin_password = "******"
        self.manager.reset_admin_password(self.context, admin_password)
        dbaas.PXCAppStatus.get.assert_any_call()
        dbaas.PXCApp.reset_admin_password.assert_called_with(
            admin_password)