1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2026-05-22 10:15:16 +02:00

Test directories are now located on the host VM rather than in the Docker container.

This change allows for easier testing since all files are local on the host VM and can be easily accessed without using `docker exec`.  In addition, this change is required to allow multiple Docker containers per test case which is coming soon.
This commit is contained in:
David Steele
2016-05-10 18:12:37 -04:00
parent 60b901948a
commit a6a19e3735
5 changed files with 49 additions and 22 deletions
+1 -1
View File
@@ -222,7 +222,7 @@ sub logWrite
if (!-e $strTestLogPath)
{
mkdir($strTestLogPath) or
mkdir($strTestLogPath, 0750) or
confess "unable to create expect log path ${strTestLogPath}";
}
+4 -4
View File
@@ -143,8 +143,8 @@ sub BackRestTestCommon_Drop
# Remove the backrest private directory
BackRestTestCommon_DropRepo();
# Remove the test directory
BackRestTestCommon_PathRemove(BackRestTestCommon_TestPathGet());
# Remove contents of the test directory
executeTest('rm -rf ' . BackRestTestCommon_TestPathGet() . '/*');
}
####################################################################################################################################
@@ -152,8 +152,8 @@ sub BackRestTestCommon_Drop
####################################################################################################################################
sub BackRestTestCommon_Create
{
# Create the test directory
BackRestTestCommon_PathCreate(BackRestTestCommon_TestPathGet(), '0770');
# Test directory is now created in parent VM so nothing to do here. Leaving as a place holder for a while in case any other
# test init needs to be done when refactoring.
}
####################################################################################################################################
@@ -19,6 +19,7 @@ use Scalar::Util qw(blessed);
use pgBackRest::Common::Ini;
use pgBackRest::Common::Log;
use pgBackRest::Common::String;
use pgBackRest::FileCommon;
use pgBackRestTest::Common::ExecuteTest;
@@ -120,7 +121,7 @@ sub containerWrite
my $bForce = shift;
# Write the image
fileStringWrite("${strTempPath}/${strImageName}", "$strImage\n", false);
fileStringWrite("${strTempPath}/${strImageName}", trim($strImage) . "\n", false);
executeTest('docker build' . (defined($bForce) && $bForce ? ' --no-cache' : '') .
" -f ${strTempPath}/${strImageName} -t backrest/${strImageName} ${strTempPath}",
{bSuppressStdErr => true});
@@ -500,7 +501,7 @@ sub containerBuild
# Install Perl packages
$strImage .=
"\n\n" . perlInstall($strOS) . "\n";
"\n\n" . perlInstall($strOS);
# Make PostgreSQL home group readable
$strImage .=
+3 -7
View File
@@ -47,14 +47,11 @@ sub BackRestTestFile_Setup
system("ssh ${strUserBackRest}\@${strHost} 'rm -rf ${strTestPath}/private'");
}
# Remove the test directory
system("rm -rf ${strTestPath}") == 0 or die 'unable to drop test path';
# Remove contents of the test directory
system("rm -rf ${strTestPath}/*") == 0 or die 'unable to drop test path';
if (!defined($bDropOnly) || !$bDropOnly)
{
# Create the test directory
mkdir($strTestPath, oct('0770')) or confess 'Unable to create test directory';
# Create the backrest private directory
if (defined($bPrivate) && $bPrivate)
{
@@ -102,8 +99,7 @@ sub BackRestTestFile_Test
#-------------------------------------------------------------------------------------------------------------------------------
# Create remotes
#-------------------------------------------------------------------------------------------------------------------------------
mkdir($strTestPath, oct('0770')) or confess 'Unable to create test directory';
mkdir($strTestPath . '/backrest', oct('0770')) or confess 'Unable to create test directory';
mkdir($strTestPath . '/backrest', oct('0770')) or confess 'Unable to create backrest directory';
my $oRemote = new pgBackRest::Protocol::RemoteMaster
(