From ce2b18c5b84c506606861010331965ad503af48a Mon Sep 17 00:00:00 2001 From: Cynthia Shang Date: Tue, 1 Aug 2017 10:34:53 -0400 Subject: [PATCH] Added --backup-ssh-port and --db-ssh-port options to support non-default SSH ports. Contributed by Cynthia Shang. --- doc/xml/reference.xml | 18 +++ doc/xml/release.xml | 8 ++ lib/pgBackRest/Config/Config.pm | 30 ++++ lib/pgBackRest/Protocol/Helper.pm | 3 + lib/pgBackRest/Protocol/Remote/Master.pm | 11 +- test/expect/mock-all-002.log | 20 +-- test/expect/mock-archive-002.log | 4 +- test/expect/stanza-create-002.log | 2 +- test/lib/pgBackRestTest/Common/DefineTest.pm | 9 ++ .../Module/Protocol/ProtocolHelperTest.pm | 132 ++++++++++++++++++ 10 files changed, 221 insertions(+), 16 deletions(-) create mode 100644 test/lib/pgBackRestTest/Module/Protocol/ProtocolHelperTest.pm diff --git a/doc/xml/reference.xml b/doc/xml/reference.xml index 6cda599be..271c8cae3 100644 --- a/doc/xml/reference.xml +++ b/doc/xml/reference.xml @@ -244,6 +244,15 @@ backrest + + + Backup server SSH port when backup-host is set. + + Use this option to specify a non-default SSH port for the backup server. + + 25 + + Repository path where WAL segments and backups stored. @@ -685,6 +694,15 @@ /var/run/postgresql + + + + Database server SSH port when db-host is set. + + Use this option to specify a non-default SSH port for a database server. + + 25 + diff --git a/doc/xml/release.xml b/doc/xml/release.xml index 3eb0ce4f2..bca591f9d 100644 --- a/doc/xml/release.xml +++ b/doc/xml/release.xml @@ -183,6 +183,14 @@

Modified the info command (both text and JSON output) to display the archive ID and minimum/maximum WAL currently present in the archive for the current and prior, if any, database cluster version.

+ + + + + + +

Added --backup-ssh-port and --db-ssh-port options to support non-default SSH ports.

+
diff --git a/lib/pgBackRest/Config/Config.pm b/lib/pgBackRest/Config/Config.pm index 28c913ebe..8dee57f2f 100644 --- a/lib/pgBackRest/Config/Config.pm +++ b/lib/pgBackRest/Config/Config.pm @@ -352,6 +352,8 @@ use constant OPTION_BACKUP_CONFIG => 'backup-c push @EXPORT, qw(OPTION_BACKUP_CONFIG); use constant OPTION_BACKUP_HOST => 'backup-host'; push @EXPORT, qw(OPTION_BACKUP_HOST); +use constant OPTION_BACKUP_SSH_PORT => 'backup-ssh-port'; + push @EXPORT, qw(OPTION_BACKUP_SSH_PORT); use constant OPTION_BACKUP_STANDBY => 'backup-standby'; push @EXPORT, qw(OPTION_BACKUP_STANDBY); use constant OPTION_BACKUP_USER => 'backup-user'; @@ -410,11 +412,14 @@ use constant OPTION_DB_PATH => OPTION_PR push @EXPORT, qw(OPTION_DB_PATH); use constant OPTION_DB_PORT => OPTION_PREFIX_DB . '-port'; push @EXPORT, qw(OPTION_DB_PORT); +use constant OPTION_DB_SSH_PORT => OPTION_PREFIX_DB . '-ssh-port'; + push @EXPORT, qw(OPTION_DB_SSH_PORT); use constant OPTION_DB_SOCKET_PATH => OPTION_PREFIX_DB . '-socket-path'; push @EXPORT, qw(OPTION_DB_SOCKET_PATH); use constant OPTION_DB_USER => OPTION_PREFIX_DB . '-user'; push @EXPORT, qw(OPTION_DB_USER); + #################################################################################################################################### # Option Defaults #################################################################################################################################### @@ -1659,6 +1664,18 @@ my %oOptionRule = }, }, + &OPTION_BACKUP_SSH_PORT => + { + &OPTION_RULE_SECTION => CONFIG_SECTION_GLOBAL, + &OPTION_RULE_TYPE => OPTION_TYPE_INTEGER, + &OPTION_RULE_REQUIRED => false, + &OPTION_RULE_COMMAND => OPTION_BACKUP_HOST, + &OPTION_RULE_DEPEND => + { + &OPTION_RULE_DEPEND_OPTION => OPTION_BACKUP_HOST + } + }, + &OPTION_BACKUP_STANDBY => { &OPTION_RULE_SECTION => CONFIG_SECTION_GLOBAL, @@ -2036,6 +2053,19 @@ my %oOptionRule = } }, + &OPTION_DB_SSH_PORT => + { + &OPTION_RULE_SECTION => CONFIG_SECTION_STANZA, + &OPTION_RULE_PREFIX => OPTION_PREFIX_DB, + &OPTION_RULE_TYPE => OPTION_TYPE_INTEGER, + &OPTION_RULE_REQUIRED => false, + &OPTION_RULE_COMMAND => OPTION_DB_HOST, + &OPTION_RULE_DEPEND => + { + &OPTION_RULE_DEPEND_OPTION => OPTION_DB_HOST + }, + }, + &OPTION_DB_USER => { &OPTION_RULE_SECTION => CONFIG_SECTION_STANZA, diff --git a/lib/pgBackRest/Protocol/Helper.pm b/lib/pgBackRest/Protocol/Helper.pm index 4475ea9ac..6a04feb57 100644 --- a/lib/pgBackRest/Protocol/Helper.pm +++ b/lib/pgBackRest/Protocol/Helper.pm @@ -206,6 +206,7 @@ sub protocolGet my $strOptionUser = OPTION_BACKUP_USER; my $strOptionDbPort = undef; my $strOptionDbSocketPath = undef; + my $strOptionSshPort = OPTION_BACKUP_SSH_PORT; if ($strRemoteType eq DB) { @@ -213,6 +214,7 @@ sub protocolGet $strOptionConfig = optionIndex(OPTION_DB_CONFIG, $iRemoteIdx); $strOptionHost = optionIndex(OPTION_DB_HOST, $iRemoteIdx); $strOptionUser = optionIndex(OPTION_DB_USER, $iRemoteIdx); + $strOptionSshPort = optionIndex(OPTION_DB_SSH_PORT, $iRemoteIdx); } # Db socket is not valid in all contexts (restore, for instance) @@ -264,6 +266,7 @@ sub protocolGet optionGet(OPTION_COMPRESS_LEVEL_NETWORK), optionGet($strOptionHost), optionGet($strOptionUser), + optionGet($strOptionSshPort, false), optionGet(OPTION_PROTOCOL_TIMEOUT) ); diff --git a/lib/pgBackRest/Protocol/Remote/Master.pm b/lib/pgBackRest/Protocol/Remote/Master.pm index 8c3ea2032..8967267ed 100644 --- a/lib/pgBackRest/Protocol/Remote/Master.pm +++ b/lib/pgBackRest/Protocol/Remote/Master.pm @@ -32,7 +32,8 @@ sub new $iCompressLevelNetwork, # Set compression level for network only compression $strHost, # Host to connect to for remote (optional as this can also be used for local) $strUser, # User to connect to for remote (must be set if strHost is set) - $iProtocolTimeout # Protocol timeout + $iSshPort, # Specified if other than default port is needed for ssh + $iProtocolTimeout, # Protocol timeout ) = logDebugParam ( @@ -44,12 +45,16 @@ sub new {name => 'iCompressLevelNetwork'}, {name => 'strHost'}, {name => 'strUser'}, - {name => 'iProtocolTimeout'} + {name => 'iSshPort', required => false}, + {name => 'iProtocolTimeout'}, ); + my $strCommandSshPort = defined($iSshPort) ? '-p ' . $iSshPort . ' ' : ''; + # Create SSH command $strCommand = - "${strCommandSSH} -o LogLevel=error -o Compression=no -o PasswordAuthentication=no ${strUser}\@${strHost} '${strCommand}'"; + "${strCommandSSH} -o LogLevel=error -o Compression=no -o PasswordAuthentication=no $strCommandSshPort" . + "${strUser}\@${strHost} '${strCommand}'"; # Init object and store variables my $self = $class->SUPER::new( diff --git a/test/expect/mock-all-002.log b/test/expect/mock-all-002.log index e19abf621..b73e87aee 100644 --- a/test/expect/mock-all-002.log +++ b/test/expect/mock-all-002.log @@ -91,7 +91,7 @@ P00 DEBUG: Storage::Local->list=>: stryFileList = () P00 DEBUG: Db->new(): iRemoteIdx = 1 P00 DEBUG: Protocol::Helper::protocolGet(): bCache = , iProcessIdx = [undef], iRemoteIdx = 1, strBackRestBin = [undef], strCommand = , strRemoteType = db P00 DEBUG: Protocol::Helper::protocolGet: create (cached) remote protocol -P00 DEBUG: Protocol::Remote::Master->new(): iBufferMax = 16384, iCompressLevel = 6, iCompressLevelNetwork = 3, iProtocolTimeout = 2, strCommand = [BACKREST-BIN] --buffer-size=16384 --command=backup --compress-level=6 --compress-level-network=3 --config=[TEST_PATH]/db-master/pgbackrest.conf --db-path=[TEST_PATH]/db-master/db/base --db-timeout=1 --protocol-timeout=2 --repo-path=[TEST_PATH]/backup/repo --repo-type=cifs --stanza=db --type=db remote, strCommandSSH = /usr/bin/ssh, strHost = db-master, strUser = [USER-1] +P00 DEBUG: Protocol::Remote::Master->new(): iBufferMax = 16384, iCompressLevel = 6, iCompressLevelNetwork = 3, iProtocolTimeout = 2, iSshPort = [undef], strCommand = [BACKREST-BIN] --buffer-size=16384 --command=backup --compress-level=6 --compress-level-network=3 --config=[TEST_PATH]/db-master/pgbackrest.conf --db-path=[TEST_PATH]/db-master/db/base --db-timeout=1 --protocol-timeout=2 --repo-path=[TEST_PATH]/backup/repo --repo-type=cifs --stanza=db --type=db remote, strCommandSSH = /usr/bin/ssh, strHost = db-master, strUser = [USER-1] P00 DEBUG: Protocol::Command::Master->new(): iBufferMax = 16384, iCompressLevel = 6, iCompressLevelNetwork = 3, iProtocolTimeout = 2, strCommand = /usr/bin/ssh -o LogLevel=error -o Compression=no -o PasswordAuthentication=no [USER-1]@db-master '[BACKREST-BIN] --buffer-size=16384 --command=backup --compress-level=6 --compress-level-network=3 --config=[TEST_PATH]/db-master/pgbackrest.conf --db-path=[TEST_PATH]/db-master/db/base --db-timeout=1 --protocol-timeout=2 --repo-path=[TEST_PATH]/backup/repo --repo-type=cifs --stanza=db --type=db remote', strId = 'db-master remote', strName = remote P00 DEBUG: Db::dbObjectGet=>: iDbMasterIdx = 1, iDbStandbyIdx = [undef], oDbMaster = [object], oDbStandby = [undef] P00 DEBUG: Protocol::Helper::protocolGet(): bCache = , iProcessIdx = [undef], iRemoteIdx = 1, strBackRestBin = [undef], strCommand = , strRemoteType = db @@ -470,7 +470,7 @@ P00 DEBUG: Storage::Local->exists=>: bExists = true P00 DEBUG: Db->new(): iRemoteIdx = 1 P00 DEBUG: Protocol::Helper::protocolGet(): bCache = , iProcessIdx = [undef], iRemoteIdx = 1, strBackRestBin = [undef], strCommand = , strRemoteType = db P00 DEBUG: Protocol::Helper::protocolGet: create (cached) remote protocol -P00 DEBUG: Protocol::Remote::Master->new(): iBufferMax = 4194304, iCompressLevel = 6, iCompressLevelNetwork = 3, iProtocolTimeout = 1, strCommand = [BACKREST-BIN] --buffer-size=4194304 --command=backup --compress-level=6 --compress-level-network=3 --config=[TEST_PATH]/db-master/pgbackrest.conf --db-path=[TEST_PATH]/db-master/db/base --db-timeout=.1 --protocol-timeout=1 --repo-path=[TEST_PATH]/backup/repo --stanza=db --type=db remote, strCommandSSH = ssh, strHost = db-master, strUser = [USER-1] +P00 DEBUG: Protocol::Remote::Master->new(): iBufferMax = 4194304, iCompressLevel = 6, iCompressLevelNetwork = 3, iProtocolTimeout = 1, iSshPort = [undef], strCommand = [BACKREST-BIN] --buffer-size=4194304 --command=backup --compress-level=6 --compress-level-network=3 --config=[TEST_PATH]/db-master/pgbackrest.conf --db-path=[TEST_PATH]/db-master/db/base --db-timeout=.1 --protocol-timeout=1 --repo-path=[TEST_PATH]/backup/repo --stanza=db --type=db remote, strCommandSSH = ssh, strHost = db-master, strUser = [USER-1] P00 DEBUG: Protocol::Command::Master->new(): iBufferMax = 4194304, iCompressLevel = 6, iCompressLevelNetwork = 3, iProtocolTimeout = 1, strCommand = ssh -o LogLevel=error -o Compression=no -o PasswordAuthentication=no [USER-1]@db-master '[BACKREST-BIN] --buffer-size=4194304 --command=backup --compress-level=6 --compress-level-network=3 --config=[TEST_PATH]/db-master/pgbackrest.conf --db-path=[TEST_PATH]/db-master/db/base --db-timeout=.1 --protocol-timeout=1 --repo-path=[TEST_PATH]/backup/repo --stanza=db --type=db remote', strId = 'db-master remote', strName = remote P00 DEBUG: Db::dbObjectGet=>: iDbMasterIdx = 1, iDbStandbyIdx = [undef], oDbMaster = [object], oDbStandby = [undef] P00 DEBUG: Protocol::Helper::protocolGet(): bCache = , iProcessIdx = [undef], iRemoteIdx = 1, strBackRestBin = [undef], strCommand = , strRemoteType = db @@ -567,7 +567,7 @@ P00 DEBUG: Storage::Local->exists=>: bExists = true P00 DEBUG: Db->new(): iRemoteIdx = 1 P00 DEBUG: Protocol::Helper::protocolGet(): bCache = , iProcessIdx = [undef], iRemoteIdx = 1, strBackRestBin = [undef], strCommand = , strRemoteType = db P00 DEBUG: Protocol::Helper::protocolGet: create (cached) remote protocol -P00 DEBUG: Protocol::Remote::Master->new(): iBufferMax = 4194304, iCompressLevel = 6, iCompressLevelNetwork = 3, iProtocolTimeout = 60, strCommand = [BACKREST-BIN] --buffer-size=4194304 --command=backup --compress-level=6 --compress-level-network=3 --config=[TEST_PATH]/db-master/pgbackrest.conf --db-path=[TEST_PATH]/db-master/db/base --db-timeout=45 --protocol-timeout=60 --repo-path=[TEST_PATH]/backup/repo --stanza=db --type=db remote, strCommandSSH = ssh, strHost = db-master, strUser = [USER-1] +P00 DEBUG: Protocol::Remote::Master->new(): iBufferMax = 4194304, iCompressLevel = 6, iCompressLevelNetwork = 3, iProtocolTimeout = 60, iSshPort = [undef], strCommand = [BACKREST-BIN] --buffer-size=4194304 --command=backup --compress-level=6 --compress-level-network=3 --config=[TEST_PATH]/db-master/pgbackrest.conf --db-path=[TEST_PATH]/db-master/db/base --db-timeout=45 --protocol-timeout=60 --repo-path=[TEST_PATH]/backup/repo --stanza=db --type=db remote, strCommandSSH = ssh, strHost = db-master, strUser = [USER-1] P00 DEBUG: Protocol::Command::Master->new(): iBufferMax = 4194304, iCompressLevel = 6, iCompressLevelNetwork = 3, iProtocolTimeout = 60, strCommand = ssh -o LogLevel=error -o Compression=no -o PasswordAuthentication=no [USER-1]@db-master '[BACKREST-BIN] --buffer-size=4194304 --command=backup --compress-level=6 --compress-level-network=3 --config=[TEST_PATH]/db-master/pgbackrest.conf --db-path=[TEST_PATH]/db-master/db/base --db-timeout=45 --protocol-timeout=60 --repo-path=[TEST_PATH]/backup/repo --stanza=db --type=db remote', strId = 'db-master remote', strName = remote P00 DEBUG: Db::dbObjectGet=>: iDbMasterIdx = 1, iDbStandbyIdx = [undef], oDbMaster = [object], oDbStandby = [undef] P00 DEBUG: Protocol::Helper::protocolGet(): bCache = , iProcessIdx = [undef], iRemoteIdx = 1, strBackRestBin = [undef], strCommand = , strRemoteType = db @@ -651,7 +651,7 @@ P00 DEBUG: Storage::Local->exists=>: bExists = true P00 DEBUG: Db->new(): iRemoteIdx = 1 P00 DEBUG: Protocol::Helper::protocolGet(): bCache = , iProcessIdx = [undef], iRemoteIdx = 1, strBackRestBin = [undef], strCommand = , strRemoteType = db P00 DEBUG: Protocol::Helper::protocolGet: create (cached) remote protocol -P00 DEBUG: Protocol::Remote::Master->new(): iBufferMax = 4194304, iCompressLevel = 6, iCompressLevelNetwork = 3, iProtocolTimeout = 60, strCommand = [BACKREST-BIN] --buffer-size=4194304 --command=backup --compress-level=6 --compress-level-network=3 --config=[TEST_PATH]/db-master/pgbackrest.conf --db-path=[TEST_PATH]/db-master/db/base --db-timeout=45 --protocol-timeout=60 --repo-path=[TEST_PATH]/backup/repo --stanza=db --type=db remote, strCommandSSH = ssh, strHost = db-master, strUser = [USER-1] +P00 DEBUG: Protocol::Remote::Master->new(): iBufferMax = 4194304, iCompressLevel = 6, iCompressLevelNetwork = 3, iProtocolTimeout = 60, iSshPort = [undef], strCommand = [BACKREST-BIN] --buffer-size=4194304 --command=backup --compress-level=6 --compress-level-network=3 --config=[TEST_PATH]/db-master/pgbackrest.conf --db-path=[TEST_PATH]/db-master/db/base --db-timeout=45 --protocol-timeout=60 --repo-path=[TEST_PATH]/backup/repo --stanza=db --type=db remote, strCommandSSH = ssh, strHost = db-master, strUser = [USER-1] P00 DEBUG: Protocol::Command::Master->new(): iBufferMax = 4194304, iCompressLevel = 6, iCompressLevelNetwork = 3, iProtocolTimeout = 60, strCommand = ssh -o LogLevel=error -o Compression=no -o PasswordAuthentication=no [USER-1]@db-master '[BACKREST-BIN] --buffer-size=4194304 --command=backup --compress-level=6 --compress-level-network=3 --config=[TEST_PATH]/db-master/pgbackrest.conf --db-path=[TEST_PATH]/db-master/db/base --db-timeout=45 --protocol-timeout=60 --repo-path=[TEST_PATH]/backup/repo --stanza=db --type=db remote', strId = 'db-master remote', strName = remote P00 ERROR: [062]: process 'db-master remote' terminated unexpectedly [062]: stop file exists for all stanzas @@ -721,7 +721,7 @@ P00 DEBUG: Storage::Local->exists=>: bExists = true P00 DEBUG: Db->new(): iRemoteIdx = 1 P00 DEBUG: Protocol::Helper::protocolGet(): bCache = , iProcessIdx = [undef], iRemoteIdx = 1, strBackRestBin = [undef], strCommand = , strRemoteType = db P00 DEBUG: Protocol::Helper::protocolGet: create (cached) remote protocol -P00 DEBUG: Protocol::Remote::Master->new(): iBufferMax = 4194304, iCompressLevel = 6, iCompressLevelNetwork = 3, iProtocolTimeout = 60, strCommand = [BACKREST-BIN] --buffer-size=4194304 --command=backup --compress-level=6 --compress-level-network=3 --config=[TEST_PATH]/db-master/pgbackrest.conf --db-path=[TEST_PATH]/db-master/db/base --db-timeout=45 --protocol-timeout=60 --repo-path=[TEST_PATH]/backup/repo --stanza=db --type=db remote, strCommandSSH = ssh, strHost = db-master, strUser = [USER-1] +P00 DEBUG: Protocol::Remote::Master->new(): iBufferMax = 4194304, iCompressLevel = 6, iCompressLevelNetwork = 3, iProtocolTimeout = 60, iSshPort = [undef], strCommand = [BACKREST-BIN] --buffer-size=4194304 --command=backup --compress-level=6 --compress-level-network=3 --config=[TEST_PATH]/db-master/pgbackrest.conf --db-path=[TEST_PATH]/db-master/db/base --db-timeout=45 --protocol-timeout=60 --repo-path=[TEST_PATH]/backup/repo --stanza=db --type=db remote, strCommandSSH = ssh, strHost = db-master, strUser = [USER-1] P00 DEBUG: Protocol::Command::Master->new(): iBufferMax = 4194304, iCompressLevel = 6, iCompressLevelNetwork = 3, iProtocolTimeout = 60, strCommand = ssh -o LogLevel=error -o Compression=no -o PasswordAuthentication=no [USER-1]@db-master '[BACKREST-BIN] --buffer-size=4194304 --command=backup --compress-level=6 --compress-level-network=3 --config=[TEST_PATH]/db-master/pgbackrest.conf --db-path=[TEST_PATH]/db-master/db/base --db-timeout=45 --protocol-timeout=60 --repo-path=[TEST_PATH]/backup/repo --stanza=db --type=db remote', strId = 'db-master remote', strName = remote P00 ERROR: [062]: process 'db-master remote' terminated unexpectedly [062]: stop file exists for stanza db @@ -813,7 +813,7 @@ P00 DEBUG: Storage::Local->exists=>: bExists = true P00 DEBUG: Db->new(): iRemoteIdx = 1 P00 DEBUG: Protocol::Helper::protocolGet(): bCache = , iProcessIdx = [undef], iRemoteIdx = 1, strBackRestBin = [undef], strCommand = , strRemoteType = db P00 DEBUG: Protocol::Helper::protocolGet: create (cached) remote protocol -P00 DEBUG: Protocol::Remote::Master->new(): iBufferMax = 4194304, iCompressLevel = 6, iCompressLevelNetwork = 3, iProtocolTimeout = 60, strCommand = [BACKREST-BIN] --buffer-size=4194304 --command=backup --compress-level=6 --compress-level-network=3 --config=[TEST_PATH]/db-master/pgbackrest.conf --db-path=[TEST_PATH]/db-master/db/base --db-timeout=45 --protocol-timeout=60 --repo-path=[TEST_PATH]/backup/repo --stanza=db --type=db remote, strCommandSSH = ssh, strHost = db-master, strUser = [USER-1] +P00 DEBUG: Protocol::Remote::Master->new(): iBufferMax = 4194304, iCompressLevel = 6, iCompressLevelNetwork = 3, iProtocolTimeout = 60, iSshPort = [undef], strCommand = [BACKREST-BIN] --buffer-size=4194304 --command=backup --compress-level=6 --compress-level-network=3 --config=[TEST_PATH]/db-master/pgbackrest.conf --db-path=[TEST_PATH]/db-master/db/base --db-timeout=45 --protocol-timeout=60 --repo-path=[TEST_PATH]/backup/repo --stanza=db --type=db remote, strCommandSSH = ssh, strHost = db-master, strUser = [USER-1] P00 DEBUG: Protocol::Command::Master->new(): iBufferMax = 4194304, iCompressLevel = 6, iCompressLevelNetwork = 3, iProtocolTimeout = 60, strCommand = ssh -o LogLevel=error -o Compression=no -o PasswordAuthentication=no [USER-1]@db-master '[BACKREST-BIN] --buffer-size=4194304 --command=backup --compress-level=6 --compress-level-network=3 --config=[TEST_PATH]/db-master/pgbackrest.conf --db-path=[TEST_PATH]/db-master/db/base --db-timeout=45 --protocol-timeout=60 --repo-path=[TEST_PATH]/backup/repo --stanza=db --type=db remote', strId = 'db-master remote', strName = remote P00 DEBUG: Db::dbObjectGet=>: iDbMasterIdx = 1, iDbStandbyIdx = [undef], oDbMaster = [object], oDbStandby = [undef] P00 DEBUG: Protocol::Helper::protocolGet(): bCache = , iProcessIdx = [undef], iRemoteIdx = 1, strBackRestBin = [undef], strCommand = , strRemoteType = db @@ -922,7 +922,7 @@ P00 DEBUG: Backup::Info->delete(): strBackupLabel = [BACKUP-FULL-1] P00 DEBUG: Db->new(): iRemoteIdx = 1 P00 DEBUG: Protocol::Helper::protocolGet(): bCache = , iProcessIdx = [undef], iRemoteIdx = 1, strBackRestBin = [undef], strCommand = , strRemoteType = db P00 DEBUG: Protocol::Helper::protocolGet: create (cached) remote protocol -P00 DEBUG: Protocol::Remote::Master->new(): iBufferMax = 4194304, iCompressLevel = 6, iCompressLevelNetwork = 3, iProtocolTimeout = 60, strCommand = [BACKREST-BIN] --buffer-size=4194304 --command=backup --compress-level=6 --compress-level-network=3 --config=[TEST_PATH]/db-master/pgbackrest.conf --db-path=[TEST_PATH]/db-master/db/base --db-timeout=45 --protocol-timeout=60 --repo-path=[TEST_PATH]/backup/repo --stanza=db --type=db remote, strCommandSSH = ssh, strHost = db-master, strUser = [USER-1] +P00 DEBUG: Protocol::Remote::Master->new(): iBufferMax = 4194304, iCompressLevel = 6, iCompressLevelNetwork = 3, iProtocolTimeout = 60, iSshPort = [undef], strCommand = [BACKREST-BIN] --buffer-size=4194304 --command=backup --compress-level=6 --compress-level-network=3 --config=[TEST_PATH]/db-master/pgbackrest.conf --db-path=[TEST_PATH]/db-master/db/base --db-timeout=45 --protocol-timeout=60 --repo-path=[TEST_PATH]/backup/repo --stanza=db --type=db remote, strCommandSSH = ssh, strHost = db-master, strUser = [USER-1] P00 DEBUG: Protocol::Command::Master->new(): iBufferMax = 4194304, iCompressLevel = 6, iCompressLevelNetwork = 3, iProtocolTimeout = 60, strCommand = ssh -o LogLevel=error -o Compression=no -o PasswordAuthentication=no [USER-1]@db-master '[BACKREST-BIN] --buffer-size=4194304 --command=backup --compress-level=6 --compress-level-network=3 --config=[TEST_PATH]/db-master/pgbackrest.conf --db-path=[TEST_PATH]/db-master/db/base --db-timeout=45 --protocol-timeout=60 --repo-path=[TEST_PATH]/backup/repo --stanza=db --type=db remote', strId = 'db-master remote', strName = remote P00 DEBUG: Db::dbObjectGet=>: iDbMasterIdx = 1, iDbStandbyIdx = [undef], oDbMaster = [object], oDbStandby = [undef] P00 DEBUG: Protocol::Helper::protocolGet(): bCache = , iProcessIdx = [undef], iRemoteIdx = 1, strBackRestBin = [undef], strCommand = , strRemoteType = db @@ -1251,7 +1251,7 @@ P00 DEBUG: Common::Lock::lockAcquire=>: bResult = true P00 DEBUG: Storage::Local->pathCreate(): bCreateParent = true, bIgnoreExists = true, strMode = 0770, strPathExp = [TEST_PATH]/db-master/log P00 DEBUG: Protocol::Helper::protocolGet(): bCache = , iProcessIdx = [undef], iRemoteIdx = <1>, strBackRestBin = [undef], strCommand = , strRemoteType = backup P00 DEBUG: Protocol::Helper::protocolGet: create (cached) remote protocol -P00 DEBUG: Protocol::Remote::Master->new(): iBufferMax = 4194304, iCompressLevel = 6, iCompressLevelNetwork = 3, iProtocolTimeout = 60, strCommand = [BACKREST-BIN] --buffer-size=4194304 --command=restore --compress-level=6 --compress-level-network=3 --config=[TEST_PATH]/backup/pgbackrest.conf --db-path=[TEST_PATH]/db-master/db/base --db-timeout=45 --protocol-timeout=60 --stanza=db --type=backup remote, strCommandSSH = /usr/bin/ssh, strHost = backup, strUser = [USER-2] +P00 DEBUG: Protocol::Remote::Master->new(): iBufferMax = 4194304, iCompressLevel = 6, iCompressLevelNetwork = 3, iProtocolTimeout = 60, iSshPort = [undef], strCommand = [BACKREST-BIN] --buffer-size=4194304 --command=restore --compress-level=6 --compress-level-network=3 --config=[TEST_PATH]/backup/pgbackrest.conf --db-path=[TEST_PATH]/db-master/db/base --db-timeout=45 --protocol-timeout=60 --stanza=db --type=backup remote, strCommandSSH = /usr/bin/ssh, strHost = backup, strUser = [USER-2] P00 DEBUG: Protocol::Command::Master->new(): iBufferMax = 4194304, iCompressLevel = 6, iCompressLevelNetwork = 3, iProtocolTimeout = 60, strCommand = /usr/bin/ssh -o LogLevel=error -o Compression=no -o PasswordAuthentication=no backrest@backup '[BACKREST-BIN] --buffer-size=4194304 --command=restore --compress-level=6 --compress-level-network=3 --config=[TEST_PATH]/backup/pgbackrest.conf --db-path=[TEST_PATH]/db-master/db/base --db-timeout=45 --protocol-timeout=60 --stanza=db --type=backup remote', strId = 'backup remote', strName = remote P00 DEBUG: Storage::Local->new(): bAllowTemp = , hRule = [undef], lBufferMax = 4194304, oDriver = [object], strDefaultFileMode = <0640>, strDefaultPathMode = <0750>, strPathBase = [TEST_PATH]/db-master/db/base, strTempExtension = pgbackrest.tmp P00 DEBUG: Storage::Local->pathExists(): strPathExp = [TEST_PATH]/db-master/db/base @@ -1633,7 +1633,7 @@ P00 DEBUG: Storage::Local->exists=>: bExists = true P00 DEBUG: Db->new(): iRemoteIdx = 1 P00 DEBUG: Protocol::Helper::protocolGet(): bCache = , iProcessIdx = [undef], iRemoteIdx = 1, strBackRestBin = [undef], strCommand = , strRemoteType = db P00 DEBUG: Protocol::Helper::protocolGet: create (cached) remote protocol -P00 DEBUG: Protocol::Remote::Master->new(): iBufferMax = 4194304, iCompressLevel = 6, iCompressLevelNetwork = 3, iProtocolTimeout = 60, strCommand = [BACKREST-BIN] --buffer-size=4194304 --command=backup --compress-level=6 --compress-level-network=3 --config=[TEST_PATH]/db-master/pgbackrest.conf --db-path=[TEST_PATH]/db-master/db/base --db-timeout=45 --protocol-timeout=60 --repo-path=[TEST_PATH]/backup/repo --stanza=db --type=db remote, strCommandSSH = ssh, strHost = db-master, strUser = [USER-1] +P00 DEBUG: Protocol::Remote::Master->new(): iBufferMax = 4194304, iCompressLevel = 6, iCompressLevelNetwork = 3, iProtocolTimeout = 60, iSshPort = [undef], strCommand = [BACKREST-BIN] --buffer-size=4194304 --command=backup --compress-level=6 --compress-level-network=3 --config=[TEST_PATH]/db-master/pgbackrest.conf --db-path=[TEST_PATH]/db-master/db/base --db-timeout=45 --protocol-timeout=60 --repo-path=[TEST_PATH]/backup/repo --stanza=db --type=db remote, strCommandSSH = ssh, strHost = db-master, strUser = [USER-1] P00 DEBUG: Protocol::Command::Master->new(): iBufferMax = 4194304, iCompressLevel = 6, iCompressLevelNetwork = 3, iProtocolTimeout = 60, strCommand = ssh -o LogLevel=error -o Compression=no -o PasswordAuthentication=no [USER-1]@db-master '[BACKREST-BIN] --buffer-size=4194304 --command=backup --compress-level=6 --compress-level-network=3 --config=[TEST_PATH]/db-master/pgbackrest.conf --db-path=[TEST_PATH]/db-master/db/base --db-timeout=45 --protocol-timeout=60 --repo-path=[TEST_PATH]/backup/repo --stanza=db --type=db remote', strId = 'db-master remote', strName = remote P00 DEBUG: Db::dbObjectGet=>: iDbMasterIdx = 1, iDbStandbyIdx = [undef], oDbMaster = [object], oDbStandby = [undef] P00 DEBUG: Protocol::Helper::protocolGet(): bCache = , iProcessIdx = [undef], iRemoteIdx = 1, strBackRestBin = [undef], strCommand = , strRemoteType = db @@ -1963,7 +1963,7 @@ P00 DEBUG: Backup::Info->delete(): strBackupLabel = [BACKUP-INCR-1] P00 DEBUG: Db->new(): iRemoteIdx = 1 P00 DEBUG: Protocol::Helper::protocolGet(): bCache = , iProcessIdx = [undef], iRemoteIdx = 1, strBackRestBin = [undef], strCommand = , strRemoteType = db P00 DEBUG: Protocol::Helper::protocolGet: create (cached) remote protocol -P00 DEBUG: Protocol::Remote::Master->new(): iBufferMax = 4194304, iCompressLevel = 6, iCompressLevelNetwork = 3, iProtocolTimeout = 60, strCommand = [BACKREST-BIN] --buffer-size=4194304 --command=backup --compress-level=6 --compress-level-network=3 --config=[TEST_PATH]/db-master/pgbackrest.conf --db-path=[TEST_PATH]/db-master/db/base --db-timeout=45 --protocol-timeout=60 --repo-path=[TEST_PATH]/backup/repo --stanza=db --type=db remote, strCommandSSH = ssh, strHost = db-master, strUser = [USER-1] +P00 DEBUG: Protocol::Remote::Master->new(): iBufferMax = 4194304, iCompressLevel = 6, iCompressLevelNetwork = 3, iProtocolTimeout = 60, iSshPort = [undef], strCommand = [BACKREST-BIN] --buffer-size=4194304 --command=backup --compress-level=6 --compress-level-network=3 --config=[TEST_PATH]/db-master/pgbackrest.conf --db-path=[TEST_PATH]/db-master/db/base --db-timeout=45 --protocol-timeout=60 --repo-path=[TEST_PATH]/backup/repo --stanza=db --type=db remote, strCommandSSH = ssh, strHost = db-master, strUser = [USER-1] P00 DEBUG: Protocol::Command::Master->new(): iBufferMax = 4194304, iCompressLevel = 6, iCompressLevelNetwork = 3, iProtocolTimeout = 60, strCommand = ssh -o LogLevel=error -o Compression=no -o PasswordAuthentication=no [USER-1]@db-master '[BACKREST-BIN] --buffer-size=4194304 --command=backup --compress-level=6 --compress-level-network=3 --config=[TEST_PATH]/db-master/pgbackrest.conf --db-path=[TEST_PATH]/db-master/db/base --db-timeout=45 --protocol-timeout=60 --repo-path=[TEST_PATH]/backup/repo --stanza=db --type=db remote', strId = 'db-master remote', strName = remote P00 DEBUG: Db::dbObjectGet=>: iDbMasterIdx = 1, iDbStandbyIdx = [undef], oDbMaster = [object], oDbStandby = [undef] P00 DEBUG: Protocol::Helper::protocolGet(): bCache = , iProcessIdx = [undef], iRemoteIdx = 1, strBackRestBin = [undef], strCommand = , strRemoteType = db diff --git a/test/expect/mock-archive-002.log b/test/expect/mock-archive-002.log index f792bb651..d72310dd0 100644 --- a/test/expect/mock-archive-002.log +++ b/test/expect/mock-archive-002.log @@ -65,7 +65,7 @@ P00 DEBUG: Archive::Push::Push->process(): strWalPathFile = [TEST_PATH]/db- P00 DEBUG: Archive::Push::File::archivePushFile(): bCompress = false, strWalFile = 000000010000000100000001, strWalPath = [TEST_PATH]/db-master/db/base/pg_xlog P00 DEBUG: Protocol::Helper::protocolGet(): bCache = , iProcessIdx = [undef], iRemoteIdx = <1>, strBackRestBin = [undef], strCommand = , strRemoteType = backup P00 DEBUG: Protocol::Helper::protocolGet: create (cached) remote protocol -P00 DEBUG: Protocol::Remote::Master->new(): iBufferMax = 4194304, iCompressLevel = 6, iCompressLevelNetwork = 3, iProtocolTimeout = 60, strCommand = [BACKREST-BIN] --buffer-size=4194304 --command=archive-push --compress-level=6 --compress-level-network=3 --config=[TEST_PATH]/backup/pgbackrest.conf --db-path=[TEST_PATH]/db-master/db/base --db-timeout=45 --protocol-timeout=60 --stanza=db --type=backup remote, strCommandSSH = /usr/bin/ssh, strHost = backup, strUser = [USER-1] +P00 DEBUG: Protocol::Remote::Master->new(): iBufferMax = 4194304, iCompressLevel = 6, iCompressLevelNetwork = 3, iProtocolTimeout = 60, iSshPort = [undef], strCommand = [BACKREST-BIN] --buffer-size=4194304 --command=archive-push --compress-level=6 --compress-level-network=3 --config=[TEST_PATH]/backup/pgbackrest.conf --db-path=[TEST_PATH]/db-master/db/base --db-timeout=45 --protocol-timeout=60 --stanza=db --type=backup remote, strCommandSSH = /usr/bin/ssh, strHost = backup, strUser = [USER-1] P00 DEBUG: Protocol::Command::Master->new(): iBufferMax = 4194304, iCompressLevel = 6, iCompressLevelNetwork = 3, iProtocolTimeout = 60, strCommand = /usr/bin/ssh -o LogLevel=error -o Compression=no -o PasswordAuthentication=no backrest@backup '[BACKREST-BIN] --buffer-size=4194304 --command=archive-push --compress-level=6 --compress-level-network=3 --config=[TEST_PATH]/backup/pgbackrest.conf --db-path=[TEST_PATH]/db-master/db/base --db-timeout=45 --protocol-timeout=60 --stanza=db --type=backup remote', strId = 'backup remote', strName = remote P00 DEBUG: Protocol::Storage::Remote->new(): oProtocol = [object] P00 DEBUG: Archive::Common::walInfo(): strWalFile = [TEST_PATH]/db-master/db/base/pg_xlog/000000010000000100000001 @@ -99,7 +99,7 @@ P00 INFO: get WAL segment 000000010000000100000001 P00 DEBUG: Archive::Get::Get->get(): strDestinationFile = [TEST_PATH]/db-master/db/base/pg_xlog/RECOVERYXLOG, strSourceArchive = 000000010000000100000001 P00 DEBUG: Protocol::Helper::protocolGet(): bCache = , iProcessIdx = [undef], iRemoteIdx = <1>, strBackRestBin = [undef], strCommand = , strRemoteType = backup P00 DEBUG: Protocol::Helper::protocolGet: create (cached) remote protocol -P00 DEBUG: Protocol::Remote::Master->new(): iBufferMax = 4194304, iCompressLevel = 6, iCompressLevelNetwork = 3, iProtocolTimeout = 60, strCommand = [BACKREST-BIN] --buffer-size=4194304 --command=archive-get --compress-level=6 --compress-level-network=3 --config=[TEST_PATH]/backup/pgbackrest.conf --db-path=[TEST_PATH]/db-master/db/base --db-timeout=45 --protocol-timeout=60 --stanza=db --type=backup remote, strCommandSSH = ssh, strHost = backup, strUser = [USER-1] +P00 DEBUG: Protocol::Remote::Master->new(): iBufferMax = 4194304, iCompressLevel = 6, iCompressLevelNetwork = 3, iProtocolTimeout = 60, iSshPort = [undef], strCommand = [BACKREST-BIN] --buffer-size=4194304 --command=archive-get --compress-level=6 --compress-level-network=3 --config=[TEST_PATH]/backup/pgbackrest.conf --db-path=[TEST_PATH]/db-master/db/base --db-timeout=45 --protocol-timeout=60 --stanza=db --type=backup remote, strCommandSSH = ssh, strHost = backup, strUser = [USER-1] P00 DEBUG: Protocol::Command::Master->new(): iBufferMax = 4194304, iCompressLevel = 6, iCompressLevelNetwork = 3, iProtocolTimeout = 60, strCommand = ssh -o LogLevel=error -o Compression=no -o PasswordAuthentication=no backrest@backup '[BACKREST-BIN] --buffer-size=4194304 --command=archive-get --compress-level=6 --compress-level-network=3 --config=[TEST_PATH]/backup/pgbackrest.conf --db-path=[TEST_PATH]/db-master/db/base --db-timeout=45 --protocol-timeout=60 --stanza=db --type=backup remote', strId = 'backup remote', strName = remote P00 DEBUG: Protocol::Storage::Remote->new(): oProtocol = [object] P00 DEBUG: Archive::Base->getCheck(): strDbVersion = [undef], strWalFile = 000000010000000100000001, ullDbSysId = [undef] diff --git a/test/expect/stanza-create-002.log b/test/expect/stanza-create-002.log index 448d57000..09e70ae92 100644 --- a/test/expect/stanza-create-002.log +++ b/test/expect/stanza-create-002.log @@ -91,7 +91,7 @@ P00 DEBUG: Archive::Push::Push->process(): strWalPathFile = [TEST_PATH]/db- P00 DEBUG: Archive::Push::File::archivePushFile(): bCompress = true, strWalFile = 000000010000000100000001, strWalPath = [TEST_PATH]/db-master/db/base/pg_xlog P00 DEBUG: Protocol::Helper::protocolGet(): bCache = , iProcessIdx = [undef], iRemoteIdx = <1>, strBackRestBin = [undef], strCommand = , strRemoteType = backup P00 DEBUG: Protocol::Helper::protocolGet: create (cached) remote protocol -P00 DEBUG: Protocol::Remote::Master->new(): iBufferMax = 4194304, iCompressLevel = 6, iCompressLevelNetwork = 3, iProtocolTimeout = 60, strCommand = [BACKREST-BIN] --buffer-size=4194304 --command=archive-push --compress-level=6 --compress-level-network=3 --config=[TEST_PATH]/backup/pgbackrest.conf --db-path=[TEST_PATH]/db-master/db/base --db-timeout=45 --protocol-timeout=60 --stanza=db --type=backup remote, strCommandSSH = ssh, strHost = backup, strUser = [USER-2] +P00 DEBUG: Protocol::Remote::Master->new(): iBufferMax = 4194304, iCompressLevel = 6, iCompressLevelNetwork = 3, iProtocolTimeout = 60, iSshPort = [undef], strCommand = [BACKREST-BIN] --buffer-size=4194304 --command=archive-push --compress-level=6 --compress-level-network=3 --config=[TEST_PATH]/backup/pgbackrest.conf --db-path=[TEST_PATH]/db-master/db/base --db-timeout=45 --protocol-timeout=60 --stanza=db --type=backup remote, strCommandSSH = ssh, strHost = backup, strUser = [USER-2] P00 DEBUG: Protocol::Command::Master->new(): iBufferMax = 4194304, iCompressLevel = 6, iCompressLevelNetwork = 3, iProtocolTimeout = 60, strCommand = ssh -o LogLevel=error -o Compression=no -o PasswordAuthentication=no backrest@backup '[BACKREST-BIN] --buffer-size=4194304 --command=archive-push --compress-level=6 --compress-level-network=3 --config=[TEST_PATH]/backup/pgbackrest.conf --db-path=[TEST_PATH]/db-master/db/base --db-timeout=45 --protocol-timeout=60 --stanza=db --type=backup remote', strId = 'backup remote', strName = remote P00 DEBUG: Protocol::Storage::Remote->new(): oProtocol = [object] P00 DEBUG: Archive::Common::walInfo(): strWalFile = [TEST_PATH]/db-master/db/base/pg_xlog/000000010000000100000001 diff --git a/test/lib/pgBackRestTest/Common/DefineTest.pm b/test/lib/pgBackRestTest/Common/DefineTest.pm index ae9e64dba..24e3d77e8 100644 --- a/test/lib/pgBackRestTest/Common/DefineTest.pm +++ b/test/lib/pgBackRestTest/Common/DefineTest.pm @@ -258,6 +258,15 @@ my $oTestDef = 'Protocol/Base/Minion' => TESTDEF_COVERAGE_PARTIAL, }, }, + { + &TESTDEF_NAME => 'helper', + &TESTDEF_TOTAL => 1, + + &TESTDEF_COVERAGE => + { + 'Protocol/Helper' => TESTDEF_COVERAGE_PARTIAL, + }, + }, ] }, # Info tests diff --git a/test/lib/pgBackRestTest/Module/Protocol/ProtocolHelperTest.pm b/test/lib/pgBackRestTest/Module/Protocol/ProtocolHelperTest.pm new file mode 100644 index 000000000..80e3ab34a --- /dev/null +++ b/test/lib/pgBackRestTest/Module/Protocol/ProtocolHelperTest.pm @@ -0,0 +1,132 @@ +#################################################################################################################################### +# Protocol Helper Tests +#################################################################################################################################### +package pgBackRestTest::Module::Protocol::ProtocolHelperTest; +use parent 'pgBackRestTest::Env::ConfigEnvTest'; + +#################################################################################################################################### +# Perl includes +#################################################################################################################################### +use strict; +use warnings FATAL => qw(all); +use Carp qw(confess); +use English '-no_match_vars'; + +use File::Basename qw(dirname); +use Storable qw(dclone); + +use pgBackRest::Archive::Common; +use pgBackRest::Archive::Push::Push; +use pgBackRest::Archive::Push::Async; +use pgBackRest::Archive::Push::File; +use pgBackRest::Common::Exception; +use pgBackRest::Common::Lock; +use pgBackRest::Common::Log; +use pgBackRest::Config::Config; +use pgBackRest::DbVersion; +use pgBackRest::Protocol::Helper; +use pgBackRest::Protocol::Storage::Helper; +use pgBackRest::Storage::Helper; + +use pgBackRestTest::Env::HostEnvTest; +use pgBackRestTest::Common::ExecuteTest; +use pgBackRestTest::Env::Host::HostBackupTest; +use pgBackRestTest::Common::RunTest; + +#################################################################################################################################### +# initModule +#################################################################################################################################### +sub initModule +{ + my $self = shift; + + $self->{strDbPath} = $self->testPath() . '/db'; + $self->{strWalPath} = "$self->{strDbPath}/pg_xlog"; + $self->{strWalStatusPath} = "$self->{strWalPath}/archive_status"; + $self->{strWalHash} = "1e34fa1c833090d94b9bb14f2a8d3153dca6ea27"; + $self->{strRepoPath} = $self->testPath() . '/repo'; + $self->{strArchivePath} = "$self->{strRepoPath}/archive/" . $self->stanza(); + $self->{strSpoolPath} = "$self->{strArchivePath}/out"; +} + +#################################################################################################################################### +# initTest +#################################################################################################################################### +sub initTest +{ + my $self = shift; + + # Create WAL path + storageTest()->pathCreate($self->{strWalStatusPath}, {bIgnoreExists => true, bCreateParent => true}); + + # Create archive info + storageTest()->pathCreate($self->{strArchivePath}, {bIgnoreExists => true, bCreateParent => true}); + + my $oOption = $self->initOption(); + logDisable(); $self->configLoadExpect(dclone($oOption), CMD_ARCHIVE_PUSH); logEnable(); + my $oArchiveInfo = new pgBackRest::Archive::Info($self->{strArchivePath}, false, {bIgnoreMissing => true}); + $oArchiveInfo->create(PG_VERSION_94, WAL_VERSION_94_SYS_ID, true); + + $self->{strArchiveId} = $oArchiveInfo->archiveId(); +} + +#################################################################################################################################### +# initOption +#################################################################################################################################### +sub initOption +{ + my $self = shift; + + my $oOption = {}; + + $self->optionSetTest($oOption, OPTION_STANZA, $self->stanza()); + $self->optionSetTest($oOption, OPTION_DB_PATH, $self->{strDbPath}); + $self->optionSetTest($oOption, OPTION_REPO_PATH, $self->{strRepoPath}); + $self->optionSetTest($oOption, OPTION_LOG_PATH, $self->testPath()); + $self->optionBoolSetTest($oOption, OPTION_COMPRESS, false); + + $self->optionSetTest($oOption, OPTION_DB_TIMEOUT, 5); + $self->optionSetTest($oOption, OPTION_PROTOCOL_TIMEOUT, 6); + $self->optionSetTest($oOption, OPTION_ARCHIVE_TIMEOUT, 3); + + return $oOption; +} + +#################################################################################################################################### +# run +#################################################################################################################################### +sub run +{ + my $self = shift; + + my $oOption = $self->initOption(); + + ################################################################################################################################ + if ($self->begin("Protocol::Helper")) + { + $self->optionSetTest($oOption, OPTION_BACKUP_HOST, 'localhost'); + $self->optionSetTest($oOption, OPTION_BACKUP_USER, $self->pgUser()); + logDisable(); $self->configLoadExpect(dclone($oOption), CMD_ARCHIVE_PUSH); logEnable(); + + $self->testResult(sub {protocolGet(BACKUP, undef, {strBackRestBin => $self->backrestExe()})}, "[object]", + 'ssh default port'); + + # Destroy protocol object + protocolDestroy(); + + $self->optionSetTest($oOption, OPTION_BACKUP_SSH_PORT, 25); + logDisable(); $self->configLoadExpect(dclone($oOption), CMD_ARCHIVE_PUSH); logEnable(); + + $self->testException(sub {protocolGet(BACKUP, undef, {strBackRestBin => $self->backrestExe()})}, ERROR_FILE_READ, + "process 'localhost remote' terminated unexpectedly: ssh: connect to host localhost port 25:"); + + # Destroy protocol object + protocolDestroy(); + + $self->optionReset($oOption, OPTION_BACKUP_HOST); + $self->optionReset($oOption, OPTION_BACKUP_USER); + $self->optionReset($oOption, OPTION_BACKUP_SSH_PORT); + } +} + +1;