def test_wipe_ib_logfiles_no_file(self): from trove.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()
def test_start_mysql_error(self): self.mySqlApp._enable_mysql_on_boot = Mock() from trove.common.exception import ProcessExecutionError mocked = Mock(side_effect=ProcessExecutionError('Error')) dbaas.utils.execute_with_timeout = mocked self.assertRaises(RuntimeError, self.mySqlApp.start_mysql)
def test_wipe_ib_logfiles_error(self): from trove.common.exception import ProcessExecutionError mocked = Mock(side_effect=ProcessExecutionError('Error')) dbaas.utils.execute_with_timeout = mocked self.assertRaises(ProcessExecutionError, self.mySqlApp.wipe_ib_logfiles)
def test_get_actual_db_status_error_crashed(self): from trove.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(rd_instance.ServiceStatuses.BLOCKED, status)
def test_get_actual_db_status_error_shutdown(self): from trove.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(rd_instance.ServiceStatuses.SHUTDOWN, status)
def test_load_mysqld_options_error(self): from trove.common.exception import ProcessExecutionError dbaas.utils.execute = Mock(side_effect=ProcessExecutionError()) self.assertFalse(dbaas.load_mysqld_options())