1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-03-05 15:05:48 +02:00

Fixed --no-online tests to suppress expected errors.

This commit is contained in:
David Steele 2017-02-02 20:44:42 -05:00
parent efdf64506a
commit 1666ee177f
2 changed files with 30 additions and 22 deletions

View File

@ -318,6 +318,12 @@
</release-doc-list>
<release-test-list>
<release-bug-list>
<release-item>
<p>Fixed <br-option>--no-online</br-option> tests to suppress expected errors.</p>
</release-item>
</release-bug-list>
<release-feature-list>
<release-item>
<p>Added integration for testing coverage with <code>Devel::Cover</code>.</p>

View File

@ -823,28 +823,6 @@ sub run
$oHostDbMaster->sqlSelectOneTest('select message from test', $strTimelineMessage, {iTimeout => 120});
}
# Incr backup - make sure a --no-online backup fails
#---------------------------------------------------------------------------------------------------------------------------
if ($bTestExtra)
{
$strType = BACKUP_TYPE_INCR;
$oHostBackup->backup(
$strType, 'fail on --no-' . OPTION_ONLINE,
{iExpectedExitStatus => ERROR_POSTMASTER_RUNNING, strOptionalParam => '--no-' . OPTION_ONLINE});
}
# Incr backup - allow --no-online backup to succeed with --force
#---------------------------------------------------------------------------------------------------------------------------
if ($bTestExtra)
{
$strType = BACKUP_TYPE_INCR;
$oHostBackup->backup(
$strType, 'succeed on --no-' . OPTION_ONLINE . ' with --' . OPTION_FORCE,
{strOptionalParam => '--no-' . OPTION_ONLINE . ' --' . OPTION_FORCE});
}
# Stop clusters to catch any errors in the postgres log
#---------------------------------------------------------------------------------------------------------------------------
$oHostDbMaster->clusterStop({bImmediate => true});
@ -853,6 +831,30 @@ sub run
{
$oHostDbStandby->clusterStop({bImmediate => true});
}
# Test no-online backups
#---------------------------------------------------------------------------------------------------------------------------
if ($bTestExtra)
{
# Create a postmaster.pid file so it appears that the server is running
fileStringWrite($oHostDbMaster->dbBasePath() . '/postmaster.pid', '99999');
# Incr backup - make sure a --no-online backup fails
#-----------------------------------------------------------------------------------------------------------------------
$strType = BACKUP_TYPE_INCR;
$oHostBackup->backup(
$strType, 'fail on --no-' . OPTION_ONLINE,
{iExpectedExitStatus => ERROR_POSTMASTER_RUNNING, strOptionalParam => '--no-' . OPTION_ONLINE});
# Incr backup - allow --no-online backup to succeed with --force
#-----------------------------------------------------------------------------------------------------------------------
$strType = BACKUP_TYPE_INCR;
$oHostBackup->backup(
$strType, 'succeed on --no-' . OPTION_ONLINE . ' with --' . OPTION_FORCE,
{strOptionalParam => '--no-' . OPTION_ONLINE . ' --' . OPTION_FORCE});
}
}
}
}