mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2024-12-12 10:04:14 +02:00
Designate a single distro (Ubuntu 16.04) for Perl coverage testing.
Running coverage testing on multiple distros takes time but doesn't add significant value. Also ensure that the distro designated to run coverage tests is one of the default test distros.
This commit is contained in:
parent
6ef2167e97
commit
b701cd5a5f
@ -121,6 +121,10 @@
|
||||
<release-item>
|
||||
<p>Fix flapping protocol timeout test. It only matters that the correct error code is returned, so disable logging to prevent message ordering from failing the expect test.</p>
|
||||
</release-item>
|
||||
|
||||
<release-item>
|
||||
<p>Designate a single distro (Ubuntu 16.04) for Perl coverage testing. Running coverage testing on multiple distros takes time but doesn't add significant value. Also ensure that the distro designated to run coverage tests is one of the default test distros.</p>
|
||||
</release-item>
|
||||
</release-refactor-list>
|
||||
</release-test-list>
|
||||
</release>
|
||||
|
@ -424,7 +424,7 @@ sub containerBuild
|
||||
if (!$bDeprecated)
|
||||
{
|
||||
$strScript .= sectionHeader() .
|
||||
"# Create PostgreSQL user/group with a known ids for testing\n" .
|
||||
"# Create PostgreSQL user/group with known ids for testing\n" .
|
||||
' ' . groupCreate($strOS, POSTGRES_GROUP, POSTGRES_GROUP_ID) . " && \\\n" .
|
||||
' ' . userCreate($strOS, POSTGRES_USER, POSTGRES_USER_ID, POSTGRES_GROUP);
|
||||
|
||||
@ -538,6 +538,9 @@ sub containerBuild
|
||||
$strImage = "${strOS}-build";
|
||||
$strCopy = undef;
|
||||
|
||||
my $strPkgDevelCover = LIB_COVER_PACKAGE;
|
||||
my $bPkgDevelCoverBuild = vmCoverage($strOS) && !$oStorageDocker->exists("test/package/${strOS}-${strPkgDevelCover}");
|
||||
|
||||
# Install Perl packages
|
||||
if ($$oVm{$strOS}{&VM_OS_BASE} eq VM_OS_BASE_DEBIAN)
|
||||
{
|
||||
@ -551,7 +554,7 @@ sub containerBuild
|
||||
" git clone https://anonscm.debian.org/git/pkg-postgresql/pgbackrest.git /root/package-src";
|
||||
|
||||
# Build only when a new version has been specified
|
||||
if (!$bDeprecated && !$oStorageDocker->exists("test/package/${strOS}-" . LIB_COVER_PACKAGE))
|
||||
if ($bPkgDevelCoverBuild)
|
||||
{
|
||||
$strScript .= sectionHeader() .
|
||||
"# Install Devel::Cover package source & build\n" .
|
||||
@ -570,8 +573,7 @@ sub containerBuild
|
||||
containerWrite($oStorageDocker, $strTempPath, $strOS, 'Build', $strImageParent, $strImage, $strCopy,$strScript, $bVmForce);
|
||||
|
||||
# Copy Devel::Cover to host so it can be installed in other containers (if it doesn't already exist)
|
||||
if (!$bDeprecated && !$oStorageDocker->exists("test/package/${strOS}-" . LIB_COVER_PACKAGE) &&
|
||||
$$oVm{$strOS}{&VM_OS_BASE} eq VM_OS_BASE_DEBIAN)
|
||||
if ($bPkgDevelCoverBuild)
|
||||
{
|
||||
executeTest('docker rm -f test-build', {bSuppressError => true});
|
||||
executeTest(
|
||||
@ -580,11 +582,11 @@ sub containerBuild
|
||||
{bSuppressStdErr => true});
|
||||
executeTest(
|
||||
"docker exec -i test-build " .
|
||||
"bash -c 'cp /root/" . LIB_COVER_PACKAGE . " ${strTempPath}/${strOS}-" . LIB_COVER_PACKAGE . "'");
|
||||
"bash -c 'cp /root/${strPkgDevelCover} ${strTempPath}/${strOS}-${strPkgDevelCover}'");
|
||||
executeTest('docker rm -f test-build');
|
||||
|
||||
$oStorageDocker->move(
|
||||
"test/.vagrant/docker/${strOS}-" . LIB_COVER_PACKAGE, "test/package/${strOS}-" . LIB_COVER_PACKAGE);
|
||||
"test/.vagrant/docker/${strOS}-${strPkgDevelCover}", "test/package/${strOS}-${strPkgDevelCover}");
|
||||
}
|
||||
|
||||
# S3 image
|
||||
@ -629,18 +631,18 @@ sub containerBuild
|
||||
$strImageParent = containerRepo() . ":${strOS}-base";
|
||||
$strImage = "${strOS}-test";
|
||||
|
||||
if ($$oVm{$strOS}{&VM_OS_BASE} eq VM_OS_BASE_DEBIAN)
|
||||
if (vmCoverage($strOS))
|
||||
{
|
||||
$oStorageDocker->copy(
|
||||
"test/package/${strOS}-" . LIB_COVER_PACKAGE, "test/.vagrant/docker/${strOS}-" . LIB_COVER_PACKAGE);
|
||||
"test/package/${strOS}-${strPkgDevelCover}", "test/.vagrant/docker/${strOS}-${strPkgDevelCover}");
|
||||
|
||||
$strCopy =
|
||||
"# Copy Devel::Cover\n" .
|
||||
"COPY ${strOS}-" . LIB_COVER_PACKAGE . ' /tmp/' . LIB_COVER_PACKAGE;
|
||||
"COPY ${strOS}-${strPkgDevelCover} /tmp/${strPkgDevelCover}";
|
||||
|
||||
$strScript = sectionHeader() .
|
||||
"# Install Devel::Cover\n" .
|
||||
' dpkg -i /tmp/' . LIB_COVER_PACKAGE;
|
||||
" dpkg -i /tmp/${strPkgDevelCover}";
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -594,7 +594,7 @@ sub backrestExe {return shift->{strBackRestExe}}
|
||||
sub backrestExeOriginal {return shift->{strBackRestExeOriginal}}
|
||||
sub backrestUser {return shift->{strBackRestUser}}
|
||||
sub basePath {return shift->{strBasePath}}
|
||||
sub coverage {vmBaseTest(shift->{strVm}, VM_OS_BASE_DEBIAN)}
|
||||
sub coverage {vmCoverage(shift->{strVm})}
|
||||
sub dataPath {return shift->basePath() . '/test/data'}
|
||||
sub doCleanup {return shift->{bCleanup}}
|
||||
sub doExpect {return shift->{bExpect}}
|
||||
|
@ -87,6 +87,9 @@ use constant VM_EXPECT => VM_CO7;
|
||||
use constant VM_HOST_DEFAULT => VM_U16;
|
||||
push @EXPORT, qw(VM_HOST_DEFAULT);
|
||||
|
||||
# Defines the VM that will do coverage testing
|
||||
use constant VM_COVERAGE => VM_U16;
|
||||
|
||||
# Lists valid VMs
|
||||
use constant VM_LIST => (VM_CO6, VM_U16, VM_CO7, VM_U12);
|
||||
push @EXPORT, qw(VM_LIST);
|
||||
@ -242,9 +245,15 @@ foreach my $strVm (sort(keys(%{$oyVm})))
|
||||
foreach my $strPgVersion (versionSupport())
|
||||
{
|
||||
my $strVmPgVersionRun;
|
||||
my $strVmCoverage;
|
||||
|
||||
foreach my $strVm (VM_LIST)
|
||||
{
|
||||
if ($strVm eq VM_COVERAGE)
|
||||
{
|
||||
$strVmCoverage = $strVm;
|
||||
}
|
||||
|
||||
foreach my $strVmPgVersion (@{$oyVm->{$strVm}{&VM_DB_TEST}})
|
||||
{
|
||||
if ($strPgVersion eq $strVmPgVersion)
|
||||
@ -259,9 +268,16 @@ foreach my $strPgVersion (versionSupport())
|
||||
}
|
||||
}
|
||||
|
||||
my $strErrorSuffix = 'is not configured to run on a default vm';
|
||||
|
||||
if (!defined($strVmCoverage))
|
||||
{
|
||||
confess &log(ASSERT, 'vm designated for coverage testing (' . VM_COVERAGE . ") ${strErrorSuffix}");
|
||||
}
|
||||
|
||||
if (!defined($strVmPgVersionRun))
|
||||
{
|
||||
confess &log(ASSERT, "PostgreSQL ${strPgVersion} is not configured to run on a default vm");
|
||||
confess &log(ASSERT, "PostgreSQL ${strPgVersion} ${strErrorSuffix}");
|
||||
}
|
||||
}
|
||||
|
||||
@ -295,7 +311,7 @@ sub vmCoverage
|
||||
{
|
||||
my $strVm = shift;
|
||||
|
||||
return $strVm eq VM_ALL ? false : vmBaseTest($strVm, VM_OS_BASE_DEBIAN);
|
||||
return ($strVm eq VM_COVERAGE ? true : false)
|
||||
}
|
||||
|
||||
push @EXPORT, qw(vmCoverage);
|
||||
|
Loading…
Reference in New Issue
Block a user