1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-06-02 22:57:34 +02:00

Fix flapping test in real/all module.

The restore test function was passing strBackup to the restoreCompare function but when the restore is expected to pick a backup based on a timestamp, then strBackup may not be the one chosen.

Modified the code so that strBackupExpected is set based on the parameters passed to the function and this is then passed to restoreCompare.
This commit is contained in:
Cynthia Shang 2020-02-28 14:50:50 -05:00 committed by David Steele
parent 089049ec56
commit ceb050e950

View File

@ -1593,14 +1593,17 @@ sub restore
# Load the expected manifest if it was not defined
my $oExpectedManifest = undef;
# If an expected backup is defined, then the strBackup should be the default to allow the restore process to select the backup
# - which should be the backup passed as strBackupExpected. If it is not defined, then set it based on the strBackup passed.
if (!defined($strBackupExpected))
{
$strBackupExpected = $strBackup eq cfgDefOptionDefault(CFGCMD_RESTORE, CFGOPT_SET) ? $oHostBackup->backupLast() :
$strBackup;
}
if (!defined($rhExpectedManifest))
{
if (!defined($strBackupExpected))
{
$strBackupExpected = $strBackup eq 'latest' ? $oHostBackup->backupLast() : $strBackup;
}
# Load the manifest
# Load the manifest from the backup expected to be chosen/processed by restore
my $oExpectedManifest = new pgBackRest::Manifest(
storageRepo()->pathGet(
STORAGE_REPO_BACKUP . qw{/} . $strBackupExpected. qw{/} .
@ -1681,7 +1684,7 @@ sub restore
if (!defined($iExpectedExitStatus))
{
$self->restoreCompare($strBackup, dclone($rhExpectedManifest), $bTablespace);
$self->restoreCompare($strBackupExpected, dclone($rhExpectedManifest), $bTablespace);
if (defined($self->{oLogTest}))
{