1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2024-12-14 10:13:05 +02:00
pgbackrest/test/Vagrantfile
David Steele 367e06f4be Coverage testing always enabled on Debian-based containers.
* Full coverage is verified when specified.
* Modules marked with partial coverage will error if they are actually fully covered.
* Simplified test representation is DefineTest.
* Added new representation for queries in DefineTest and added API functions.
* Update modules using DefineTest to use new API.
2017-04-10 12:31:30 -04:00

93 lines
4.6 KiB
Ruby

Vagrant.configure(2) do |config|
config.vm.provider :virtualbox do |vb|
vb.memory = 2048
vb.cpus = 8
end
config.vm.box = "ubuntu/xenial64"
config.vm.box_version = "20170311.0.0"
config.vm.provider :virtualbox do |vb|
vb.name = "pgbackrest-test"
end
# Provision the VM
config.vm.provision "shell", inline: <<-SHELL
#---------------------------------------------------------------------------------------------------------------------------
echo 'Build Begin' && date
# Suppress "dpkg-reconfigure: unable to re-open stdin: No file or directory" warning
export DEBIAN_FRONTEND=noninteractive
# Assign a host name
sed -i 's/^127\.0\.0\.1\t.*/127\.0\.0\.1\tlocalhost pgbackrest-test/' /etc/hosts
hostnamectl set-hostname pgbackrest-test
#---------------------------------------------------------------------------------------------------------------------------
echo 'Update Apt' && date
apt-get update
#---------------------------------------------------------------------------------------------------------------------------
echo 'Synchronize Date' && date
apt-get install -y ntpdate
ntpdate pool.ntp.org
#---------------------------------------------------------------------------------------------------------------------------
echo 'Install Perl Modules' && date
apt-get install -y libdbd-pg-perl libxml-checker-perl libperl-critic-perl libdevel-nytprof-perl
#---------------------------------------------------------------------------------------------------------------------------
echo 'Install Build Tools' && date
apt-get install -y devscripts build-essential lintian git txt2man debhelper
#---------------------------------------------------------------------------------------------------------------------------
echo 'Build Devel::Cover' && date
apt-get install -y libpod-coverage-perl libtest-differences-perl libhtml-parser-perl libtemplate-perl
git clone --branch debian/1.23-2 \
https://anonscm.debian.org/git/pkg-perl/packages/libdevel-cover-perl.git /root/libdevel-cover-perl
cd /root/libdevel-cover-perl && debuild --no-lintian -i -us -uc -b > /dev/null
dpkg -i /root/libdevel-cover-perl_1.23-2_amd64.deb
#---------------------------------------------------------------------------------------------------------------------------
echo 'Install Docker' && date
apt-get install -y apt-transport-https ca-certificates
apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
echo 'deb https://apt.dockerproject.org/repo ubuntu-xenial main' > /etc/apt/sources.list.d/docker.list
apt-get update
apt-get install -y linux-image-extra-$(uname -r)
apt-get install -y docker-engine
service docker start
sudo usermod -aG docker ubuntu
#---------------------------------------------------------------------------------------------------------------------------
echo 'Install Dev Utilities' && date
apt-get install -y vim htop
#---------------------------------------------------------------------------------------------------------------------------
echo 'Install TeX Live' && date
apt-get install -y --no-install-recommends texlive-latex-base texlive-latex-extra texlive-fonts-recommended
apt-get install -y texlive-font-utils
#---------------------------------------------------------------------------------------------------------------------------
echo 'Create Postgres Group & pgBackRest User' && date
groupadd -g5000 postgres
adduser --uid=5001 --ingroup=ubuntu --disabled-password --gecos "" backrest
#---------------------------------------------------------------------------------------------------------------------------
echo 'Build VM Images' && date
rm -rf /backrest/test/.vagrant/docker/*
rm -rf /backrest/test/.vagrant/libc/*
rm -rf /backrest/test/.vagrant/package/*
sudo su - ubuntu -c '/backrest/test/test.pl --vm-build'
#---------------------------------------------------------------------------------------------------------------------------
echo 'Build End' && date
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