1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-01-16 04:54:47 +02:00

Switched to using docker for all unit tests as this allows for greater automation.

This commit is contained in:
David Steele 2015-12-29 13:57:10 -05:00
parent 91d1e94076
commit 7f630aec49
21 changed files with 717 additions and 433 deletions

3
.gitignore vendored
View File

@ -2,9 +2,8 @@
*~
*.swp
test/test
test/vm/.vagrant
test/.vagrant
test/nytprof.out
test/nytprof/*
doc/output/*
doc/doc/output/*
test/vm/package/*

View File

@ -113,13 +113,13 @@ sub execute
{
# Command variables
$strCommand = trim($oCommand->fieldGet('exe-cmd'));
my $strUser = $oCommand->paramGet('user', false, 'postgres');
my $strUser = $self->{oManifest}->variableReplace($oCommand->paramGet('user', false, 'postgres'));
my $bExeOutput = $oCommand->paramTest('output', 'y');
my $strVariableKey = $oCommand->paramGet('variable-key', false);
my $iExeExpectedError = $oCommand->paramGet('err-expect', false);
$strCommand = $self->{oManifest}->variableReplace(
(defined($strUser) && $strUser eq 'vagrant' ? '' :
($strUser eq 'vagrant' ? '' :
('sudo ' . ($strUser eq 'root' ? '' : "-u ${strUser} "))) . $strCommand);
# Add continuation chars and proper spacing
@ -132,7 +132,7 @@ sub execute
{
if (length(trim($strLine)) > 80)
{
confess &log(ERROR, "command has a line > 80 characters:\n${strCommand}");
confess &log(ERROR, "command has a line > 80 characters:\n${strCommand}\noffending line: ${strLine}");
}
}
}
@ -577,8 +577,8 @@ sub sectionChildProcess
$self->execute($oSection, $strName, $oExecute, $iDepth + 1);
}
$oHost->executeSimple("sh -c 'echo \"\" >> /etc/hosts\'");
$oHost->executeSimple("sh -c 'echo \"# Test Hosts\" >> /etc/hosts'");
$oHost->executeSimple("sh -c 'echo \"\" >> /etc/hosts\'", undef, 'root');
$oHost->executeSimple("sh -c 'echo \"# Test Hosts\" >> /etc/hosts'", undef, 'root');
# Add all other host IPs to this host
foreach my $strOtherHostName (sort(keys($self->{host})))
@ -587,7 +587,7 @@ sub sectionChildProcess
{
my $oOtherHost = $self->{host}{$strOtherHostName};
$oHost->executeSimple("sh -c 'echo \"$oOtherHost->{strIP} ${strOtherHostName}\" >> /etc/hosts'");
$oHost->executeSimple("sh -c 'echo \"$oOtherHost->{strIP} ${strOtherHostName}\" >> /etc/hosts'", undef, 'root');
}
}
@ -598,7 +598,7 @@ sub sectionChildProcess
{
my $oOtherHost = $self->{host}{$strOtherHostName};
$oOtherHost->executeSimple("sh -c 'echo \"$oHost->{strIP} ${strName}\" >> /etc/hosts'");
$oOtherHost->executeSimple("sh -c 'echo \"$oHost->{strIP} ${strName}\" >> /etc/hosts'", undef, 'root');
}
}

View File

@ -36,21 +36,21 @@
<variable key="host-user">vagrant</variable>
<variable key="host-mount">/backrest:/backrest</variable>
<variable key="image-user">{[host-user]}</variable>
<variable key="image-user">backrest</variable>
<variable key="host-db-master">db-master</variable>
<variable key="host-db-master-user">{[host-user]}</variable>
<variable key="host-db-master-image">{[image-user]}/{[host-os]}-db</variable>
<variable key="host-db-master-image">{[image-user]}/{[host-os]}-db-doc</variable>
<variable key="host-db-master-mount">{[host-mount]}</variable>
<variable key="host-db-standby">db-standby</variable>
<variable key="host-db-standby-user">{[host-user]}</variable>
<variable key="host-db-standby-image">{[image-user]}/{[host-os]}-db</variable>
<variable key="host-db-standby-image">{[image-user]}/{[host-os]}-db-doc</variable>
<variable key="host-db-standby-mount">{[host-mount]}</variable>
<variable key="host-backup">backup</variable>
<variable key="host-backup-user">{[host-user]}</variable>
<variable key="host-backup-image">{[image-user]}/{[host-os]}-backup</variable>
<variable key="host-backup-image">{[image-user]}/{[host-os]}-backup-doc</variable>
<variable key="host-backup-mount">{[host-mount]}</variable>
<!-- Commands for various operations -->
@ -132,14 +132,14 @@
<title>Installation</title>
<host-add name="{[host-db-master]}" user="{[host-db-master-user]}" image="{[host-db-master-image]}" os="{[host-os]}" mount="{[host-db-master-mount]}">
<execute user="vagrant">
<exe-cmd>mkdir /home/vagrant/backrest-release-{[version]}</exe-cmd>
<execute user="{[host-user]}">
<exe-cmd>mkdir /home/{[host-user]}/backrest-release-{[version]}</exe-cmd>
</execute>
<execute user="vagrant">
<exe-cmd>cp -r /backrest/bin /home/vagrant/backrest-release-{[version]}</exe-cmd>
<execute user="{[host-user]}">
<exe-cmd>cp -r /backrest/bin /home/{[host-user]}/backrest-release-{[version]}</exe-cmd>
</execute>
<execute user="vagrant">
<exe-cmd>cp -r /backrest/lib /home/vagrant/backrest-release-{[version]}</exe-cmd>
<execute user="{[host-user]}">
<exe-cmd>cp -r /backrest/lib /home/{[host-user]}/backrest-release-{[version]}</exe-cmd>
</execute>
</host-add>
@ -171,7 +171,7 @@
<execute-list host="{[host-db-master]}">
<title>Download version <id>{[version]}</id> of <backrest/></title>
<execute user="vagrant" skip="y">
<execute user="{[host-user]}" skip="y">
<exe-cmd>wget -q -O -
https://github.com/pgmasters/backrest/archive/release/{[version]}.tar.gz |
tar zx -C ~</exe-cmd>
@ -182,7 +182,8 @@
<title>Install <backrest/></title>
<execute user="root">
<exe-cmd>cp -r ~/backrest-release-{[version]}/lib/BackRest {[perl-lib-path]}</exe-cmd>
<exe-cmd>cp -r ~/backrest-release-{[version]}/lib/BackRest
{[perl-lib-path]}</exe-cmd>
</execute>
<execute user="root">
<exe-cmd>find {[perl-lib-path]}/BackRest -type f -exec chmod 644 {} +</exe-cmd>
@ -1150,7 +1151,8 @@
<exe-cmd>find {[perl-lib-path]}/BackRest -type d -exec chmod 755 {} +</exe-cmd>
</execute>
<execute user="root">
<exe-cmd>cp /backrest/bin/{[project-exe]} {[perl-bin-path]}/{[project-exe]}</exe-cmd>
<exe-cmd>cp /backrest/bin/{[project-exe]}
{[perl-bin-path]}/{[project-exe]}</exe-cmd>
</execute>
<execute user="root">
<exe-cmd>chmod 755 {[perl-bin-path]}/{[project-exe]}</exe-cmd>

42
test/Vagrantfile vendored Normal file
View File

@ -0,0 +1,42 @@
Vagrant.configure(2) do |config|
config.vm.provider :virtualbox do |vb|
vb.memory = 2048
vb.cpus = 8
end
config.vm.box = "boxcutter/ubuntu1404-docker"
config.vm.provider :virtualbox do |vb|
vb.name = "backrest-test"
end
# Provision the VM
config.vm.provision "shell", inline: <<-SHELL
# Install Perl modules
sudo apt-get update
apt-get install -y libdbi-perl libdbd-pg-perl libxml-checker-perl ghostscript
# Install texlive
mkdir /root/texlive
wget -q -O - http://mirror.hmc.edu/ctan/systems/texlive/tlnet/install-tl-unx.tar.gz \
| tar zxv -C /root//texlive --strip-components=1
echo "collection-basic 1" >> /root/texlive/texlive.profile
echo "collection-latex 1" >> /root/texlive/texlive.profile
/root/texlive/install-tl -profile=/root/texlive/texlive.profile
echo 'PATH=/usr/local/texlive/2015/bin/x86_64-linux:$PATH' >> /etc/profile
echo 'export PATH' >> /etc/profile
/usr/local/texlive/2015/bin/x86_64-linux/tlmgr install caption xcolor listings parskip helvetic ltablex titlesec \
epstopdf courier sectsty pgf ms
# Build docker images
/backrest/test/container.pl
SHELL
# Don't share the default vagrant folder
config.vm.synced_folder ".", "/vagrant", disabled: true
# Mount backrest path for testing
config.vm.synced_folder "..", "/backrest"
end

625
test/container.pl Executable file
View File

@ -0,0 +1,625 @@
#!/usr/bin/perl
####################################################################################################################################
# container.pl - Build docker containers for testing and documentation
####################################################################################################################################
####################################################################################################################################
# Perl includes
####################################################################################################################################
use strict;
use warnings FATAL => qw(all);
use Carp qw(confess longmess);
# Convert die to confess to capture the stack trace
$SIG{__DIE__} = sub { Carp::confess @_ };
use Cwd qw(abs_path);
use File::Basename qw(dirname);
use Getopt::Long qw(GetOptions);
use Scalar::Util qw(blessed);
# use Cwd qw(abs_path);
# use Pod::Usage qw(pod2usage);
# use Scalar::Util qw(blessed);
use lib dirname($0) . '/../lib';
use BackRest::Common::Ini;
# use BackRest::Common::Ini;
use BackRest::Common::Log;
use BackRest::FileCommon;
# use BackRest::Db;
use lib dirname($0) . '/lib';
use BackRestTest::Common::ExecuteTest;
# use BackRestTest::CommonTest;
# use BackRestTest::CompareTest;
# use BackRestTest::ConfigTest;
# use BackRestTest::FileTest;
# use BackRestTest::HelpTest;
####################################################################################################################################
# Usage
####################################################################################################################################
=head1 NAME
container.pl - Docker Container Build
=head1 SYNOPSIS
container.pl [options]
Build Options:
--os os to build (defaults to all)
Configuration Options:
--log-level log level to use for tests (defaults to info)
--quiet, -q equivalent to --log-level=off
General Options:
--version display version and exit
--help display usage and exit
=cut
####################################################################################################################################
# Command line parameters
####################################################################################################################################
my $strLogLevel = 'info';
my $bVersion = false;
my $bHelp = false;
my $bQuiet = false;
GetOptions ('q|quiet' => \$bQuiet,
'version' => \$bVersion,
'help' => \$bHelp,
'log-level=s' => \$strLogLevel)
or pod2usage(2);
# Display version and exit if requested
if ($bVersion || $bHelp)
{
syswrite(*STDOUT, 'pgBackRest ' . BACKREST_VERSION . " Docker Container Build\n");
if ($bHelp)
{
syswrite(*STDOUT, "\n");
pod2usage();
}
exit 0;
}
if (@ARGV > 0)
{
syswrite(*STDOUT, "invalid parameter\n\n");
pod2usage();
}
####################################################################################################################################
# Setup
####################################################################################################################################
# Set a neutral umask so tests work as expected
umask(0);
# Set console log level
if ($bQuiet)
{
$strLogLevel = 'off';
}
logLevelSet(undef, uc($strLogLevel));
# Create temp path
my $strTempPath = dirname(abs_path($0)) . '/.vagrant/docker';
if (!-e $strTempPath)
{
mkdir $strTempPath
or confess &log(ERROR, "unable to create ${strTempPath}");
}
####################################################################################################################################
# Valid OS list
####################################################################################################################################
use constant OS_CO6 => 'co6';
use constant OS_CO7 => 'co7';
use constant OS_U12 => 'u12';
use constant OS_U14 => 'u14';
my @stryOS =
(
OS_CO6, # CentOS 6
OS_CO7, # CentOS 7
OS_U12, # Ubuntu 12.04
OS_U14 # Ubuntu 14.04
);
use constant TEST_GROUP => 'admin';
use constant TEST_GROUP_ID => 1000;
use constant TEST_USER => 'vagrant';
use constant TEST_USER_ID => TEST_GROUP_ID;
use constant POSTGRES_GROUP => 'postgres';
use constant POSTGRES_GROUP_ID => 5000;
use constant POSTGRES_USER => POSTGRES_GROUP;
use constant POSTGRES_USER_ID => POSTGRES_GROUP_ID;
use constant BACKREST_GROUP => POSTGRES_GROUP;
use constant BACKREST_GROUP_ID => POSTGRES_GROUP_ID;
use constant BACKREST_USER => 'backrest';
use constant BACKREST_USER_ID => 5001;
####################################################################################################################################
# User/group creation
####################################################################################################################################
sub groupCreate
{
my $strOS = shift;
my $strName = shift;
my $iId = shift;
return "RUN groupadd -g${iId} ${strName}";
}
sub userCreate
{
my $strOS = shift;
my $strName = shift;
my $iId = shift;
my $strGroup = shift;
if ($strOS eq OS_CO6 || $strOS eq OS_CO7)
{
return "RUN adduser -g${strGroup} -u${iId} -n ${strName}";
}
elsif ($strOS eq OS_U12 || $strOS eq OS_U14)
{
return "RUN adduser --uid=${iId} --ingroup=${strGroup} --disabled-password --gecos \"\" ${strName}";
}
confess &log(ERROR, "unable to create user for os '${strOS}'");
}
sub postgresGroupCreate
{
my $strOS = shift;
return "# Create PostgreSQL group\n" .
groupCreate($strOS, POSTGRES_GROUP, POSTGRES_GROUP_ID);
}
sub postgresUserCreate
{
my $strOS = shift;
return "# Create PostgreSQL user\n" .
userCreate($strOS, POSTGRES_USER, POSTGRES_USER_ID, POSTGRES_GROUP);
}
sub backrestUserCreate
{
my $strOS = shift;
return "# Create BackRest group\n" .
userCreate($strOS, BACKREST_USER, BACKREST_USER_ID, BACKREST_GROUP);
}
####################################################################################################################################
# Create pg_backrest.conf
####################################################################################################################################
sub backrestConfigCreate
{
my $strOS = shift;
my $strUser = shift;
my $strGroup = shift;
return "# Create pg_backrest.conf\n" .
"RUN touch /etc/pg_backrest.conf\n" .
"RUN chmod 640 /etc/pg_backrest.conf\n" .
"RUN chown ${strUser}:${strGroup} /etc/pg_backrest.conf";
}
####################################################################################################################################
# Setup SSH
####################################################################################################################################
sub sshSetup
{
my $strOS = shift;
my $strUser = shift;
my $strGroup = shift;
return "# Setup SSH\n" .
"RUN mkdir /home/${strUser}/.ssh\n" .
"COPY id_rsa /home/${strUser}/.ssh/id_rsa\n" .
"COPY id_rsa.pub /home/${strUser}/.ssh/authorized_keys\n" .
"RUN chown -R ${strUser}:${strGroup} /home/${strUser}/.ssh\n" .
"RUN chmod 700 /home/${strUser}/.ssh\n" .
"RUN echo 'Host *' > /home/${strUser}/.ssh/config\n" .
"RUN echo ' StrictHostKeyChecking no' >> /home/${strUser}/.ssh/config\n" .
"RUN echo ' LogLevel quiet' >> /home/${strUser}/.ssh/config";
}
####################################################################################################################################
# Repo Setup
####################################################################################################################################
sub repoSetup
{
my $strOS = shift;
my $strUser = shift;
my $strGroup = shift;
return "# Setup repository\n" .
"RUN mkdir /var/lib/backrest\n" .
"RUN chown -R ${strUser}:${strGroup} /var/lib/backrest\n" .
"RUN chmod 750 /var/lib/backrest";
}
####################################################################################################################################
# Install Perl packages
####################################################################################################################################
sub perlInstall
{
my $strOS = shift;
my $strImage =
"# Install Perl packages\n";
if ($strOS eq OS_CO6)
{
$strImage .=
"RUN yum -y install perl perl-Time-HiRes perl-parent perl-JSON perl-Digest-SHA perl-DBD-Pg";
}
elsif ($strOS eq OS_CO7)
{
$strImage .=
"RUN yum -y install perl perl-Thread-Queue perl-JSON-PP perl-Digest-SHA perl-DBD-Pg";
}
elsif ($strOS eq OS_U12 || $strOS eq OS_U14)
{
$strImage .=
"RUN apt-get -y install libdbd-pg-perl libdbi-perl libnet-daemon-perl libplrpc-perl";
}
return $strImage;
}
####################################################################################################################################
# Build containers
####################################################################################################################################
eval
{
# Create SSH key (if it does not already exist)
if (-e "${strTempPath}/id_rsa")
{
&log(INFO, "SSH key already exists");
}
else
{
&log(INFO, "Building SSH keys...");
executeTest("ssh-keygen -f ${strTempPath}/id_rsa -t rsa -b 768 -N ''");
}
foreach my $strOS (@stryOS)
{
my $strImage;
my $strImageName;
# Base image
###########################################################################################################################
$strImageName = "${strOS}-base";
&log(INFO, "Building ${strImageName} image...");
$strImage = "# Base Container\nFROM ";
if ($strOS eq OS_CO6)
{
$strImage .= 'centos:6';
}
elsif ($strOS eq OS_CO7)
{
$strImage .= 'centos:7';
}
elsif ($strOS eq OS_U12)
{
$strImage .= 'ubuntu:12.04';
}
elsif ($strOS eq OS_U14)
{
$strImage .= 'ubuntu:14.04';
}
# Install SSH
$strImage .= "\n\n# Install SSH\n";
if ($strOS eq OS_CO6 || $strOS eq OS_CO7)
{
$strImage .= "RUN yum -y install openssh-server openssh-clients\n";
}
elsif ($strOS eq OS_U12 || $strOS eq OS_U14)
{
$strImage .= "RUN apt-get -y install openssh-server\n";
}
$strImage .=
"RUN rm -f /etc/ssh/ssh_host_rsa_key*\n" .
"RUN ssh-keygen -t rsa -b 768 -f /etc/ssh/ssh_host_rsa_key";
# Create PostgreSQL Group
$strImage .= "\n\n" . postgresGroupCreate($strOS);
# Add PostgreSQL packages
$strImage .= "\n\n# Add PostgreSQL packages\n";
if ($strOS eq OS_CO6)
{
$strImage .=
"RUN rpm -ivh http://yum.postgresql.org/9.0/redhat/rhel-6-x86_64/pgdg-centos90-9.0-5.noarch.rpm\n" .
"RUN rpm -ivh http://yum.postgresql.org/9.1/redhat/rhel-6-x86_64/pgdg-centos91-9.1-4.noarch.rpm\n" .
"RUN rpm -ivh http://yum.postgresql.org/9.2/redhat/rhel-6-x86_64/pgdg-centos92-9.2-6.noarch.rpm\n" .
"RUN rpm -ivh http://yum.postgresql.org/9.3/redhat/rhel-6-x86_64/pgdg-centos93-9.3-1.noarch.rpm\n" .
"RUN rpm -ivh http://yum.postgresql.org/9.4/redhat/rhel-6-x86_64/pgdg-centos94-9.4-1.noarch.rpm";
}
elsif ($strOS eq OS_CO7)
{
$strImage .=
"RUN rpm -ivh http://yum.postgresql.org/9.3/redhat/rhel-7-x86_64/pgdg-centos93-9.3-1.noarch.rpm\n" .
"RUN rpm -ivh http://yum.postgresql.org/9.4/redhat/rhel-7-x86_64/pgdg-centos94-9.4-1.noarch.rpm\n" .
"RUN rpm -ivh http://yum.postgresql.org/9.5/redhat/rhel-7-x86_64/pgdg-centos95-9.5-1.noarch.rpm";
}
elsif ($strOS eq OS_U12 || $strOS eq OS_U14)
{
if ($strOS eq OS_U12)
{
$strImage .=
"RUN apt-get install -y sudo\n";
}
$strImage .=
"RUN echo 'deb http://apt.postgresql.org/pub/repos/apt/ " .
($strOS eq OS_U12 ? 'precise' : 'trusty') .
"-pgdg main 9.5' >> /etc/apt/sources.list.d/pgdg.list\n" .
"RUN wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -\n" .
"RUN apt-get update";
}
# Create test group
$strImage .=
"\n\n# Create test group\n" .
groupCreate($strOS, TEST_GROUP, TEST_GROUP_ID) . "\n";
if ($strOS eq OS_CO6 || $strOS eq OS_CO7)
{
$strImage .=
"RUN yum -y install sudo\n" .
"RUN echo '%" . TEST_GROUP . " ALL=(ALL) NOPASSWD: ALL' > /etc/sudoers.d/" . TEST_GROUP . "\n" .
"RUN sed -i 's/^Defaults requiretty\$/\\# Defaults requiretty/' /etc/sudoers";
}
elsif ($strOS eq OS_U12 || $strOS eq OS_U14)
{
$strImage .=
"RUN sed -i 's/^\\\%admin.*\$/\\\%" . TEST_GROUP . " ALL\\=\\(ALL\\) NOPASSWD\\: ALL/' /etc/sudoers";
}
# Create test user
$strImage .=
"\n\n# Create test user\n" .
userCreate($strOS, TEST_USER, TEST_USER_ID, TEST_GROUP);
# Suppress dpkg interactive output
if ($strOS eq OS_U12 || $strOS eq OS_U14)
{
$strImage .=
"\n\n# Suppress dpkg interactive output\n" .
"RUN rm /etc/apt/apt.conf.d/70debconf";
}
# Start SSH when container starts
$strImage .=
"\n\n# Start SSH when container starts\n";
if ($strOS eq OS_CO6)
{
$strImage .=
"ENTRYPOINT service sshd restart && bash";
}
elsif ($strOS eq OS_CO7)
{
$strImage .=
# "ENTRYPOINT systemctl start sshd.service && bash";
"ENTRYPOINT /usr/sbin/sshd -D && bash";
}
elsif ($strOS eq OS_U12)
{
$strImage .=
"ENTRYPOINT /etc/init.d/ssh start && bash";
}
elsif ($strOS eq OS_U14)
{
$strImage .=
"ENTRYPOINT service ssh restart && bash";
}
# Write the image
fileStringWrite("${strTempPath}/${strImageName}", "$strImage\n", false);
executeTest("docker build -f ${strTempPath}/${strImageName} -t backrest/${strImageName} ${strTempPath}");
# Db image
###########################################################################################################################
$strImageName = "${strOS}-db";
&log(INFO, "Building ${strImageName} image...");
$strImage = "# Database Container\nFROM backrest/${strOS}-base";
# Create PostgreSQL User
$strImage .= "\n\n" . postgresUserCreate($strOS);
# Install SSH key
$strImage .=
"\n\n" . sshSetup($strOS, POSTGRES_USER, POSTGRES_GROUP);
# Install PostgreSQL
$strImage .=
"\n\n# Install PostgreSQL\n";
if ($strOS eq OS_CO6)
{
$strImage .=
"RUN yum -y install postgresql90-server\n" .
"RUN yum -y install postgresql91-server\n" .
"RUN yum -y install postgresql92-server\n" .
"RUN yum -y install postgresql93-server\n" .
"RUN yum -y install postgresql94-server";
}
elsif ($strOS eq OS_CO7)
{
$strImage .=
"RUN yum -y install postgresql93-server\n" .
"RUN yum -y install postgresql94-server\n" .
"RUN yum -y install postgresql95-server";
}
elsif ($strOS eq OS_U12)
{
$strImage .=
"RUN apt-get install -y postgresql-9.4\n" .
"RUN pg_dropcluster --stop 9.4 main\n" .
"RUN apt-get install -y postgresql-9.3\n" .
"RUN pg_dropcluster --stop 9.3 main\n" .
"RUN apt-get install -y postgresql-9.2\n" .
"RUN pg_dropcluster --stop 9.2 main\n" .
"RUN apt-get install -y postgresql-9.1\n" .
"RUN pg_dropcluster --stop 9.1 main\n" .
"RUN apt-get install -y postgresql-9.0\n" .
"RUN pg_dropcluster --stop 9.0 main\n" .
"RUN apt-get install -y postgresql-8.4\n" .
"RUN pg_dropcluster --stop 8.4 main";
}
elsif ($strOS eq OS_U14)
{
$strImage .=
"RUN apt-get install -y postgresql-9.5\n" .
"RUN pg_dropcluster --stop 9.5 main\n" .
"RUN apt-get install -y postgresql-9.4\n" .
"RUN pg_dropcluster --stop 9.4 main\n" .
"RUN apt-get install -y postgresql-9.3\n" .
"RUN pg_dropcluster --stop 9.3 main\n" .
"RUN apt-get install -y postgresql-9.2\n" .
"RUN pg_dropcluster --stop 9.2 main\n" .
"RUN apt-get install -y postgresql-9.1\n" .
"RUN pg_dropcluster --stop 9.1 main\n" .
"RUN apt-get install -y postgresql-9.0\n" .
"RUN pg_dropcluster --stop 9.0 main";
}
# Write the image
fileStringWrite("${strTempPath}/${strImageName}", "${strImage}\n", false);
executeTest("docker build -f ${strTempPath}/${strImageName} -t backrest/${strImageName} ${strTempPath}");
# Db Doc image
###########################################################################################################################
$strImageName = "${strOS}-db-doc";
&log(INFO, "Building ${strImageName} image...");
$strImage = "# Database Doc Container\nFROM backrest/${strOS}-db";
# Create pg_backrest.conf
$strImage .=
"\n\n" . backrestConfigCreate($strOS, POSTGRES_USER, POSTGRES_GROUP);
# Write the image
fileStringWrite("${strTempPath}/${strImageName}", "${strImage}\n", false);
executeTest("docker build -f ${strTempPath}/${strImageName} -t backrest/${strImageName} ${strTempPath}");
# Backup image
###########################################################################################################################
$strImageName = "${strOS}-backup";
&log(INFO, "Building ${strImageName} image...");
$strImage = "# Backup Container\nFROM backrest/${strOS}-base";
# Create BackRest User
$strImage .= "\n\n" . backrestUserCreate($strOS);
# Install SSH key
$strImage .=
"\n\n" . sshSetup($strOS, BACKREST_USER, BACKREST_GROUP);
# Write the image
fileStringWrite("${strTempPath}/${strImageName}", "${strImage}\n", false);
executeTest("docker build -f ${strTempPath}/${strImageName} -t backrest/${strImageName} ${strTempPath}");
# Backup Doc image
###########################################################################################################################
$strImageName = "${strOS}-backup-doc";
&log(INFO, "Building ${strImageName} image...");
$strImage = "# Backup Doc Container\nFROM backrest/${strOS}-backup";
# Create pg_backrest.conf
$strImage .=
"\n\n" . backrestConfigCreate($strOS, BACKREST_USER, BACKREST_GROUP);
# Setup repository
$strImage .=
"\n\n" . repoSetup($strOS, BACKREST_USER, BACKREST_GROUP);
# Install Perl packages
$strImage .=
"\n\n" . perlInstall($strOS) . "\n";
# Write the image
fileStringWrite("${strTempPath}/${strImageName}", "${strImage}\n", false);
executeTest("docker build -f ${strTempPath}/${strImageName} -t backrest/${strImageName} ${strTempPath}");
# Test image
###########################################################################################################################
$strImageName = "${strOS}-test";
&log(INFO, "Building ${strImageName} image...");
$strImage = "# Test Container\nFROM backrest/${strOS}-db";
# Create BackRest User
$strImage .= "\n\n" . backrestUserCreate($strOS);
# Install SSH key
$strImage .=
"\n\n" . sshSetup($strOS, BACKREST_USER, BACKREST_GROUP);
# Install SSH key for vagrant user
$strImage .=
"\n\n" . sshSetup($strOS, TEST_USER, TEST_GROUP);
# Put vagrant user in postgres group so tests work properly (this will be removed in the future)
$strImage .=
"\n\n# Add postgres group to vagrant user\n" .
"RUN usermod -g " . BACKREST_GROUP . " -G " . TEST_GROUP . " " . TEST_USER;
# Install Perl packages
$strImage .=
"\n\n" . perlInstall($strOS) . "\n";
# Make PostgreSQL home group readable
$strImage .=
"\n\n# Make vagrant home dir readable\n" .
"RUN chown -R vagrant:postgres /home/vagrant\n" .
"RUN chmod g+r,g+x /home/vagrant";
# Write the image
fileStringWrite("${strTempPath}/${strImageName}", "${strImage}\n", false);
executeTest("docker build -f ${strTempPath}/${strImageName} -t backrest/${strImageName} ${strTempPath}");
}
};
if ($@)
{
my $oMessage = $@;
# If a backrest exception then return the code - don't confess
if (blessed($oMessage) && $oMessage->isa('BackRest::Common::Exception'))
{
syswrite(*STDOUT, $oMessage->trace());
exit $oMessage->code();
}
syswrite(*STDOUT, $oMessage);
exit 255;;
}

View File

@ -113,7 +113,7 @@ sub execute
}
my $oExec = new BackRestTest::Common::ExecuteTest(
'docker exec ' . ($strUser eq 'root' ? "-u ${strUser} " : '') . "$self->{strName} ${strCommand}" , $oParam);
"docker exec -u ${strUser} $self->{strName} ${strCommand}" , $oParam);
# Return from function and log return values if any
return logDebugReturn

View File

@ -98,7 +98,6 @@ sub BackRestTestFile_Test
# Create remotes
#-------------------------------------------------------------------------------------------------------------------------------
executeTest('rm -rf ' . cwd() . '/log_remote');
mkdir(cwd() . '/log_remote', oct('0770')) or confess 'Unable to create test log directory';
my $oRemote = new BackRest::Protocol::RemoteMaster
(

View File

@ -26,6 +26,7 @@ use BackRest::Db;
use lib dirname($0) . '/lib';
use BackRestTest::BackupTest;
use BackRestTest::Common::ExecuteTest;
use BackRestTest::CommonTest;
use BackRestTest::CompareTest;
use BackRestTest::ConfigTest;
@ -72,6 +73,7 @@ test.pl [options]
# Command line parameters
####################################################################################################################################
my $strLogLevel = 'info';
my $strOS = undef;
my $strModule = 'all';
my $strModuleTest = 'all';
my $iModuleTestRun = undef;
@ -88,6 +90,8 @@ my $bInfinite = false;
my $strDbVersion = 'all';
my $bLogForce = false;
my $strCommandLine = join(' ', @ARGV);
GetOptions ('q|quiet' => \$bQuiet,
'version' => \$bVersion,
'help' => \$bHelp,
@ -95,6 +99,7 @@ GetOptions ('q|quiet' => \$bQuiet,
'exes=s' => \$strExe,
'test-path=s' => \$strTestPath,
'log-level=s' => \$strLogLevel,
'os=s' => \$strOS,
'module=s' => \$strModule,
'test=s' => \$strModuleTest,
'run=s' => \$iModuleTestRun,
@ -126,6 +131,27 @@ if (@ARGV > 0)
pod2usage();
}
####################################################################################################################################
# Start OS VM and run
####################################################################################################################################
if (defined($strOS))
{
executeTest("docker rm -f ${strOS}-test", {bSuppressError => true});
executeTest("docker run -itd -h ${strOS}-test --name=${strOS}-test -v /backrest:/backrest backrest/${strOS}-test");
$strCommandLine =~ s/\-\-os\=\S*//g;
$strCommandLine =~ s/\-\-test-path\=\S*//g;
system("docker exec -it -u vagrant ${strOS}-test $0 ${strCommandLine} --test-path=/home/vagrant/test");
if (!$bNoCleanup)
{
executeTest("docker rm -f ${strOS}-test");
}
exit 0;
}
####################################################################################################################################
# Setup
####################################################################################################################################

200
test/vm/Vagrantfile vendored
View File

@ -1,200 +0,0 @@
Vagrant.configure(2) do |config|
config.vm.provider :virtualbox do |vb|
vb.memory = 1024
vb.cpus = 4
end
config.vm.define "u12" do |u12|
u12.vm.box = "boxcutter/ubuntu1204"
u12.vm.provider :virtualbox do |vb|
vb.name = "backrest-test-ubuntu-12.04"
end
# Provision the VM
u12.vm.provision "shell", inline: <<-SHELL
# Install db
echo 'deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main' > /etc/apt/sources.list.d/pgdg.list
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo apt-get update
apt-get install -y postgresql-9.4
pg_dropcluster --stop 9.4 main
apt-get install -y postgresql-9.3
pg_dropcluster --stop 9.3 main
apt-get install -y postgresql-9.2
pg_dropcluster --stop 9.2 main
apt-get install -y postgresql-9.1
pg_dropcluster --stop 9.1 main
apt-get install -y postgresql-9.0
pg_dropcluster --stop 9.0 main
apt-get install -y postgresql-8.4
pg_dropcluster --stop 8.4 main
# Setup SSH
adduser --ingroup=vagrant --disabled-password --gecos "" backrest
/backrest/test/vm/ssh/setup.sh
/backrest/test/vm/ssh/setup-cm.sh
# Install required Perl modules
apt-get install -y libdbi-perl libdbd-pg-perl
# Install Perl modules required for building the docs
apt-get install -y libxml-checker-perl libxml-writer-perl
SHELL
end
config.vm.define "u14" do |u14|
u14.vm.box = "boxcutter/ubuntu1404"
u14.vm.provider :virtualbox do |vb|
vb.name = "backrest-test-ubuntu-14.04"
end
# Provision the VM
u14.vm.provision "shell", inline: <<-SHELL
# Install db
echo 'deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main 9.5' >> /etc/apt/sources.list.d/pgdg.list
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo apt-get update
apt-get install -y postgresql-9.5
pg_dropcluster --stop 9.5 main
apt-get install -y postgresql-9.4
pg_dropcluster --stop 9.4 main
apt-get install -y postgresql-9.3
pg_dropcluster --stop 9.3 main
apt-get install -y postgresql-9.2
pg_dropcluster --stop 9.2 main
apt-get install -y postgresql-9.1
pg_dropcluster --stop 9.1 main
apt-get install -y postgresql-9.0
pg_dropcluster --stop 9.0 main
# Setup SSH
adduser --ingroup=vagrant --disabled-password --gecos "" backrest
/backrest/test/vm/ssh/setup.sh
/backrest/test/vm/ssh/setup-cm.sh
# Install required Perl modules
apt-get install libdbi-perl libdbd-pg-perl
# Install Perl modules required for building the docs
apt-get install -y libxml-checker-perl libxml-writer-perl
SHELL
end
config.vm.define "u14doc" do |u14doc|
u14doc.vm.box = "boxcutter/ubuntu1404"
u14doc.vm.provider :virtualbox do |vb|
vb.name = "backrest-doc-test-ubuntu-14.04"
end
# Provision the VM
u14doc.vm.provision "shell", inline: <<-SHELL
# Install docker
apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
echo 'deb https://apt.dockerproject.org/repo ubuntu-trusty main' > /etc/apt/sources.list.d/docker.list
sudo apt-get update
sudo apt-get -y install linux-image-extra-$(uname -r)
sudo apt-get -y install docker-engine
sudo usermod -aG docker vagrant
# This requires a reboot - maybe don't do it - see how it goes first
# sed -i 's/^GRUB_CMDLINE_LINUX\=.*$/GRUB_CMDLINE_LINUX\=\"cgroup_enable=memory swapaccount=1\"/' /etc/default/grub
# Install Perl modules
apt-get install -y libxml-checker-perl ghostscript
# Install texlive
mkdir /root/texlive
wget -q -O - http://mirror.hmc.edu/ctan/systems/texlive/tlnet/install-tl-unx.tar.gz | tar zxv -C /root//texlive --strip-components=1
echo "collection-basic 1" >> /root/texlive/texlive.profile
echo "collection-latex 1" >> /root/texlive/texlive.profile
/root/texlive/install-tl -profile=/root/texlive/texlive.profile
echo 'PATH=/usr/local/texlive/2015/bin/x86_64-linux:$PATH' >> /etc/profile
echo 'export PATH' >> /etc/profile
/usr/local/texlive/2015/bin/x86_64-linux/tlmgr install caption xcolor listings parskip helvetic ltablex titlesec \
epstopdf courier sectsty pgf ms
# Build images
docker build -f /backrest/test/vm/docker/u14-base -t vagrant/u14-base /backrest/test/vm
docker build -f /backrest/test/vm/docker/u14-db -t vagrant/u14-db /backrest/test/vm
docker build -f /backrest/test/vm/docker/u14-backup -t vagrant/u14-backup /backrest/test/vm
docker build -f /backrest/test/vm/docker/co6-base -t vagrant/co6-base /backrest/test/vm
docker build -f /backrest/test/vm/docker/co6-db -t vagrant/co6-db /backrest/test/vm
docker build -f /backrest/test/vm/docker/co6-backup -t vagrant/co6-backup /backrest/test/vm
# Sample docker commands
# docker inspect --format '{{ .NetworkSettings.IPAddress }}' db-master
# docker run -itd --name=db-master -v /backrest:/backrest vagrant/u14-db
# docker run -itd --name=backup -v /backrest:/backrest vagrant/u14-backup
# docker exec -it db-master bash
SHELL
end
config.vm.define "co6" do |co6|
co6.vm.box = "boxcutter/centos67"
co6.vm.provider :virtualbox do |vb|
vb.name = "backrest-test-centos-6.7"
end
# Provision the VM
co6.vm.provision "shell", inline: <<-SHELL
# Install db
sudo rpm -ivh http://yum.postgresql.org/9.0/redhat/rhel-6-x86_64/pgdg-centos90-9.0-5.noarch.rpm
sudo rpm -ivh http://yum.postgresql.org/9.1/redhat/rhel-6-x86_64/pgdg-centos91-9.1-4.noarch.rpm
sudo rpm -ivh http://yum.postgresql.org/9.2/redhat/rhel-6-x86_64/pgdg-centos92-9.2-6.noarch.rpm
sudo rpm -ivh http://yum.postgresql.org/9.3/redhat/rhel-6-x86_64/pgdg-centos93-9.3-1.noarch.rpm
sudo rpm -ivh http://yum.postgresql.org/9.4/redhat/rhel-6-x86_64/pgdg-centos94-9.4-1.noarch.rpm
yum -y install postgresql90-server
yum -y install postgresql91-server
yum -y install postgresql92-server
yum -y install postgresql93-server
yum -y install postgresql94-server
# Install Perl and required modules
yum -y install perl perl-Time-HiRes perl-parent perl-JSON perl-Digest-SHA perl-DBD-Pg
# Setup SSH
adduser -gvagrant -n backrest
/backrest/test/vm/ssh/setup.sh
SHELL
end
config.vm.define "co7" do |co7|
co7.vm.box = "boxcutter/centos71"
co7.vm.provider :virtualbox do |vb|
vb.name = "backrest-test-centos-7.1"
end
# Provision the VM
co7.vm.provision "shell", inline: <<-SHELL
# Install db
sudo rpm -ivh http://yum.postgresql.org/9.3/redhat/rhel-7-x86_64/pgdg-centos93-9.3-1.noarch.rpm
sudo rpm -ivh http://yum.postgresql.org/9.4/redhat/rhel-7-x86_64/pgdg-centos94-9.4-1.noarch.rpm
sudo rpm -ivh http://yum.postgresql.org/9.5/redhat/rhel-7-x86_64/pgdg-centos95-9.5-1.noarch.rpm
yum -y install postgresql93-server
yum -y install postgresql94-server
yum -y install postgresql95-server
# Install Perl and required modules
yum -y install perl perl-Thread-Queue perl-JSON-PP perl-Digest-SHA perl-DBD-Pg
# Setup SSH
adduser -gvagrant -n backrest
/backrest/test/vm/ssh/setup.sh
/backrest/test/vm/ssh/setup-cm.sh
SHELL
end
# Don't share the default vagrant folder
config.vm.synced_folder ".", "/vagrant", disabled: true
# Mount backrest path for testing
config.vm.synced_folder "../..", "/backrest"
end

View File

@ -1,19 +0,0 @@
# CentOS 6 Backup Container
FROM vagrant/co6-base
# Create backrest user
RUN adduser -gpostgres -u5002 -n backrest
# Setup SSH
RUN mkdir /home/backrest/.ssh
RUN cp -p /root/resource/.ssh/* /home/backrest/.ssh
RUN chown -R backrest:postgres /home/backrest
RUN chmod 700 /home/backrest/.ssh
# Setup repository
RUN mkdir /var/lib/backrest
RUN chown -R backrest:postgres /var/lib/backrest
RUN chmod 750 /var/lib/backrest
# Install Perl packages
RUN yum -y install perl perl-Time-HiRes perl-parent perl-JSON perl-Digest-SHA perl-DBD-Pg

View File

@ -1,31 +0,0 @@
# CentOS 6 Base Container
FROM centos:6.7
# Install SSH
RUN yum -y install openssh-server openssh-clients
# Create postgres user and group
RUN groupadd -g5000 postgres
RUN adduser -gpostgres -u5000 -n postgres
# Add Postgres packages
RUN rpm -ivh http://yum.postgresql.org/9.4/redhat/rhel-6-x86_64/pgdg-centos94-9.4-1.noarch.rpm
# Create vagrant user
RUN groupadd -g5001 admin
RUN adduser -gadmin -u5001 -n vagrant
# Install sudo and add admin to sudoers
RUN yum -y install sudo
RUN echo '%admin ALL=(ALL) NOPASSWD: ALL' > /etc/sudoers.d/vagrant
RUN sed -i 's/^Defaults requiretty$/\# Defaults requiretty/' /etc/sudoers
# Copy trusted SSH setup
COPY ssh/config /root/resource/.ssh/config
COPY ssh/id_rsa /root/resource/.ssh/id_rsa
COPY ssh/id_rsa.pub /root/resource/.ssh/authorized_keys
RUN chmod 700 /root/resource/.ssh
RUN chmod 600 /root/resource/.ssh/*
# Start SSH when container starts
ENTRYPOINT service sshd restart && bash

View File

@ -1,16 +0,0 @@
# CentOS 6 Database Container
FROM vagrant/co6-base
# Install Postgres
RUN yum -y install postgresql94-server
# Create pg_backrest.conf
RUN touch /etc/pg_backrest.conf
RUN chmod 640 /etc/pg_backrest.conf
RUN chown postgres:postgres /etc/pg_backrest.conf
# Setup SSH
RUN mkdir /home/postgres/.ssh
RUN cp /root/resource/.ssh/* /home/postgres/.ssh
RUN chown -R postgres:postgres /home/postgres/.ssh
RUN chmod 700 /home/postgres/.ssh

View File

@ -1,19 +0,0 @@
# Ubuntu 14.04 Backup Container
FROM vagrant/u14-base
# Create backrest user
RUN adduser --ingroup=postgres --disabled-password --gecos "" backrest
# Setup SSH
RUN mkdir -p /home/backrest/.ssh
RUN cp /root/resource/.ssh/* /home/backrest/.ssh
RUN chown -R backrest:postgres /home/backrest/.ssh
RUN chmod 700 /home/backrest/.ssh
# Setup repository
RUN mkdir /var/lib/backrest
RUN chown backrest:postgres /var/lib/backrest
RUN chmod 750 /var/lib/backrest
# Install Perl packages
RUN apt-get -y install libdbd-pg-perl libdbi-perl libnet-daemon-perl libplrpc-perl

View File

@ -1,41 +0,0 @@
# Ubuntu 14.04 Base Container
FROM ubuntu:14.04
# Get packages that make up apt-get download
# apt-get -dy install ??? --print-uris -qq | sed -n "s/'\([^ ]\+\)' \([^ ]\+\) \([^ ]\+\) MD5Sum:\([^ ]\+\)/wget -c \1/p"
# Install SSH
RUN apt-get -y install openssh-server
# Create postgres user and group
RUN groupadd -g5000 postgres
RUN adduser --ingroup=postgres --disabled-password --gecos "" postgres
# Add Postgres packages
RUN echo 'deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main 9.5' >> /etc/apt/sources.list.d/pgdg.list
RUN wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
RUN sudo apt-get update
# Create vagrant user
RUN addgroup admin
RUN adduser --ingroup=admin --disabled-password --gecos "" vagrant
RUN sed -i 's/^\%admin.*$/\%admin ALL\=\(ALL\) NOPASSWD\: ALL/' /etc/sudoers
# Suppress dpkg interactive output
RUN rm /etc/apt/apt.conf.d/70debconf
# Download Perl packages to be installed later
RUN apt-get -dy install libdbd-pg-perl libdbi-perl libnet-daemon-perl libplrpc-perl libpq5
# Download Postgres packages to be installed later
RUN apt-get -dy install postgresql-9.4
# Copy trusted SSH setup
COPY ssh/config /root/resource/.ssh/config
COPY ssh/id_rsa /root/resource/.ssh/id_rsa
COPY ssh/id_rsa.pub /root/resource/.ssh/authorized_keys
RUN chmod 700 /root/resource/.ssh
RUN chmod 600 /root/resource/.ssh/*
# Start SSH when container starts
ENTRYPOINT service ssh restart && bash

View File

@ -1,17 +0,0 @@
# Ubuntu 14.04 Database Container
FROM vagrant/u14-base
# Install Postgres
RUN apt-get install -y postgresql-9.4
RUN pg_dropcluster --stop 9.4 main
# Create pg_backrest.conf
RUN touch /etc/pg_backrest.conf
RUN chmod 640 /etc/pg_backrest.conf
RUN chown postgres:postgres /etc/pg_backrest.conf
# Setup SSH
RUN mkdir /home/postgres/.ssh
RUN cp /root/resource/.ssh/* /home/postgres/.ssh
RUN chown -R postgres:postgres /home/postgres/.ssh
RUN chmod 700 /home/postgres/.ssh

View File

@ -1,3 +0,0 @@
Host *
StrictHostKeyChecking no
LogLevel quiet

View File

@ -1,5 +0,0 @@
Host 127.0.0.1
StrictHostKeyChecking no
ControlMaster auto
ControlPath /tmp/%r@%h:%p
ControlPersist 30

View File

@ -1,27 +0,0 @@
-----BEGIN RSA PRIVATE KEY-----
MIIEpAIBAAKCAQEA7wnLw3X9YUu2xV7I+WP6mUbM/Gw4pv68/cFkoPQZJUZGol8H
MPh40vTbaWzhl+c1+Y/wv2wrKUGQfuj7h4jOl8CfRDsl870WO7YsJ3Zfzw3aMFBf
Mdnm9EnVPQUXsx1BVZ7qlXqPG3BjUVU4dI4z64PQXVeS+Jx2ImwDbosK5pZUxKh4
sFzcSMd5vrkwebT4TCBddj/cYpFUCmt4W2MB0KiyTpHOrpkAzczSlyhUlt2qeBTA
OsNS5+6Ie7BIp2NA1o5TI3VoVBSRfgViOeW5Rga+3z+R+XuqvvlP9w8/EzlpfW3N
6gGkwp+OLyujlxg2fbYscXYJL6YBkM8D0AReRwIDAQABAoIBAQCOKuNXsxsp/OAN
bxxUx1PKScOs9aiUGbnJqnXxDHzQIIXuGFqsk3s47Ix6nVlnAQqnDScAkpLxDJ+l
+2dt6r4En3maGRuvZWyNwwFrzwmYmgKE7ahQe+rSq/75NcgsrV+oTsXydVwb07Ie
M3NKTzEuB82rVmSBHH1eZ6N64ZNwJB6bjmj9rnf0NFh1sEnZDQZn9+hDjxg+rc3L
9HNhUks/1AJmZKbaaoJvLwF+ODzyDQ31NKI61OUiApwDxyAQURwJG5ZZkiUTcTyC
aXn91qH7W2LkKJyPjiwsQMTZO2DJS4jYX1G0N5CdHZ8O2ri0vZChbS8i+u2VMAWk
0fNJjrRhAoGBAP1kJsq/Ffsw+DgNzIbMw6XaIddXISIOeabwx9fN/TicnqKzGoK+
F8l5zzNa9zhOdCiO9Nv4pbepyeurkmyQS+zZJqbMfVEy7KVsHHDxcZ9voxaEpOXb
s+3VWdZoZNaqQo8aWjclc+Z+C/ggR6zQvj1rtRRXaZrFAI1Oo7VglmapAoGBAPF/
0K/Eil9ZHi8ktcJLyTJBqo89vkzzIAOgQ7O+tfmiLFSNsWaBfJmVog/0+OieW8R+
TUdlcWzNajRyrO8TJ+clkCJr2fqxkRzK0fB8esZmbOqnARKm3y/R9aMhqjKTap3H
p6PT3+arJqbAGsFoiP1LId0iiKNTekj4mWiNVuNvAoGAQOmoOmZLZkc8P3fhfmL0
eAdyhezvMv9MUOT7/R/rD9anmPyS/Q1foKCQ4RIbpRQME9vThIqlQXDAppwUbbVl
je5vRWm7bNLD5vjULGbd+b8qo3klmTD4XiQ62H9z3b5OQMS6ecghcdm2jUEPu4ja
Q3fVMrnV9u0i4BBWRf/RZ8kCgYEAxgkYKmqzRckgtWwXGINpM6shoGDzYsqkYBTW
L9meBF12mMewx+w7Lv7DbO5oBumFOzaPTJLlVmGETAoVwd8lg6kL7w4eLDPcWY4A
ZoLNc1Ce1DWq7Y6lyuMT2XhLxzmX3lbRI8kk/FUxVuCFkECWxY8M7/fXsIdN6fTi
aBgvPkUCgYBZy+fbs/ypxjitoDhrPCph48HbIWebGJb317dOTpgFvjz/8smBs9vG
t1LHuJsujUqRZvhaQ0AjFNcEUvcB5e/cDbYCGUJ5Se2PnFlip7W/eS09vyFYefsN
0JJaSowrIv3sSQPg6I39U9JU0pJEuopz21LpGEll/KOxkmhiV+qsag==
-----END RSA PRIVATE KEY-----

View File

@ -1 +0,0 @@
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDvCcvDdf1hS7bFXsj5Y/qZRsz8bDim/rz9wWSg9BklRkaiXwcw+HjS9NtpbOGX5zX5j/C/bCspQZB+6PuHiM6XwJ9EOyXzvRY7tiwndl/PDdowUF8x2eb0SdU9BRezHUFVnuqVeo8bcGNRVTh0jjPrg9BdV5L4nHYibANuiwrmllTEqHiwXNxIx3m+uTB5tPhMIF12P9xikVQKa3hbYwHQqLJOkc6umQDNzNKXKFSW3ap4FMA6w1Ln7oh7sEinY0DWjlMjdWhUFJF+BWI55blGBr7fP5H5e6q++U/3Dz8TOWl9bc3qAaTCn44vK6OXGDZ9tixxdgkvpgGQzwPQBF5H vagrant@localhost

View File

@ -1,5 +0,0 @@
#!/bin/bash
# Copy ControlMaster ssh configs when the OS supports it
cp -f /backrest/test/vm/ssh/config-cm /home/vagrant/.ssh/config
cp -f /backrest/test/vm/ssh/config-cm /home/backrest/.ssh/config

View File

@ -1,25 +0,0 @@
#!/bin/bash
# Setup backrest test user and trusted SSH access between vagrant and test users
# Copy ssh keys for vagrant user
cp /backrest/test/vm/ssh/config /home/vagrant/.ssh
cp /backrest/test/vm/ssh/id_rsa /home/vagrant/.ssh
cat /backrest/test/vm/ssh/id_rsa.pub >> /home/vagrant/.ssh/authorized_keys
chown -R vagrant:vagrant /home/vagrant/.ssh
chmod 700 /home/vagrant/.ssh
chmod 600 /home/vagrant/.ssh/*
chmod 750 /home/vagrant
# Create the backrest user and copy ssh keys
mkdir /home/backrest/.ssh
cp /backrest/test/vm/ssh/config /home/backrest/.ssh
cp /backrest/test/vm/ssh/id_rsa /home/backrest/.ssh
cp /backrest/test/vm/ssh/id_rsa.pub /home/backrest/.ssh/authorized_keys
chown -R backrest:vagrant /home/backrest/.ssh
chmod 700 /home/backrest/.ssh
chmod 600 /home/backrest/.ssh/*
# Clear any messages
sudo -u vagrant ssh backrest@127.0.0.1 ls
sudo -u backrest ssh backrest@127.0.0.1 ls