You've already forked pgbackrest
mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2025-06-29 00:21:56 +02:00
Create test matrix for mock/archive-stop to increase coverage and reduce tests.
The same test configurations are run on all four test VMs, which seems a real waste of resources. Vary the tests per VM to increase coverage while reducing the total number of tests. Be sure to include each major feature (remote, s3, encryption) in each VM at least once.
This commit is contained in:
@ -28,6 +28,7 @@ use pgBackRest::Storage::Helper;
|
||||
use pgBackRestTest::Env::HostEnvTest;
|
||||
use pgBackRestTest::Common::ExecuteTest;
|
||||
use pgBackRestTest::Common::RunTest;
|
||||
use pgBackRestTest::Common::VmTest;
|
||||
|
||||
####################################################################################################################################
|
||||
# run
|
||||
@ -41,24 +42,36 @@ sub run
|
||||
my $strWalHash = $self->walGenerateContentChecksum(PG_VERSION_94);
|
||||
storageTest()->put($strWalTestFile, $self->walGenerateContent(PG_VERSION_94));
|
||||
|
||||
foreach my $bS3 (false, true)
|
||||
foreach my $rhRun
|
||||
(
|
||||
{vm => VM1, remote => false, s3 => false, encrypt => false, compress => true, error => 0},
|
||||
{vm => VM1, remote => true, s3 => true, encrypt => true, compress => false, error => 1},
|
||||
{vm => VM2, remote => false, s3 => true, encrypt => false, compress => false, error => 0},
|
||||
{vm => VM2, remote => true, s3 => false, encrypt => true, compress => true, error => 0},
|
||||
{vm => VM3, remote => false, s3 => false, encrypt => true, compress => false, error => 0},
|
||||
{vm => VM3, remote => true, s3 => true, encrypt => false, compress => true, error => 1},
|
||||
{vm => VM4, remote => false, s3 => true, encrypt => true, compress => true, error => 0},
|
||||
{vm => VM4, remote => true, s3 => false, encrypt => false, compress => false, error => 0},
|
||||
)
|
||||
{
|
||||
foreach my $bRemote ($bS3 ? (true) : (false, true))
|
||||
{
|
||||
foreach my $bCompress ($bS3 ? (false) : (false, true))
|
||||
{
|
||||
foreach my $iError ($bS3 ? (1) : ($bRemote ? (0, 1) : (0)))
|
||||
{
|
||||
my $bRepoEncrypt = ($bCompress && !$bS3) ? true : false;
|
||||
# Only run tests for this vm
|
||||
next if ($rhRun->{vm} ne $self->vm());
|
||||
|
||||
# Increment the run, log, and decide whether this unit test should be run
|
||||
my $bRemote = $rhRun->{remote};
|
||||
my $bS3 = $rhRun->{s3};
|
||||
my $bEncrypt = $rhRun->{encrypt};
|
||||
my $bCompress = $rhRun->{compress};
|
||||
my $iError = $rhRun->{error};
|
||||
|
||||
# Increment the run, log, and decide whether this unit test should be run
|
||||
if (!$self->begin("rmt ${bRemote}, cmp ${bCompress}, error " . ($iError ? 'connect' : 'version') . ", s3 ${bS3}, " .
|
||||
"enc ${bRepoEncrypt}")) {next}
|
||||
"enc ${bEncrypt}")) {next}
|
||||
|
||||
# Create hosts, file object, and config
|
||||
my ($oHostDbMaster, $oHostDbStandby, $oHostBackup, $oHostS3) = $self->setup(
|
||||
true, $self->expect(), {bHostBackup => $bRemote, bCompress => $bCompress, bArchiveAsync => true, bS3 => $bS3,
|
||||
bRepoEncrypt => $bRepoEncrypt});
|
||||
bRepoEncrypt => $bEncrypt});
|
||||
|
||||
my $oStorage = storageRepo();
|
||||
|
||||
@ -120,9 +133,6 @@ sub run
|
||||
"000000010000000100000005-${strWalHash}${strCompressExt})",
|
||||
'segment 5 is pushed', {iWaitSeconds => 5});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
||||
|
Reference in New Issue
Block a user