1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2024-12-12 10:04:14 +02:00

Be smarter about which packages are loaded for testing.

Now that our tests are more diversified it makes sense to load only the packages that are needed for each test.

Move the package loads from .travis.yaml to test/travis.pl where we have more control over what is loaded.
This commit is contained in:
David Steele 2019-10-08 18:56:55 -04:00
parent a1c13a50dd
commit 61c4f64895
3 changed files with 44 additions and 45 deletions

View File

@ -23,26 +23,9 @@ matrix:
- env: PGB_CI="--vm=co7 doc"
- env: PGB_CI="--vm=co6 doc"
before_install:
- sudo apt-get -qq update || true
- sudo apt-get install libxml-checker-perl libdbd-pg-perl libyaml-libyaml-perl python-pip lcov libperl-dev
- |
# Install & Configure AWS CLI
pip install --upgrade --user awscli
aws configure set region us-east-1
aws configure set aws_access_key_id accessKey1
aws configure set aws_secret_access_key verySecretKey1
aws help --version
aws configure list
install:
- |
# User Configuration
sudo adduser --ingroup=${USER?} --uid=5001 --disabled-password --gecos "" pgbackrest
umask 0022
cd ~ && pwd && whoami && umask && groups
mv ${TRAVIS_BUILD_DIR?} pgbackrest
rm -rf ${TRAVIS_BUILD_DIR?}
- umask 0022
- cd ~ && pwd && whoami && umask && groups
script:
- pgbackrest/test/travis.pl ${PGB_CI?}
- ${TRAVIS_BUILD_DIR?}/test/travis.pl ${PGB_CI?}

View File

@ -104,30 +104,13 @@ sub process
# Configure install and script
$strConfig .=
"\n" .
"before_install:\n" .
" - sudo apt-get -qq update || true\n" .
" - sudo apt-get install libxml-checker-perl libdbd-pg-perl libyaml-libyaml-perl python-pip lcov libperl-dev\n" .
" - |\n" .
" # Install & Configure AWS CLI\n" .
" pip install --upgrade --user awscli\n" .
" aws configure set region us-east-1\n" .
" aws configure set aws_access_key_id accessKey1\n" .
" aws configure set aws_secret_access_key verySecretKey1\n" .
" aws help --version\n" .
" aws configure list\n" .
"\n" .
"install:\n" .
" - |\n" .
" # User Configuration\n" .
" sudo adduser --ingroup=\${USER?} --uid=5001 --disabled-password --gecos \"\" " . BACKREST_USER . "\n" .
" umask 0022\n" .
" cd ~ && pwd && whoami && umask && groups\n" .
" mv \${TRAVIS_BUILD_DIR?} " . PROJECT_EXE . "\n" .
" rm -rf \${TRAVIS_BUILD_DIR?}\n" .
" - umask 0022\n" .
" - cd ~ && pwd && whoami && umask && groups\n" .
"\n" .
"script:\n" .
" - " . PROJECT_EXE . "/test/travis.pl \${PGB_CI?}\n";
" - \${TRAVIS_BUILD_DIR?}/test/travis.pl \${PGB_CI?}\n";
buildPutDiffers($self->{oStorage}, '.travis.yml', $strConfig);

View File

@ -24,6 +24,7 @@ use lib dirname(dirname($0)) . '/lib';
use pgBackRest::Common::Exception;
use pgBackRest::Common::Log;
use pgBackRestTest::Common::ContainerTest;
use pgBackRestTest::Common::ExecuteTest;
use pgBackRestTest::Common::VmTest;
@ -121,6 +122,11 @@ eval
logLevelSet(INFO, INFO, OFF);
processBegin('install common packages');
processExec('sudo apt-get -qq update', {bSuppressStdErr => true, bSuppressError => true});
processExec('sudo apt-get install libxml-checker-perl libyaml-libyaml-perl', {bSuppressStdErr => true});
processEnd();
################################################################################################################################
# Build documentation
################################################################################################################################
@ -133,7 +139,6 @@ eval
'sudo apt-get install -y --no-install-recommends texlive-latex-base texlive-latex-extra texlive-fonts-recommended',
{bSuppressStdErr => true});
processExec('sudo apt-get install -y texlive-font-utils latex-xcolor', {bSuppressStdErr => true});
processEnd();
}
processBegin('release documentation');
@ -146,16 +151,33 @@ eval
################################################################################################################################
elsif ($ARGV[0] eq 'test')
{
# Run tests that can be run without a container
my $strParam = "";
my $strVmHost = VM_U14;
# Build list of packages that need to be installed
my $strPackage = "libperl-dev";
if (vmCoverageC($strVm))
{
$strPackage .= " lcov";
}
if ($strVm eq VM_NONE)
{
processBegin('debug tools install');
processExec('sudo apt-get install -y valgrind', {bSuppressStdErr => true});
processEnd();
$strPackage .= " valgrind";
}
else
{
$strPackage .= " python-pip libdbd-pg-perl";
}
processBegin('install test packages');
processExec("sudo apt-get install -y ${strPackage}", {bSuppressStdErr => true});
processEnd();
# Run tests that can be run without a container
if ($strVm eq VM_NONE)
{
processBegin('/tmp/pgbackrest owned by root so tests cannot use it');
processExec('sudo mkdir -p /tmp/pgbackrest && sudo chown root:root /tmp/pgbackrest && sudo chmod 700 /tmp/pgbackrest');
processEnd();
@ -165,6 +187,17 @@ eval
# Else run tests that require a container
else
{
processBegin("create backrest user");
processExec("sudo adduser --ingroup=\${USER?} --uid=5001 --disabled-password --gecos \"\" " . BACKREST_USER);
processEnd();
processBegin("install and configure aws cli");
processExec('pip install --upgrade --user awscli', {bSuppressStdErr => true});
processExec('aws configure set region us-east-1');
processExec('aws configure set aws_access_key_id accessKey1');
processExec('aws configure set aws_secret_access_key verySecretKey1');
processEnd();
# Build the container
processBegin("${strVm} build");
processExec("${strTestExe} --vm-build --vm=${strVm}", {bShowOutputAsync => true, bOutLogOnError => false});