You've already forked pgbackrest
							
							
				mirror of
				https://github.com/pgbackrest/pgbackrest.git
				synced 2025-10-30 23:37:45 +02:00 
			
		
		
		
	Change operation constants and functions to command.
This commit is contained in:
		| @@ -39,9 +39,9 @@ pg_backrest.pl - Simple Postgres Backup and Restore | ||||
|  | ||||
| =head1 SYNOPSIS | ||||
|  | ||||
| pg_backrest.pl [options] [operation] | ||||
| pg_backrest.pl [options] [command] | ||||
|  | ||||
|  Operations: | ||||
|  Commands: | ||||
|    archive-get      retrieve an archive file from backup | ||||
|    archive-push     push an archive file to backup | ||||
|    backup           backup a cluster | ||||
| @@ -50,7 +50,6 @@ pg_backrest.pl [options] [operation] | ||||
|  | ||||
|  General Options: | ||||
|    --stanza         stanza (cluster) to operate on | ||||
|                     (currently required for all operations) | ||||
|    --config         alternate path for pg_backrest.conf | ||||
|                     (defaults to /etc/pg_backrest.conf) | ||||
|    --version        display version and exit | ||||
| @@ -136,7 +135,7 @@ eval | ||||
|     ################################################################################################################################ | ||||
|     # Process remote commands | ||||
|     ################################################################################################################################ | ||||
|     if (operationTest(OP_REMOTE)) | ||||
|     if (commandTest(CMD_REMOTE)) | ||||
|     { | ||||
|         # Turn all logging off | ||||
|         log_level_set(OFF, OFF); | ||||
| @@ -165,7 +164,7 @@ eval | ||||
|     ################################################################################################################################ | ||||
|     # Process archive commands | ||||
|     ################################################################################################################################ | ||||
|     if (operationTest(OP_ARCHIVE_PUSH) || operationTest(OP_ARCHIVE_GET)) | ||||
|     if (commandTest(CMD_ARCHIVE_PUSH) || commandTest(CMD_ARCHIVE_GET)) | ||||
|     { | ||||
|         safe_exit(new BackRest::Archive()->process()); | ||||
|     } | ||||
| @@ -173,20 +172,20 @@ eval | ||||
|     ################################################################################################################################ | ||||
|     # Process info command | ||||
|     ################################################################################################################################ | ||||
|     if (operationTest(OP_INFO)) | ||||
|     if (commandTest(CMD_INFO)) | ||||
|     { | ||||
|         safe_exit(new BackRest::Info()->info()); | ||||
|     } | ||||
|  | ||||
|     ################################################################################################################################ | ||||
|     # Acquire the operation lock | ||||
|     # Acquire the command lock | ||||
|     ################################################################################################################################ | ||||
|     lockAcquire(operationGet()); | ||||
|     lockAcquire(commandGet()); | ||||
|  | ||||
|     ################################################################################################################################ | ||||
|     # Open the log file | ||||
|     ################################################################################################################################ | ||||
|     log_file_set(optionGet(OPTION_REPO_PATH) . '/log/' . optionGet(OPTION_STANZA) . '-' . lc(operationGet())); | ||||
|     log_file_set(optionGet(OPTION_REPO_PATH) . '/log/' . optionGet(OPTION_STANZA) . '-' . lc(commandGet())); | ||||
|  | ||||
|     ################################################################################################################################ | ||||
|     # Create the thread group that will be used for parallel processing | ||||
| @@ -207,11 +206,11 @@ eval | ||||
|     ################################################################################################################################ | ||||
|     # RESTORE | ||||
|     ################################################################################################################################ | ||||
|     if (operationTest(OP_RESTORE)) | ||||
|     if (commandTest(CMD_RESTORE)) | ||||
|     { | ||||
|         if (optionRemoteTypeTest(DB)) | ||||
|         { | ||||
|             confess &log(ASSERT, 'restore operation must be performed locally on the db server'); | ||||
|             confess &log(ASSERT, 'restore command must be performed locally on the db server'); | ||||
|         } | ||||
|  | ||||
|         # Do the restore | ||||
| @@ -241,16 +240,16 @@ eval | ||||
|     ################################################################################################################################ | ||||
|     # GET MORE CONFIG INFO | ||||
|     ################################################################################################################################ | ||||
|     # Make sure backup and expire operations happen on the backup side | ||||
|     # Make sure backup and expire command happen on the backup side | ||||
|     if (optionRemoteTypeTest(BACKUP)) | ||||
|     { | ||||
|         confess &log(ERROR, 'backup and expire operations must run on the backup host'); | ||||
|         confess &log(ERROR, 'backup and expire commands must run on the backup host'); | ||||
|     } | ||||
|  | ||||
|     # Initialize the db object | ||||
|     my $oDb; | ||||
|  | ||||
|     if (operationTest(OP_BACKUP)) | ||||
|     if (commandTest(CMD_BACKUP)) | ||||
|     { | ||||
|         $oDb = new BackRest::Db | ||||
|         ( | ||||
| @@ -261,7 +260,7 @@ eval | ||||
|             optionGet(OPTION_DB_USER, optionTest(OPTION_DB_HOST)) | ||||
|         ); | ||||
|  | ||||
|         # Run backup_init - parameters required for backup and restore operations | ||||
|         # Run backup_init - parameters required for backup and restore commands | ||||
|         backup_init | ||||
|         ( | ||||
|             $oDb, | ||||
| @@ -279,17 +278,17 @@ eval | ||||
|     ################################################################################################################################ | ||||
|     # BACKUP | ||||
|     ################################################################################################################################ | ||||
|     if (operationTest(OP_BACKUP)) | ||||
|     if (commandTest(CMD_BACKUP)) | ||||
|     { | ||||
|         backup(optionGet(OPTION_DB_PATH), optionGet(OPTION_START_FAST)); | ||||
|  | ||||
|         operationSet(OP_EXPIRE); | ||||
|         commandSet(CMD_EXPIRE); | ||||
|     } | ||||
|  | ||||
|     ################################################################################################################################ | ||||
|     # EXPIRE | ||||
|     ################################################################################################################################ | ||||
|     if (operationTest(OP_EXPIRE)) | ||||
|     if (commandTest(CMD_EXPIRE)) | ||||
|     { | ||||
|         if (!defined($oDb)) | ||||
|         { | ||||
| @@ -313,7 +312,7 @@ eval | ||||
|     # Cleanup backup (should be removed when backup becomes an object) | ||||
|     backup_cleanup(); | ||||
|  | ||||
|     # Release the operation lock | ||||
|     # Release the command lock | ||||
|     lockRelease(); | ||||
|  | ||||
|     safe_exit(0); | ||||
|   | ||||
| @@ -55,19 +55,19 @@ sub process | ||||
|     my $self = shift; | ||||
|  | ||||
|     # Process push | ||||
|     if (operationTest(OP_ARCHIVE_PUSH)) | ||||
|     if (commandTest(CMD_ARCHIVE_PUSH)) | ||||
|     { | ||||
|         return $self->pushProcess(); | ||||
|     } | ||||
|  | ||||
|     # Process get | ||||
|     if (operationTest(OP_ARCHIVE_GET)) | ||||
|     if (commandTest(CMD_ARCHIVE_GET)) | ||||
|     { | ||||
|         return $self->getProcess(); | ||||
|     } | ||||
|  | ||||
|     # Error if any other operation is found | ||||
|     confess &log(ASSERT, "Archive->process() called with invalid operation: " . operationGet()); | ||||
|     # Error if any other command is found | ||||
|     confess &log(ASSERT, "Archive->process() called with invalid command: " . commandGet()); | ||||
| } | ||||
|  | ||||
| ################################################################################################################################ | ||||
| @@ -327,7 +327,6 @@ sub getCheck | ||||
|     my $self = shift; | ||||
|     my $oFile = shift; | ||||
|  | ||||
|     # &log(DEBUG, OP_ARCHIVE_GET_CHECK . "()"); | ||||
|     my $strArchiveId; | ||||
|  | ||||
|     if ($oFile->is_remote(PATH_BACKUP_ARCHIVE)) | ||||
| @@ -352,16 +351,16 @@ sub pushProcess | ||||
| { | ||||
|     my $self = shift; | ||||
|  | ||||
|     # Make sure the archive push operation happens on the db side | ||||
|     # Make sure the archive push command happens on the db side | ||||
|     if (optionRemoteTypeTest(DB)) | ||||
|     { | ||||
|         confess &log(ERROR, OP_ARCHIVE_PUSH . ' operation must run on the db host'); | ||||
|         confess &log(ERROR, CMD_ARCHIVE_PUSH . ' operation must run on the db host'); | ||||
|     } | ||||
|  | ||||
|     # Load the archive object | ||||
|     use BackRest::Archive; | ||||
|  | ||||
|     # If an archive section has been defined, use that instead of the backup section when operation is OP_ARCHIVE_PUSH | ||||
|     # If an archive section has been defined, use that instead of the backup section when command is CMD_ARCHIVE_PUSH | ||||
|     my $bArchiveAsync = optionGet(OPTION_ARCHIVE_ASYNC); | ||||
|     my $strArchivePath = optionGet(OPTION_REPO_PATH); | ||||
|  | ||||
| @@ -418,7 +417,7 @@ sub pushProcess | ||||
|     } | ||||
|  | ||||
|     # Create a lock file to make sure async archive-push does not run more than once | ||||
|     if (!lockAcquire(operationGet(), false)) | ||||
|     if (!lockAcquire(commandGet(), false)) | ||||
|     { | ||||
|         &log(DEBUG, 'another async archive-push process is already running - exiting'); | ||||
|         return 0; | ||||
| @@ -735,7 +734,7 @@ sub xfer | ||||
|             unlink($strArchiveFile) | ||||
|                 or confess &log(ERROR, "copied ${strArchiveFile} to archive successfully but unable to remove it locally.  " . | ||||
|                                        'This file will need to be cleaned up manually.  If the problem persists, check if ' . | ||||
|                                        OP_ARCHIVE_PUSH . ' is being run with different permissions in different contexts.'); | ||||
|                                        CMD_ARCHIVE_PUSH . ' is being run with different permissions in different contexts.'); | ||||
|  | ||||
|             # Remove the copied segment from the total size | ||||
|             $lFileSize -= $oManifestHash{name}{$strFile}{size}; | ||||
|   | ||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -19,7 +19,7 @@ use constant | ||||
|     ERROR_CONFIG                       => 102, | ||||
|     ERROR_FILE_INVALID                 => 103, | ||||
|     ERROR_FORMAT                       => 104, | ||||
|     ERROR_OPERATION_REQUIRED           => 105, | ||||
|     ERROR_COMMAND_REQUIRED             => 105, | ||||
|     ERROR_OPTION_INVALID               => 106, | ||||
|     ERROR_OPTION_INVALID_VALUE         => 107, | ||||
|     ERROR_OPTION_INVALID_RANGE         => 108, | ||||
| @@ -37,7 +37,7 @@ use constant | ||||
|     ERROR_ARCHIVE_DUPLICATE            => 120, | ||||
|     ERROR_VERSION_NOT_SUPPORTED        => 121, | ||||
|     ERROR_PATH_CREATE                  => 122, | ||||
|     ERROR_OPERATION_INVALID            => 123, | ||||
|     ERROR_COMMAND_INVALID              => 123, | ||||
|     ERROR_HOST_CONNECT                 => 124, | ||||
|     ERROR_LOCK_ACQUIRE                 => 125, | ||||
|     ERROR_BACKUP_MISMATCH              => 126, | ||||
| @@ -48,11 +48,11 @@ use constant | ||||
|     ERROR_UNKNOWN                      => 199 | ||||
| }; | ||||
|  | ||||
| our @EXPORT = qw(ERROR_ASSERT ERROR_CHECKSUM ERROR_CONFIG ERROR_FILE_INVALID ERROR_FORMAT ERROR_OPERATION_REQUIRED | ||||
| our @EXPORT = qw(ERROR_ASSERT ERROR_CHECKSUM ERROR_CONFIG ERROR_FILE_INVALID ERROR_FORMAT ERROR_COMMAND_REQUIRED | ||||
|                  ERROR_OPTION_INVALID ERROR_OPTION_INVALID_VALUE ERROR_OPTION_INVALID_RANGE ERROR_OPTION_INVALID_PAIR | ||||
|                  ERROR_OPTION_DUPLICATE_KEY ERROR_OPTION_NEGATE ERROR_OPTION_REQUIRED ERROR_POSTMASTER_RUNNING ERROR_PROTOCOL | ||||
|                  ERROR_RESTORE_PATH_NOT_EMPTY ERROR_FILE_OPEN ERROR_FILE_READ ERROR_PARAM_REQUIRED ERROR_ARCHIVE_MISMATCH | ||||
|                  ERROR_ARCHIVE_DUPLICATE ERROR_VERSION_NOT_SUPPORTED ERROR_PATH_CREATE ERROR_OPERATION_INVALID ERROR_HOST_CONNECT | ||||
|                  ERROR_ARCHIVE_DUPLICATE ERROR_VERSION_NOT_SUPPORTED ERROR_PATH_CREATE ERROR_COMMAND_INVALID ERROR_HOST_CONNECT | ||||
|                  ERROR_UNKNOWN ERROR_LOCK_ACQUIRE ERROR_BACKUP_MISMATCH ERROR_FILE_SYNC ERROR_PATH_OPEN ERROR_PATH_SYNC); | ||||
|  | ||||
| #################################################################################################################################### | ||||
|   | ||||
| @@ -184,7 +184,7 @@ sub listStanza | ||||
|     } | ||||
|     else | ||||
|     { | ||||
|         my @stryStanza = $oFile->list(PATH_BACKUP, OP_BACKUP, undef, undef, true); | ||||
|         my @stryStanza = $oFile->list(PATH_BACKUP, CMD_BACKUP, undef, undef, true); | ||||
|  | ||||
|         foreach my $strStanzaFound (@stryStanza) | ||||
|         { | ||||
| @@ -250,7 +250,7 @@ sub listBackup | ||||
|     my $strStanza = shift; | ||||
|  | ||||
|     # Load or build backup.info | ||||
|     my $oBackupInfo = new BackRest::BackupInfo($oFile->path_get(PATH_BACKUP, OP_BACKUP . "/${strStanza}")); | ||||
|     my $oBackupInfo = new BackRest::BackupInfo($oFile->path_get(PATH_BACKUP, CMD_BACKUP . "/${strStanza}")); | ||||
|  | ||||
|     # Build the db list | ||||
|     my @oyDbList; | ||||
|   | ||||
| @@ -29,9 +29,9 @@ use BackRest::Utility; | ||||
| #################################################################################################################################### | ||||
| # Operation constants | ||||
| #################################################################################################################################### | ||||
| use constant OP_REMOTE_BASE                                       => 'Remote'; | ||||
| use constant OP_REMOTE                                              => 'Remote'; | ||||
|  | ||||
| use constant OP_REMOTE_NEW                                        => OP_REMOTE_BASE . "->new"; | ||||
| use constant OP_REMOTE_NEW                                          => OP_REMOTE . "->new"; | ||||
|  | ||||
| #################################################################################################################################### | ||||
| # Operation constants | ||||
| @@ -61,7 +61,7 @@ sub new | ||||
|              defined($strHost) ? DEBUG : TRACE); | ||||
|  | ||||
|     # Init object and store variables | ||||
|     my $self = $class->SUPER::new(OP_REMOTE, !defined($strHost), $strCommand, $iBlockSize, $iCompressLevel, $iCompressLevelNetwork, | ||||
|     my $self = $class->SUPER::new(CMD_REMOTE, !defined($strHost), $strCommand, $iBlockSize, $iCompressLevel, $iCompressLevelNetwork, | ||||
|                                   $strHost, $strUser); | ||||
|  | ||||
|     return $self; | ||||
|   | ||||
| @@ -536,7 +536,7 @@ sub recovery | ||||
|     # Write the restore command | ||||
|     if (!$bRestoreCommandOverride) | ||||
|     { | ||||
|         $strRecovery .=  "restore_command = '" . operationWrite(OP_ARCHIVE_GET) . " %f \"%p\"'\n"; | ||||
|         $strRecovery .=  "restore_command = '" . commandWrite(CMD_ARCHIVE_GET) . " %f \"%p\"'\n"; | ||||
|     } | ||||
|  | ||||
|     # If RECOVERY_TYPE_DEFAULT do not write target options | ||||
|   | ||||
| @@ -46,12 +46,12 @@ sub optionSetBoolTest | ||||
|     $$oOption{boolean}{$strKey} = defined($bValue) ? $bValue : true; | ||||
| } | ||||
|  | ||||
| sub operationSetTest | ||||
| sub commandSetTest | ||||
| { | ||||
|     my $oOption = shift; | ||||
|     my $strOperation = shift; | ||||
|     my $strCommand = shift; | ||||
|  | ||||
|     $$oOption{operation} = $strOperation; | ||||
|     $$oOption{command} = $strCommand; | ||||
| } | ||||
|  | ||||
| sub optionRemoveTest | ||||
| @@ -92,7 +92,7 @@ sub argvWriteTest | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     $ARGV[@ARGV] = $$oOption{operation}; | ||||
|     $ARGV[@ARGV] = $$oOption{command}; | ||||
|  | ||||
|     &log(INFO, "    command line: " . join(" ", @ARGV)); | ||||
|  | ||||
| @@ -102,7 +102,7 @@ sub argvWriteTest | ||||
| sub configLoadExpect | ||||
| { | ||||
|     my $oOption = shift; | ||||
|     my $strOperation = shift; | ||||
|     my $strCommand = shift; | ||||
|     my $iExpectedError = shift; | ||||
|     my $strErrorParam1 = shift; | ||||
|     my $strErrorParam2 = shift; | ||||
| @@ -110,7 +110,7 @@ sub configLoadExpect | ||||
|  | ||||
|     my $oOptionRuleExpected = optionRuleGet(); | ||||
|  | ||||
|     operationSetTest($oOption, $strOperation); | ||||
|     commandSetTest($oOption, $strCommand); | ||||
|     argvWriteTest($oOption); | ||||
|  | ||||
|     eval | ||||
| @@ -139,12 +139,12 @@ sub configLoadExpect | ||||
|  | ||||
|             if ($iExpectedError == ERROR_OPTION_REQUIRED) | ||||
|             { | ||||
|                 $strError = "${strOperation} operation requires option: ${strErrorParam1}" . | ||||
|                 $strError = "${strCommand} command requires option: ${strErrorParam1}" . | ||||
|                             (defined($strErrorParam2) ? "\nHINT: ${strErrorParam2}" : ''); | ||||
|             } | ||||
|             elsif ($iExpectedError == ERROR_OPERATION_REQUIRED) | ||||
|             elsif ($iExpectedError == ERROR_COMMAND_REQUIRED) | ||||
|             { | ||||
|                 $strError = "operation must be specified"; | ||||
|                 $strError = "command must be specified"; | ||||
|             } | ||||
|             elsif ($iExpectedError == ERROR_OPTION_INVALID) | ||||
|             { | ||||
| @@ -272,14 +272,14 @@ sub BackRestTestConfig_Test | ||||
|         { | ||||
|             optionSetTest($oOption, OPTION_DB_PATH, '/db'); | ||||
|  | ||||
|             configLoadExpect($oOption, OP_BACKUP, ERROR_OPTION_REQUIRED, OPTION_STANZA); | ||||
|             configLoadExpect($oOption, CMD_BACKUP, ERROR_OPTION_REQUIRED, OPTION_STANZA); | ||||
|         } | ||||
|  | ||||
|         if (BackRestTestCommon_Run(++$iRun, 'backup with boolean stanza')) | ||||
|         { | ||||
|             optionSetBoolTest($oOption, OPTION_STANZA); | ||||
|  | ||||
|             configLoadExpect($oOption, OP_BACKUP, ERROR_OPERATION_REQUIRED); | ||||
|             configLoadExpect($oOption, CMD_BACKUP, ERROR_COMMAND_REQUIRED); | ||||
|         } | ||||
|  | ||||
|         if (BackRestTestCommon_Run(++$iRun, 'backup type defaults to ' . BACKUP_TYPE_INCR)) | ||||
| @@ -287,7 +287,7 @@ sub BackRestTestConfig_Test | ||||
|             optionSetTest($oOption, OPTION_STANZA, $strStanza); | ||||
|             optionSetTest($oOption, OPTION_DB_PATH, '/db'); | ||||
|  | ||||
|             configLoadExpect($oOption, OP_BACKUP); | ||||
|             configLoadExpect($oOption, CMD_BACKUP); | ||||
|             optionTestExpect(OPTION_TYPE, BACKUP_TYPE_INCR); | ||||
|         } | ||||
|  | ||||
| @@ -297,7 +297,7 @@ sub BackRestTestConfig_Test | ||||
|             optionSetTest($oOption, OPTION_DB_PATH, '/db'); | ||||
|             optionSetTest($oOption, OPTION_TYPE, BACKUP_TYPE_FULL); | ||||
|  | ||||
|             configLoadExpect($oOption, OP_BACKUP); | ||||
|             configLoadExpect($oOption, CMD_BACKUP); | ||||
|             optionTestExpect(OPTION_TYPE, BACKUP_TYPE_FULL); | ||||
|         } | ||||
|  | ||||
| @@ -307,7 +307,7 @@ sub BackRestTestConfig_Test | ||||
|             optionSetTest($oOption, OPTION_DB_PATH, '/db'); | ||||
|             optionSetTest($oOption, OPTION_TYPE, BOGUS); | ||||
|  | ||||
|             configLoadExpect($oOption, OP_BACKUP, ERROR_OPTION_INVALID_VALUE, BOGUS, OPTION_TYPE); | ||||
|             configLoadExpect($oOption, CMD_BACKUP, ERROR_OPTION_INVALID_VALUE, BOGUS, OPTION_TYPE); | ||||
|         } | ||||
|  | ||||
|         if (BackRestTestCommon_Run(++$iRun, 'backup invalid force')) | ||||
| @@ -316,7 +316,7 @@ sub BackRestTestConfig_Test | ||||
|             optionSetTest($oOption, OPTION_DB_PATH, '/db'); | ||||
|             optionSetBoolTest($oOption, OPTION_FORCE); | ||||
|  | ||||
|             configLoadExpect($oOption, OP_BACKUP, ERROR_OPTION_INVALID, OPTION_FORCE, OPTION_NO_START_STOP); | ||||
|             configLoadExpect($oOption, CMD_BACKUP, ERROR_OPTION_INVALID, OPTION_FORCE, OPTION_NO_START_STOP); | ||||
|         } | ||||
|  | ||||
|         if (BackRestTestCommon_Run(++$iRun, 'backup valid force')) | ||||
| @@ -327,7 +327,7 @@ sub BackRestTestConfig_Test | ||||
|             optionSetBoolTest($oOption, OPTION_NO_START_STOP); | ||||
|             optionSetBoolTest($oOption, OPTION_FORCE); | ||||
|  | ||||
|             configLoadExpect($oOption, OP_BACKUP); | ||||
|             configLoadExpect($oOption, CMD_BACKUP); | ||||
|             optionTestExpect(OPTION_NO_START_STOP, true); | ||||
|             optionTestExpect(OPTION_FORCE, true); | ||||
|         } | ||||
| @@ -339,7 +339,7 @@ sub BackRestTestConfig_Test | ||||
|             optionSetBoolTest($oOption, OPTION_TEST); | ||||
|             optionSetTest($oOption, OPTION_TEST_DELAY, BOGUS); | ||||
|  | ||||
|             configLoadExpect($oOption, OP_BACKUP, ERROR_OPTION_INVALID_VALUE, BOGUS, OPTION_TEST_DELAY); | ||||
|             configLoadExpect($oOption, CMD_BACKUP, ERROR_OPTION_INVALID_VALUE, BOGUS, OPTION_TEST_DELAY); | ||||
|         } | ||||
|  | ||||
|         if (BackRestTestCommon_Run(++$iRun, 'backup invalid ' . OPTION_TEST_DELAY)) | ||||
| @@ -348,7 +348,7 @@ sub BackRestTestConfig_Test | ||||
|             optionSetTest($oOption, OPTION_DB_PATH, '/db'); | ||||
|             optionSetTest($oOption, OPTION_TEST_DELAY, 5); | ||||
|  | ||||
|             configLoadExpect($oOption, OP_BACKUP, ERROR_OPTION_INVALID, OPTION_TEST_DELAY, OPTION_TEST); | ||||
|             configLoadExpect($oOption, CMD_BACKUP, ERROR_OPTION_INVALID, OPTION_TEST_DELAY, OPTION_TEST); | ||||
|         } | ||||
|  | ||||
|         if (BackRestTestCommon_Run(++$iRun, 'backup check ' . OPTION_TEST_DELAY . ' undef')) | ||||
| @@ -356,7 +356,7 @@ sub BackRestTestConfig_Test | ||||
|             optionSetTest($oOption, OPTION_STANZA, $strStanza); | ||||
|             optionSetTest($oOption, OPTION_DB_PATH, '/db'); | ||||
|  | ||||
|             configLoadExpect($oOption, OP_BACKUP); | ||||
|             configLoadExpect($oOption, CMD_BACKUP); | ||||
|             optionTestExpect(OPTION_TEST_DELAY); | ||||
|         } | ||||
|  | ||||
| @@ -367,7 +367,7 @@ sub BackRestTestConfig_Test | ||||
|             optionSetTest($oOption, OPTION_TARGET, BOGUS); | ||||
|  | ||||
|             @oyArray = (RECOVERY_TYPE_NAME, RECOVERY_TYPE_TIME, RECOVERY_TYPE_XID); | ||||
|             configLoadExpect($oOption, OP_RESTORE, ERROR_OPTION_INVALID, OPTION_TARGET, OPTION_TYPE, \@oyArray); | ||||
|             configLoadExpect($oOption, CMD_RESTORE, ERROR_OPTION_INVALID, OPTION_TARGET, OPTION_TYPE, \@oyArray); | ||||
|         } | ||||
|  | ||||
|         if (BackRestTestCommon_Run(++$iRun, 'restore ' . OPTION_TARGET)) | ||||
| @@ -376,7 +376,7 @@ sub BackRestTestConfig_Test | ||||
|             optionSetTest($oOption, OPTION_TYPE, RECOVERY_TYPE_NAME); | ||||
|             optionSetTest($oOption, OPTION_TARGET, BOGUS); | ||||
|  | ||||
|             configLoadExpect($oOption, OP_RESTORE); | ||||
|             configLoadExpect($oOption, CMD_RESTORE); | ||||
|             optionTestExpect(OPTION_TYPE, RECOVERY_TYPE_NAME); | ||||
|             optionTestExpect(OPTION_TARGET, BOGUS); | ||||
|             optionTestExpect(OPTION_TARGET_TIMELINE); | ||||
| @@ -388,7 +388,7 @@ sub BackRestTestConfig_Test | ||||
|             optionSetTest($oOption, OPTION_DB_PATH, '/db'); | ||||
|             optionSetTest($oOption, OPTION_THREAD_MAX, BOGUS); | ||||
|  | ||||
|             configLoadExpect($oOption, OP_BACKUP, ERROR_OPTION_INVALID_VALUE, BOGUS, OPTION_THREAD_MAX); | ||||
|             configLoadExpect($oOption, CMD_BACKUP, ERROR_OPTION_INVALID_VALUE, BOGUS, OPTION_THREAD_MAX); | ||||
|         } | ||||
|  | ||||
|         if (BackRestTestCommon_Run(++$iRun, 'invalid float ' . OPTION_THREAD_MAX)) | ||||
| @@ -397,7 +397,7 @@ sub BackRestTestConfig_Test | ||||
|             optionSetTest($oOption, OPTION_DB_PATH, '/db'); | ||||
|             optionSetTest($oOption, OPTION_THREAD_MAX, '0.0'); | ||||
|  | ||||
|             configLoadExpect($oOption, OP_BACKUP, ERROR_OPTION_INVALID_VALUE, '0.0', OPTION_THREAD_MAX); | ||||
|             configLoadExpect($oOption, CMD_BACKUP, ERROR_OPTION_INVALID_VALUE, '0.0', OPTION_THREAD_MAX); | ||||
|         } | ||||
|  | ||||
|         if (BackRestTestCommon_Run(++$iRun, 'valid ' . OPTION_THREAD_MAX)) | ||||
| @@ -406,7 +406,7 @@ sub BackRestTestConfig_Test | ||||
|             optionSetTest($oOption, OPTION_DB_PATH, '/db'); | ||||
|             optionSetTest($oOption, OPTION_THREAD_MAX, '2'); | ||||
|  | ||||
|             configLoadExpect($oOption, OP_BACKUP); | ||||
|             configLoadExpect($oOption, CMD_BACKUP); | ||||
|         } | ||||
|  | ||||
|         if (BackRestTestCommon_Run(++$iRun, 'valid float ' . OPTION_TEST_DELAY)) | ||||
| @@ -416,7 +416,7 @@ sub BackRestTestConfig_Test | ||||
|             optionSetBoolTest($oOption, OPTION_TEST); | ||||
|             optionSetTest($oOption, OPTION_TEST_DELAY, '0.25'); | ||||
|  | ||||
|             configLoadExpect($oOption, OP_BACKUP); | ||||
|             configLoadExpect($oOption, CMD_BACKUP); | ||||
|         } | ||||
|  | ||||
|         if (BackRestTestCommon_Run(++$iRun, 'valid int ' . OPTION_TEST_DELAY)) | ||||
| @@ -426,7 +426,7 @@ sub BackRestTestConfig_Test | ||||
|             optionSetBoolTest($oOption, OPTION_TEST); | ||||
|             optionSetTest($oOption, OPTION_TEST_DELAY, 3); | ||||
|  | ||||
|             configLoadExpect($oOption, OP_BACKUP); | ||||
|             configLoadExpect($oOption, CMD_BACKUP); | ||||
|         } | ||||
|  | ||||
|         if (BackRestTestCommon_Run(++$iRun, 'restore valid ' . OPTION_TARGET_TIMELINE)) | ||||
| @@ -434,7 +434,7 @@ sub BackRestTestConfig_Test | ||||
|             optionSetTest($oOption, OPTION_STANZA, $strStanza); | ||||
|             optionSetTest($oOption, OPTION_TARGET_TIMELINE, 2); | ||||
|  | ||||
|             configLoadExpect($oOption, OP_RESTORE); | ||||
|             configLoadExpect($oOption, CMD_RESTORE); | ||||
|         } | ||||
|  | ||||
|         if (BackRestTestCommon_Run(++$iRun, 'invalid ' . OPTION_BUFFER_SIZE)) | ||||
| @@ -442,85 +442,85 @@ sub BackRestTestConfig_Test | ||||
|             optionSetTest($oOption, OPTION_STANZA, $strStanza); | ||||
|             optionSetTest($oOption, OPTION_BUFFER_SIZE, '512'); | ||||
|  | ||||
|             configLoadExpect($oOption, OP_RESTORE, ERROR_OPTION_INVALID_RANGE, '512', OPTION_BUFFER_SIZE); | ||||
|             configLoadExpect($oOption, CMD_RESTORE, ERROR_OPTION_INVALID_RANGE, '512', OPTION_BUFFER_SIZE); | ||||
|         } | ||||
|  | ||||
|         if (BackRestTestCommon_Run(++$iRun, OP_BACKUP . ' invalid option ' . OPTION_RETENTION_ARCHIVE_TYPE)) | ||||
|         if (BackRestTestCommon_Run(++$iRun, CMD_BACKUP . ' invalid option ' . OPTION_RETENTION_ARCHIVE_TYPE)) | ||||
|         { | ||||
|             optionSetTest($oOption, OPTION_STANZA, $strStanza); | ||||
|             optionSetTest($oOption, OPTION_DB_PATH, '/db'); | ||||
|             optionSetTest($oOption, OPTION_RETENTION_ARCHIVE_TYPE, BOGUS); | ||||
|  | ||||
|             configLoadExpect($oOption, OP_BACKUP, ERROR_OPTION_INVALID, OPTION_RETENTION_ARCHIVE_TYPE, OPTION_RETENTION_ARCHIVE); | ||||
|             configLoadExpect($oOption, CMD_BACKUP, ERROR_OPTION_INVALID, OPTION_RETENTION_ARCHIVE_TYPE, OPTION_RETENTION_ARCHIVE); | ||||
|         } | ||||
|  | ||||
|         if (BackRestTestCommon_Run(++$iRun, OP_BACKUP . ' invalid value ' . OPTION_RETENTION_ARCHIVE_TYPE)) | ||||
|         if (BackRestTestCommon_Run(++$iRun, CMD_BACKUP . ' invalid value ' . OPTION_RETENTION_ARCHIVE_TYPE)) | ||||
|         { | ||||
|             optionSetTest($oOption, OPTION_STANZA, $strStanza); | ||||
|             optionSetTest($oOption, OPTION_DB_PATH, '/db'); | ||||
|             optionSetTest($oOption, OPTION_RETENTION_ARCHIVE, 3); | ||||
|             optionSetTest($oOption, OPTION_RETENTION_ARCHIVE_TYPE, BOGUS); | ||||
|  | ||||
|             configLoadExpect($oOption, OP_BACKUP, ERROR_OPTION_INVALID_VALUE, BOGUS, OPTION_RETENTION_ARCHIVE_TYPE); | ||||
|             configLoadExpect($oOption, CMD_BACKUP, ERROR_OPTION_INVALID_VALUE, BOGUS, OPTION_RETENTION_ARCHIVE_TYPE); | ||||
|         } | ||||
|  | ||||
|         if (BackRestTestCommon_Run(++$iRun, OP_BACKUP . ' valid value ' . OPTION_RETENTION_ARCHIVE_TYPE)) | ||||
|         if (BackRestTestCommon_Run(++$iRun, CMD_BACKUP . ' valid value ' . OPTION_RETENTION_ARCHIVE_TYPE)) | ||||
|         { | ||||
|             optionSetTest($oOption, OPTION_STANZA, $strStanza); | ||||
|             optionSetTest($oOption, OPTION_DB_PATH, '/db'); | ||||
|             optionSetTest($oOption, OPTION_RETENTION_ARCHIVE, 1); | ||||
|             optionSetTest($oOption, OPTION_RETENTION_ARCHIVE_TYPE, BACKUP_TYPE_FULL); | ||||
|  | ||||
|             configLoadExpect($oOption, OP_BACKUP); | ||||
|             configLoadExpect($oOption, CMD_BACKUP); | ||||
|             optionTestExpect(OPTION_RETENTION_ARCHIVE, 1); | ||||
|             optionTestExpect(OPTION_RETENTION_ARCHIVE_TYPE, BACKUP_TYPE_FULL); | ||||
|         } | ||||
|  | ||||
|         if (BackRestTestCommon_Run(++$iRun, OP_RESTORE . ' invalid value ' . OPTION_RESTORE_RECOVERY_SETTING)) | ||||
|         if (BackRestTestCommon_Run(++$iRun, CMD_RESTORE . ' invalid value ' . OPTION_RESTORE_RECOVERY_SETTING)) | ||||
|         { | ||||
|             optionSetTest($oOption, OPTION_STANZA, $strStanza); | ||||
|             optionSetTest($oOption, OPTION_RESTORE_RECOVERY_SETTING, '='); | ||||
|  | ||||
|             configLoadExpect($oOption, OP_RESTORE, ERROR_OPTION_INVALID_PAIR, '=', OPTION_RESTORE_RECOVERY_SETTING); | ||||
|             configLoadExpect($oOption, CMD_RESTORE, ERROR_OPTION_INVALID_PAIR, '=', OPTION_RESTORE_RECOVERY_SETTING); | ||||
|         } | ||||
|  | ||||
|         if (BackRestTestCommon_Run(++$iRun, OP_RESTORE . ' invalid value ' . OPTION_RESTORE_RECOVERY_SETTING)) | ||||
|         if (BackRestTestCommon_Run(++$iRun, CMD_RESTORE . ' invalid value ' . OPTION_RESTORE_RECOVERY_SETTING)) | ||||
|         { | ||||
|             optionSetTest($oOption, OPTION_STANZA, $strStanza); | ||||
|             optionSetTest($oOption, OPTION_RESTORE_RECOVERY_SETTING, '=' . BOGUS); | ||||
|  | ||||
|             configLoadExpect($oOption, OP_RESTORE, ERROR_OPTION_INVALID_PAIR, '=' . BOGUS, OPTION_RESTORE_RECOVERY_SETTING); | ||||
|             configLoadExpect($oOption, CMD_RESTORE, ERROR_OPTION_INVALID_PAIR, '=' . BOGUS, OPTION_RESTORE_RECOVERY_SETTING); | ||||
|         } | ||||
|  | ||||
|         if (BackRestTestCommon_Run(++$iRun, OP_RESTORE . ' invalid value ' . OPTION_RESTORE_RECOVERY_SETTING)) | ||||
|         if (BackRestTestCommon_Run(++$iRun, CMD_RESTORE . ' invalid value ' . OPTION_RESTORE_RECOVERY_SETTING)) | ||||
|         { | ||||
|             optionSetTest($oOption, OPTION_STANZA, $strStanza); | ||||
|             optionSetTest($oOption, OPTION_RESTORE_RECOVERY_SETTING, BOGUS . '='); | ||||
|  | ||||
|             configLoadExpect($oOption, OP_RESTORE, ERROR_OPTION_INVALID_PAIR, BOGUS . '=', OPTION_RESTORE_RECOVERY_SETTING); | ||||
|             configLoadExpect($oOption, CMD_RESTORE, ERROR_OPTION_INVALID_PAIR, BOGUS . '=', OPTION_RESTORE_RECOVERY_SETTING); | ||||
|         } | ||||
|  | ||||
|         if (BackRestTestCommon_Run(++$iRun, OP_RESTORE . ' valid value ' . OPTION_RESTORE_RECOVERY_SETTING)) | ||||
|         if (BackRestTestCommon_Run(++$iRun, CMD_RESTORE . ' valid value ' . OPTION_RESTORE_RECOVERY_SETTING)) | ||||
|         { | ||||
|             optionSetTest($oOption, OPTION_STANZA, $strStanza); | ||||
|             optionSetTest($oOption, OPTION_RESTORE_RECOVERY_SETTING, 'primary-conn-info=db.domain.net'); | ||||
|  | ||||
|             configLoadExpect($oOption, OP_RESTORE); | ||||
|             configLoadExpect($oOption, CMD_RESTORE); | ||||
|             optionTestExpect(OPTION_RESTORE_RECOVERY_SETTING, 'db.domain.net', 'primary-conn-info'); | ||||
|         } | ||||
|  | ||||
|         if (BackRestTestCommon_Run(++$iRun, OP_RESTORE . ' values passed to ' . OP_ARCHIVE_GET)) | ||||
|         if (BackRestTestCommon_Run(++$iRun, CMD_RESTORE . ' values passed to ' . CMD_ARCHIVE_GET)) | ||||
|         { | ||||
|             optionSetTest($oOption, OPTION_STANZA, $strStanza); | ||||
|             optionSetTest($oOption, OPTION_DB_PATH, '/db path/main'); | ||||
|             optionSetTest($oOption, OPTION_REPO_PATH, '/repo'); | ||||
|             optionSetTest($oOption, OPTION_BACKUP_HOST, 'db.mydomain.com'); | ||||
|  | ||||
|             configLoadExpect($oOption, OP_RESTORE); | ||||
|             configLoadExpect($oOption, CMD_RESTORE); | ||||
|  | ||||
|             my $strCommand = operationWrite(OP_ARCHIVE_GET); | ||||
|             my $strCommand = commandWrite(CMD_ARCHIVE_GET); | ||||
|             my $strExpectedCommand = abs_path($0) . " --backup-host=db.mydomain.com \"--db-path=/db path/main\"" . | ||||
|                                      " --repo-path=/repo --repo-remote-path=/repo --stanza=main " . OP_ARCHIVE_GET; | ||||
|                                      " --repo-path=/repo --repo-remote-path=/repo --stanza=main " . CMD_ARCHIVE_GET; | ||||
|  | ||||
|             if ($strCommand ne $strExpectedCommand) | ||||
|             { | ||||
| @@ -528,33 +528,33 @@ sub BackRestTestConfig_Test | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         if (BackRestTestCommon_Run(++$iRun, OP_BACKUP . ' valid value ' . OPTION_COMMAND_PSQL)) | ||||
|         if (BackRestTestCommon_Run(++$iRun, CMD_BACKUP . ' valid value ' . OPTION_COMMAND_PSQL)) | ||||
|         { | ||||
|             optionSetTest($oOption, OPTION_STANZA, $strStanza); | ||||
|             optionSetTest($oOption, OPTION_DB_PATH, '/db'); | ||||
|             optionSetTest($oOption, OPTION_COMMAND_PSQL, '/psql -X %option%'); | ||||
|             optionSetTest($oOption, OPTION_COMMAND_PSQL_OPTION, '--port 5432'); | ||||
|  | ||||
|             configLoadExpect($oOption, OP_BACKUP); | ||||
|             configLoadExpect($oOption, CMD_BACKUP); | ||||
|             optionTestExpect(OPTION_COMMAND_PSQL, '/psql -X --port 5432'); | ||||
|         } | ||||
|  | ||||
|         if (BackRestTestCommon_Run(++$iRun, OP_BACKUP . ' default value ' . OPTION_COMMAND_REMOTE)) | ||||
|         if (BackRestTestCommon_Run(++$iRun, CMD_BACKUP . ' default value ' . OPTION_COMMAND_REMOTE)) | ||||
|         { | ||||
|             optionSetTest($oOption, OPTION_STANZA, $strStanza); | ||||
|             optionSetTest($oOption, OPTION_DB_PATH, '/db'); | ||||
|             optionSetTest($oOption, OPTION_COMMAND_PSQL, '/psql -X %option%'); | ||||
|             optionSetTest($oOption, OPTION_COMMAND_PSQL_OPTION, '--port 5432'); | ||||
|  | ||||
|             configLoadExpect($oOption, OP_BACKUP); | ||||
|             configLoadExpect($oOption, CMD_BACKUP); | ||||
|             optionTestExpect(OPTION_COMMAND_REMOTE, abs_path($0)); | ||||
|         } | ||||
|  | ||||
|         if (BackRestTestCommon_Run(++$iRun, OP_BACKUP . ' missing option ' . OPTION_DB_PATH)) | ||||
|         if (BackRestTestCommon_Run(++$iRun, CMD_BACKUP . ' missing option ' . OPTION_DB_PATH)) | ||||
|         { | ||||
|             optionSetTest($oOption, OPTION_STANZA, $strStanza); | ||||
|  | ||||
|             configLoadExpect($oOption, OP_BACKUP, ERROR_OPTION_REQUIRED, OPTION_DB_PATH, 'Does this stanza exist?'); | ||||
|             configLoadExpect($oOption, CMD_BACKUP, ERROR_OPTION_REQUIRED, OPTION_DB_PATH, 'Does this stanza exist?'); | ||||
|         } | ||||
|     } | ||||
|  | ||||
| @@ -575,7 +575,7 @@ sub BackRestTestConfig_Test | ||||
|             optionSetTest($oOption, OPTION_CONFIG, '/dude/dude.conf'); | ||||
|             optionSetBoolTest($oOption, OPTION_CONFIG, false); | ||||
|  | ||||
|             configLoadExpect($oOption, OP_BACKUP, ERROR_OPTION_NEGATE, OPTION_CONFIG); | ||||
|             configLoadExpect($oOption, CMD_BACKUP, ERROR_OPTION_NEGATE, OPTION_CONFIG); | ||||
|         } | ||||
|  | ||||
|         if (BackRestTestCommon_Run(++$iRun, 'option ' . OPTION_CONFIG)) | ||||
| @@ -584,7 +584,7 @@ sub BackRestTestConfig_Test | ||||
|             optionSetTest($oOption, OPTION_DB_PATH, '/db'); | ||||
|             optionSetBoolTest($oOption, OPTION_CONFIG, false); | ||||
|  | ||||
|             configLoadExpect($oOption, OP_BACKUP); | ||||
|             configLoadExpect($oOption, CMD_BACKUP); | ||||
|             optionTestExpect(OPTION_CONFIG); | ||||
|         } | ||||
|  | ||||
| @@ -593,7 +593,7 @@ sub BackRestTestConfig_Test | ||||
|             optionSetTest($oOption, OPTION_STANZA, $strStanza); | ||||
|             optionSetTest($oOption, OPTION_DB_PATH, '/db'); | ||||
|  | ||||
|             configLoadExpect($oOption, OP_BACKUP); | ||||
|             configLoadExpect($oOption, CMD_BACKUP); | ||||
|             optionTestExpect(OPTION_CONFIG, OPTION_DEFAULT_CONFIG); | ||||
|         } | ||||
|  | ||||
| @@ -603,20 +603,20 @@ sub BackRestTestConfig_Test | ||||
|             optionSetTest($oOption, OPTION_DB_PATH, '/db'); | ||||
|             optionSetTest($oOption, OPTION_CONFIG, BackRestTestCommon_TestPathGet()); | ||||
|  | ||||
|             configLoadExpect($oOption, OP_BACKUP, ERROR_FILE_INVALID, BackRestTestCommon_TestPathGet()); | ||||
|             configLoadExpect($oOption, CMD_BACKUP, ERROR_FILE_INVALID, BackRestTestCommon_TestPathGet()); | ||||
|         } | ||||
|  | ||||
|         if (BackRestTestCommon_Run(++$iRun, 'load from config stanza section - option ' . OPTION_THREAD_MAX)) | ||||
|         { | ||||
|             $oConfig = {}; | ||||
|             $$oConfig{"${strStanza}:" . &OP_BACKUP}{&OPTION_THREAD_MAX} = 2; | ||||
|             $$oConfig{"${strStanza}:" . &CMD_BACKUP}{&OPTION_THREAD_MAX} = 2; | ||||
|             iniSave($strConfigFile, $oConfig, true); | ||||
|  | ||||
|             optionSetTest($oOption, OPTION_STANZA, $strStanza); | ||||
|             optionSetTest($oOption, OPTION_DB_PATH, '/db'); | ||||
|             optionSetTest($oOption, OPTION_CONFIG, $strConfigFile); | ||||
|  | ||||
|             configLoadExpect($oOption, OP_BACKUP); | ||||
|             configLoadExpect($oOption, CMD_BACKUP); | ||||
|             optionTestExpect(OPTION_THREAD_MAX, 2); | ||||
|         } | ||||
|  | ||||
| @@ -630,7 +630,7 @@ sub BackRestTestConfig_Test | ||||
|             optionSetTest($oOption, OPTION_DB_PATH, '/db'); | ||||
|             optionSetTest($oOption, OPTION_CONFIG, $strConfigFile); | ||||
|  | ||||
|             configLoadExpect($oOption, OP_BACKUP); | ||||
|             configLoadExpect($oOption, CMD_BACKUP); | ||||
|             optionTestExpect(OPTION_THREAD_MAX, 3); | ||||
|         } | ||||
|  | ||||
| @@ -638,14 +638,14 @@ sub BackRestTestConfig_Test | ||||
|         if (BackRestTestCommon_Run(++$iRun, 'load from config global section - option ' . OPTION_THREAD_MAX)) | ||||
|         { | ||||
|             $oConfig = {}; | ||||
|             $$oConfig{&CONFIG_GLOBAL . ':' . &OP_BACKUP}{&OPTION_THREAD_MAX} = 2; | ||||
|             $$oConfig{&CONFIG_GLOBAL . ':' . &CMD_BACKUP}{&OPTION_THREAD_MAX} = 2; | ||||
|             iniSave($strConfigFile, $oConfig, true); | ||||
|  | ||||
|             optionSetTest($oOption, OPTION_STANZA, $strStanza); | ||||
|             optionSetTest($oOption, OPTION_DB_PATH, '/db'); | ||||
|             optionSetTest($oOption, OPTION_CONFIG, $strConfigFile); | ||||
|  | ||||
|             configLoadExpect($oOption, OP_BACKUP); | ||||
|             configLoadExpect($oOption, CMD_BACKUP); | ||||
|             optionTestExpect(OPTION_THREAD_MAX, 2); | ||||
|         } | ||||
|  | ||||
| @@ -659,7 +659,7 @@ sub BackRestTestConfig_Test | ||||
|             optionSetTest($oOption, OPTION_DB_PATH, '/db'); | ||||
|             optionSetTest($oOption, OPTION_CONFIG, $strConfigFile); | ||||
|  | ||||
|             configLoadExpect($oOption, OP_BACKUP); | ||||
|             configLoadExpect($oOption, CMD_BACKUP); | ||||
|             optionTestExpect(OPTION_THREAD_MAX, 5); | ||||
|         } | ||||
|  | ||||
| @@ -672,7 +672,7 @@ sub BackRestTestConfig_Test | ||||
|             optionSetTest($oOption, OPTION_DB_PATH, '/db'); | ||||
|             optionSetTest($oOption, OPTION_CONFIG, $strConfigFile); | ||||
|  | ||||
|             configLoadExpect($oOption, OP_BACKUP); | ||||
|             configLoadExpect($oOption, CMD_BACKUP); | ||||
|             optionTestExpect(OPTION_THREAD_MAX, 1); | ||||
|         } | ||||
|  | ||||
| @@ -687,21 +687,21 @@ sub BackRestTestConfig_Test | ||||
|             optionSetTest($oOption, OPTION_THREAD_MAX, 7); | ||||
|             optionSetTest($oOption, OPTION_CONFIG, $strConfigFile); | ||||
|  | ||||
|             configLoadExpect($oOption, OP_BACKUP); | ||||
|             configLoadExpect($oOption, CMD_BACKUP); | ||||
|             optionTestExpect(OPTION_THREAD_MAX, 7); | ||||
|         } | ||||
|  | ||||
|         if (BackRestTestCommon_Run(++$iRun, 'invalid boolean - option ' . OPTION_HARDLINK)) | ||||
|         { | ||||
|             $oConfig = {}; | ||||
|             $$oConfig{&CONFIG_GLOBAL . ':' . &OP_BACKUP}{&OPTION_HARDLINK} = 'Y'; | ||||
|             $$oConfig{&CONFIG_GLOBAL . ':' . &CMD_BACKUP}{&OPTION_HARDLINK} = 'Y'; | ||||
|             iniSave($strConfigFile, $oConfig, true); | ||||
|  | ||||
|             optionSetTest($oOption, OPTION_STANZA, $strStanza); | ||||
|             optionSetTest($oOption, OPTION_DB_PATH, '/db'); | ||||
|             optionSetTest($oOption, OPTION_CONFIG, $strConfigFile); | ||||
|  | ||||
|             configLoadExpect($oOption, OP_BACKUP, ERROR_OPTION_INVALID_VALUE, 'Y', OPTION_HARDLINK); | ||||
|             configLoadExpect($oOption, CMD_BACKUP, ERROR_OPTION_INVALID_VALUE, 'Y', OPTION_HARDLINK); | ||||
|         } | ||||
|  | ||||
|         if (BackRestTestCommon_Run(++$iRun, 'invalid value - option ' . OPTION_LOG_LEVEL_CONSOLE)) | ||||
| @@ -714,7 +714,7 @@ sub BackRestTestConfig_Test | ||||
|             optionSetTest($oOption, OPTION_DB_PATH, '/db'); | ||||
|             optionSetTest($oOption, OPTION_CONFIG, $strConfigFile); | ||||
|  | ||||
|             configLoadExpect($oOption, OP_BACKUP, ERROR_OPTION_INVALID_VALUE, BOGUS, OPTION_LOG_LEVEL_CONSOLE); | ||||
|             configLoadExpect($oOption, CMD_BACKUP, ERROR_OPTION_INVALID_VALUE, BOGUS, OPTION_LOG_LEVEL_CONSOLE); | ||||
|         } | ||||
|  | ||||
|         if (BackRestTestCommon_Run(++$iRun, 'valid value - option ' . OPTION_LOG_LEVEL_CONSOLE)) | ||||
| @@ -726,7 +726,7 @@ sub BackRestTestConfig_Test | ||||
|             optionSetTest($oOption, OPTION_STANZA, $strStanza); | ||||
|             optionSetTest($oOption, OPTION_CONFIG, $strConfigFile); | ||||
|  | ||||
|             configLoadExpect($oOption, OP_RESTORE); | ||||
|             configLoadExpect($oOption, CMD_RESTORE); | ||||
|         } | ||||
|  | ||||
|         if (BackRestTestCommon_Run(++$iRun, 'archive-push - option ' . OPTION_LOG_LEVEL_CONSOLE)) | ||||
| @@ -734,10 +734,10 @@ sub BackRestTestConfig_Test | ||||
|             optionSetTest($oOption, OPTION_STANZA, $strStanza); | ||||
|             optionSetTest($oOption, OPTION_CONFIG, $strConfigFile); | ||||
|  | ||||
|             configLoadExpect($oOption, OP_ARCHIVE_PUSH); | ||||
|             configLoadExpect($oOption, CMD_ARCHIVE_PUSH); | ||||
|         } | ||||
|  | ||||
|         if (BackRestTestCommon_Run(++$iRun, OP_EXPIRE . ' ' . OPTION_RETENTION_FULL)) | ||||
|         if (BackRestTestCommon_Run(++$iRun, CMD_EXPIRE . ' ' . OPTION_RETENTION_FULL)) | ||||
|         { | ||||
|             $oConfig = {}; | ||||
|             $$oConfig{&CONFIG_GLOBAL . ':' . &CONFIG_SECTION_EXPIRE}{&OPTION_RETENTION_FULL} = 2; | ||||
| @@ -746,11 +746,11 @@ sub BackRestTestConfig_Test | ||||
|             optionSetTest($oOption, OPTION_STANZA, $strStanza); | ||||
|             optionSetTest($oOption, OPTION_CONFIG, $strConfigFile); | ||||
|  | ||||
|             configLoadExpect($oOption, OP_EXPIRE); | ||||
|             configLoadExpect($oOption, CMD_EXPIRE); | ||||
|             optionTestExpect(OPTION_RETENTION_FULL, 2); | ||||
|         } | ||||
|  | ||||
|         if (BackRestTestCommon_Run(++$iRun, OP_BACKUP . ' option ' . OPTION_COMPRESS)) | ||||
|         if (BackRestTestCommon_Run(++$iRun, CMD_BACKUP . ' option ' . OPTION_COMPRESS)) | ||||
|         { | ||||
|             $oConfig = {}; | ||||
|             $$oConfig{&CONFIG_GLOBAL . ':' . &CONFIG_SECTION_BACKUP}{&OPTION_COMPRESS} = 'n'; | ||||
| @@ -760,11 +760,11 @@ sub BackRestTestConfig_Test | ||||
|             optionSetTest($oOption, OPTION_DB_PATH, '/db'); | ||||
|             optionSetTest($oOption, OPTION_CONFIG, $strConfigFile); | ||||
|  | ||||
|             configLoadExpect($oOption, OP_BACKUP); | ||||
|             configLoadExpect($oOption, CMD_BACKUP); | ||||
|             optionTestExpect(OPTION_COMPRESS, false); | ||||
|         } | ||||
|  | ||||
|         if (BackRestTestCommon_Run(++$iRun, OP_RESTORE . ' option ' . OPTION_RESTORE_RECOVERY_SETTING)) | ||||
|         if (BackRestTestCommon_Run(++$iRun, CMD_RESTORE . ' option ' . OPTION_RESTORE_RECOVERY_SETTING)) | ||||
|         { | ||||
|             $oConfig = {}; | ||||
|             $$oConfig{&CONFIG_GLOBAL . ':' . &CONFIG_SECTION_RESTORE_RECOVERY_SETTING}{'archive-command'} = '/path/to/pg_backrest'; | ||||
| @@ -773,11 +773,11 @@ sub BackRestTestConfig_Test | ||||
|             optionSetTest($oOption, OPTION_STANZA, $strStanza); | ||||
|             optionSetTest($oOption, OPTION_CONFIG, $strConfigFile); | ||||
|  | ||||
|             configLoadExpect($oOption, OP_RESTORE); | ||||
|             configLoadExpect($oOption, CMD_RESTORE); | ||||
|             optionTestExpect(OPTION_RESTORE_RECOVERY_SETTING, '/path/to/pg_backrest', 'archive-command'); | ||||
|         } | ||||
|  | ||||
|         if (BackRestTestCommon_Run(++$iRun, OP_RESTORE . ' option ' . OPTION_RESTORE_RECOVERY_SETTING)) | ||||
|         if (BackRestTestCommon_Run(++$iRun, CMD_RESTORE . ' option ' . OPTION_RESTORE_RECOVERY_SETTING)) | ||||
|         { | ||||
|             $oConfig = {}; | ||||
|             $$oConfig{$strStanza . ':' . &CONFIG_SECTION_RESTORE_RECOVERY_SETTING}{'standby-mode'} = 'on'; | ||||
| @@ -786,10 +786,10 @@ sub BackRestTestConfig_Test | ||||
|             optionSetTest($oOption, OPTION_STANZA, $strStanza); | ||||
|             optionSetTest($oOption, OPTION_CONFIG, $strConfigFile); | ||||
|  | ||||
|             configLoadExpect($oOption, OP_ARCHIVE_GET); | ||||
|             configLoadExpect($oOption, CMD_ARCHIVE_GET); | ||||
|         } | ||||
|  | ||||
|         if (BackRestTestCommon_Run(++$iRun, OP_BACKUP . ' option ' . OPTION_DB_PATH)) | ||||
|         if (BackRestTestCommon_Run(++$iRun, CMD_BACKUP . ' option ' . OPTION_DB_PATH)) | ||||
|         { | ||||
|             $oConfig = {}; | ||||
|             $$oConfig{$strStanza}{&OPTION_DB_PATH} = '/path/to/db'; | ||||
| @@ -798,11 +798,11 @@ sub BackRestTestConfig_Test | ||||
|             optionSetTest($oOption, OPTION_STANZA, $strStanza); | ||||
|             optionSetTest($oOption, OPTION_CONFIG, $strConfigFile); | ||||
|  | ||||
|             configLoadExpect($oOption, OP_BACKUP); | ||||
|             configLoadExpect($oOption, CMD_BACKUP); | ||||
|             optionTestExpect(OPTION_DB_PATH, '/path/to/db'); | ||||
|         } | ||||
|  | ||||
|         if (BackRestTestCommon_Run(++$iRun, OP_ARCHIVE_PUSH . ' option ' . OPTION_DB_PATH)) | ||||
|         if (BackRestTestCommon_Run(++$iRun, CMD_ARCHIVE_PUSH . ' option ' . OPTION_DB_PATH)) | ||||
|         { | ||||
|             $oConfig = {}; | ||||
|             $$oConfig{$strStanza}{&OPTION_DB_PATH} = '/path/to/db'; | ||||
| @@ -811,11 +811,11 @@ sub BackRestTestConfig_Test | ||||
|             optionSetTest($oOption, OPTION_STANZA, $strStanza); | ||||
|             optionSetTest($oOption, OPTION_CONFIG, $strConfigFile); | ||||
|  | ||||
|             configLoadExpect($oOption, OP_ARCHIVE_PUSH); | ||||
|             configLoadExpect($oOption, CMD_ARCHIVE_PUSH); | ||||
|             optionTestExpect(OPTION_DB_PATH, '/path/to/db'); | ||||
|         } | ||||
|  | ||||
|         if (BackRestTestCommon_Run(++$iRun, OP_BACKUP . ' option ' . OPTION_REPO_PATH)) | ||||
|         if (BackRestTestCommon_Run(++$iRun, CMD_BACKUP . ' option ' . OPTION_REPO_PATH)) | ||||
|         { | ||||
|             $oConfig = {}; | ||||
|             $$oConfig{&CONFIG_GLOBAL . ':' . &CONFIG_SECTION_GENERAL}{&OPTION_REPO_PATH} = '/repo'; | ||||
| @@ -825,11 +825,11 @@ sub BackRestTestConfig_Test | ||||
|             optionSetTest($oOption, OPTION_DB_PATH, '/db'); | ||||
|             optionSetTest($oOption, OPTION_CONFIG, $strConfigFile); | ||||
|  | ||||
|             configLoadExpect($oOption, OP_BACKUP); | ||||
|             configLoadExpect($oOption, CMD_BACKUP); | ||||
|             optionTestExpect(OPTION_REPO_PATH, '/repo'); | ||||
|         } | ||||
|  | ||||
|         if (BackRestTestCommon_Run(++$iRun, OP_BACKUP . ' valid value ' . OPTION_COMMAND_PSQL)) | ||||
|         if (BackRestTestCommon_Run(++$iRun, CMD_BACKUP . ' valid value ' . OPTION_COMMAND_PSQL)) | ||||
|         { | ||||
|             $oConfig = {}; | ||||
|             $$oConfig{&CONFIG_GLOBAL . ':' . &CONFIG_SECTION_COMMAND}{&OPTION_COMMAND_PSQL} = '/psql -X %option%'; | ||||
| @@ -840,7 +840,7 @@ sub BackRestTestConfig_Test | ||||
|             optionSetTest($oOption, OPTION_DB_PATH, '/db'); | ||||
|             optionSetTest($oOption, OPTION_CONFIG, $strConfigFile); | ||||
|  | ||||
|             configLoadExpect($oOption, OP_BACKUP); | ||||
|             configLoadExpect($oOption, CMD_BACKUP); | ||||
|             optionTestExpect(OPTION_COMMAND_PSQL, '/psql -X --port=5432'); | ||||
|         } | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user