def test_postgres_backup_executor_init(self): """ Test the construction of a PostgresBackupExecutor """ server = build_mocked_server(global_conf={'backup_method': 'postgres'}) executor = PostgresBackupExecutor(server.backup_manager) assert executor assert executor.strategy # Expect an error if the tablespace_bandwidth_limit option # is set for this server. server = build_mocked_server( global_conf={'backup_method': 'postgres', 'tablespace_bandwidth_limit': 1}) executor = PostgresBackupExecutor(server.backup_manager) assert executor assert executor.strategy assert server.config.disabled
def __init__(self, server): """ Constructor """ super(BackupManager, self).__init__() self.server = server self.config = server.config self._backup_cache = None self.compression_manager = CompressionManager(self.config, server.path) self.executor = None try: if self.config.backup_method == "postgres": self.executor = PostgresBackupExecutor(self) else: self.executor = RsyncBackupExecutor(self) except SshCommandException as e: self.config.disabled = True self.config.msg_list.append(str(e).strip())