Example #1
0
    def test_wipe_ib_logfiles_no_file(self):

        from reddwarf.common.exception import ProcessExecutionError
        processexecerror = ProcessExecutionError('No such file or directory')
        dbaas.utils.execute_with_timeout = Mock(side_effect=processexecerror)

        self.mySqlApp.wipe_ib_logfiles()
Example #2
0
    def test_start_mysql_error(self):

        self.mySqlApp._enable_mysql_on_boot = Mock()
        from reddwarf.common.exception import ProcessExecutionError
        mocked = Mock(side_effect=ProcessExecutionError('Error'))
        dbaas.utils.execute_with_timeout = mocked

        self.assertRaises(RuntimeError, self.mySqlApp.start_mysql)
Example #3
0
    def test_wipe_ib_logfiles_error(self):

        from reddwarf.common.exception import ProcessExecutionError
        mocked = Mock(side_effect=ProcessExecutionError('Error'))
        dbaas.utils.execute_with_timeout = mocked

        self.assertRaises(ProcessExecutionError,
                          self.mySqlApp.wipe_ib_logfiles)
Example #4
0
    def test_get_actual_db_status_error_shutdown(self):

        from reddwarf.common.exception import ProcessExecutionError
        mocked = Mock(side_effect=ProcessExecutionError())
        dbaas.utils.execute_with_timeout = mocked
        dbaas.load_mysqld_options = Mock()
        dbaas.os.path.exists = Mock(return_value=False)

        self.mySqlAppStatus = MySqlAppStatus()
        status = self.mySqlAppStatus._get_actual_db_status()

        self.assertEqual(ServiceStatuses.SHUTDOWN, status)
Example #5
0
    def test_get_actual_db_status_error_crashed(self):

        from reddwarf.common.exception import ProcessExecutionError
        dbaas.utils.execute_with_timeout = \
            MagicMock(side_effect=[ProcessExecutionError(),
                                   ("some output", None)])
        dbaas.load_mysqld_options = Mock()
        dbaas.os.path.exists = Mock(return_value=True)

        self.mySqlAppStatus = MySqlAppStatus()
        status = self.mySqlAppStatus._get_actual_db_status()

        self.assertEqual(ServiceStatuses.BLOCKED, status)
Example #6
0
    def test_load_mysqld_options_error(self):

        from reddwarf.common.exception import ProcessExecutionError
        dbaas.utils.execute = Mock(side_effect=ProcessExecutionError())

        self.assertFalse(dbaas.load_mysqld_options())