1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-05-31 22:49:46 +02:00

Various option and unit test fixes.

This commit is contained in:
David Steele 2015-03-24 18:50:14 -04:00
parent a3604bc512
commit a998119cba
4 changed files with 48 additions and 35 deletions

View File

@ -121,21 +121,21 @@ use constant
OPTION_ARCHIVE_ASYNC => 'archive-async',
# BACKUP Section
OPTION_BACKUP_ARCHIVE_CHECK => 'backup-archive-check',
OPTION_BACKUP_ARCHIVE_COPY => 'backup-archive-copy',
OPTION_BACKUP_ARCHIVE_CHECK => 'archive-check',
OPTION_BACKUP_ARCHIVE_COPY => 'archive-copy',
OPTION_HARDLINK => 'hardlink',
OPTION_BACKUP_HOST => 'backup-host',
OPTION_BACKUP_USER => 'backup-user',
OPTION_START_FAST => 'start-fast',
# COMMAND Section
OPTION_COMMAND_REMOTE => 'command-remote',
OPTION_COMMAND_PSQL => 'command-psql',
OPTION_COMMAND_PSQL_OPTION => 'command-psql-option',
OPTION_COMMAND_REMOTE => 'cmd-remote',
OPTION_COMMAND_PSQL => 'cmd-psql',
OPTION_COMMAND_PSQL_OPTION => 'cmd-psql-option',
# LOG Section
OPTION_LOG_LEVEL_CONSOLE => 'log-level-console',
OPTION_LOG_LEVEL_FILE => 'log-level-file',
OPTION_LOG_LEVEL_CONSOLE => 'log-level-console',
OPTION_LOG_LEVEL_FILE => 'log-level-file',
# EXPIRE Section
OPTION_RETENTION_ARCHIVE => 'retention-archive',
@ -201,7 +201,7 @@ use constant
OPTION_DEFAULT_ARCHIVE_ASYNC => false,
OPTION_DEFAULT_COMMAND_PSQL => '/usr/bin/psql',
OPTION_DEFAULT_COMMAND_PSQL => '/usr/bin/psql -X',
OPTION_DEFAULT_COMMAND_REMOTE => dirname(abs_path($0)) . '/pg_backrest_remote.pl',
OPTION_DEFAULT_BACKUP_ARCHIVE_CHECK => true,
@ -596,7 +596,8 @@ my %oOptionRule =
&OP_ARCHIVE_GET => true,
&OP_ARCHIVE_PUSH => true,
&OP_BACKUP => true,
&OP_RESTORE => true
&OP_RESTORE => true,
&OP_EXPIRE => true
},
},
@ -1018,6 +1019,12 @@ sub configLoad
{
$oOption{&OPTION_COMMAND_PSQL} =~ s/\%option\%/$oOption{&OPTION_COMMAND_PSQL_OPTION}/g;
}
# Set repo-remote-path to repo-path if it is not set
if (optionTest(OPTION_REPO_PATH) && !optionTest(OPTION_REPO_REMOTE_PATH))
{
$oOption{&OPTION_REPO_REMOTE_PATH} = optionGet(OPTION_REPO_PATH);
}
}
####################################################################################################################################
@ -1390,10 +1397,15 @@ sub optionOperationRule
my $strOption = shift;
my $strOperation = shift;
return defined($oOptionRule{$strOption}{&OPTION_RULE_OPERATION}) &&
defined($oOptionRule{$strOption}{&OPTION_RULE_OPERATION}{$strOperation}) &&
ref($oOptionRule{$strOption}{&OPTION_RULE_OPERATION}{$strOperation}) eq 'HASH' ?
$oOptionRule{$strOption}{&OPTION_RULE_OPERATION}{$strOperation} : undef;
if (defined($strOperation))
{
return defined($oOptionRule{$strOption}{&OPTION_RULE_OPERATION}) &&
defined($oOptionRule{$strOption}{&OPTION_RULE_OPERATION}{$strOperation}) &&
ref($oOptionRule{$strOption}{&OPTION_RULE_OPERATION}{$strOperation}) eq 'HASH' ?
$oOptionRule{$strOption}{&OPTION_RULE_OPERATION}{$strOperation} : undef;
}
return undef;
}
####################################################################################################################################

View File

@ -1419,13 +1419,11 @@ sub BackRestTestBackup_Test
for (my $bCompress = false; $bCompress <= true; $bCompress++)
{
for (my $bArchiveAsync = false; $bArchiveAsync <= true; $bArchiveAsync++)
{
for (my $bCompressAsync = false; $bCompressAsync <= true; $bCompressAsync++)
{
# Increment the run, log, and decide whether this unit test should be run
if (!BackRestTestCommon_Run(++$iRun,
"rmt ${bRemote}, cmp ${bCompress}, " .
"arc_async ${bArchiveAsync}, cmp_async ${bCompressAsync}")) {next}
"arc_async ${bArchiveAsync}")) {next}
# Create the test directory
if ($bCreate)
@ -1451,7 +1449,7 @@ sub BackRestTestBackup_Test
undef, # hardlink
undef, # thread-max
$bArchiveAsync,
$bCompressAsync);
undef);
my $strCommand = BackRestTestCommon_CommandMainGet() . ' --config=' . BackRestTestCommon_DbPathGet() .
'/pg_backrest.conf --stanza=db archive-push';
@ -1512,7 +1510,6 @@ sub BackRestTestBackup_Test
}
}
}
}
$bCreate = true;
}

View File

@ -598,10 +598,10 @@ sub BackRestTestCommon_ConfigCreate
if (defined($strRemote))
{
$oParamHash{'global:command'}{'command-remote'} = $strCommonCommandRemote;
$oParamHash{'global:command'}{'cmd-remote'} = $strCommonCommandRemote;
}
$oParamHash{'global:command'}{'command-psql'} = $strCommonCommandPsql;
$oParamHash{'global:command'}{'cmd-psql'} = $strCommonCommandPsql;
if (defined($strRemote) && $strRemote eq BACKUP)
{
@ -623,19 +623,18 @@ sub BackRestTestCommon_ConfigCreate
}
elsif ($strLocal eq DB)
{
$oParamHash{'global:general'}{'repo-path'} = $strCommonLocalPath;
if (defined($strRemote))
{
$oParamHash{'global:log'}{'level-console'} = 'trace';
$oParamHash{'global:log'}{'log-level-console'} = 'trace';
if ($bArchiveAsync)
{
$oParamHash{'global:archive'}{path} = BackRestTestCommon_LocalPathGet();
}
$oParamHash{'global:restore'}{'thread-max'} = $iThreadMax;
# if ($bArchiveAsync)
# {
# $oParamHash{'global:archive'}{path} = BackRestTestCommon_LocalPathGet();
# }
$oParamHash{'global:general'}{'repo-remote-path'} = $strCommonRepoPath;
$oParamHash{'global:general'}{'repo-path'} = $strCommonLocalPath;
}
else
{
@ -645,11 +644,11 @@ sub BackRestTestCommon_ConfigCreate
if ($bArchiveAsync)
{
$oParamHash{'global:archive'}{'archive-async'} = 'y';
if (!$bCompressAsync)
{
$oParamHash{'global:archive'}{'compress_async'} = 'n';
}
#
# if (!$bCompressAsync)
# {
# $oParamHash{'global:archive'}{'compress_async'} = 'n';
# }
}
}
else
@ -657,9 +656,14 @@ sub BackRestTestCommon_ConfigCreate
confess "invalid local type ${strLocal}";
}
if (defined($iThreadMax) && $iThreadMax > 1)
{
$oParamHash{'global:general'}{'thread-max'} = $iThreadMax;
}
if (($strLocal eq BACKUP) || ($strLocal eq DB && !defined($strRemote)))
{
$oParamHash{'db:command'}{'command-psql-option'} = "--port=${iCommonDbPort}";
$oParamHash{'db:command'}{'cmd-psql-option'} = "--port=${iCommonDbPort}";
$oParamHash{'global:backup'}{'thread-max'} = $iThreadMax;
if (defined($bHardlink) && $bHardlink)

View File

@ -712,7 +712,7 @@ sub BackRestTestConfig_Test
if (BackRestTestCommon_Run(++$iRun, OP_EXPIRE . ' ' . OPTION_RETENTION_FULL))
{
$oConfig = {};
$$oConfig{&CONFIG_GLOBAL . ':' . &CONFIG_SECTION_RETENTION}{&OPTION_RETENTION_FULL} = 2;
$$oConfig{&CONFIG_GLOBAL . ':' . &CONFIG_SECTION_EXPIRE}{&OPTION_RETENTION_FULL} = 2;
ini_save($strConfigFile, $oConfig);
optionSetTest($oOption, OPTION_STANZA, $strStanza);