tests: Drop using /tmp/backups as destination dir

Instead use /var/backups for both local and remote backups to simplify
things.
This commit is contained in:
Jerome Charaoui 2020-12-31 18:54:47 -05:00
parent ba9fec26cb
commit bd25f93c91
3 changed files with 18 additions and 13 deletions

7
Vagrantfile vendored
View File

@ -23,10 +23,8 @@ Vagrant.configure("2") do |config|
apt-get install -y borgbackup duplicity rdiff-backup restic rsync
sed -i 's/^PasswordAuthentication no/PasswordAuthentication yes/' /etc/ssh/sshd_config
systemctl reload sshd
mkdir /tmp/backups
mount -t tmpfs tmpfs /tmp/backups
chown vagrant: /tmp/backups
echo -e "vagrant\nvagrant" | passwd vagrant
chown vagrant: /var/backups
SHELL
end
@ -45,9 +43,6 @@ Vagrant.configure("2") do |config|
./configure --prefix=/usr --mandir=/usr/share/man --sysconfdir=/etc --localstatedir=/var --libdir=/usr/lib --libexecdir=/usr/lib
make
make install
mkdir /tmp/backups
mount -t tmpfs tmpfs /tmp/backups
chown vagrant: /tmp/backups
mkdir -p /root/.ssh
yes y | ssh-keygen -t ed25519 -f /root/.ssh/id_ed25519 -N ''
echo "StrictHostKeyChecking accept-new" >> /root/.ssh/config

View File

@ -80,3 +80,17 @@ setconfig() {
crudini --set "${BATS_TMPDIR}/$1" $2 $3 "$4"
fi
}
remote_command() {
ssh vagrant@bntest1 "$1"
}
cleanup_backups() {
umount /var/backups
mount -t tmpfs tmpfs /var/backups
}
cleanup_remote_backups() {
remote_command "sudo umount /var/backups"
remote_command "sudo mount -t tmpfs tmpfs /var/backups"
}

View File

@ -5,10 +5,6 @@ begin_rdiff() {
if [ ! -d /var/cache/bntest ]; then
debootstrap --variant=minbase testing /var/cache/bntest
fi
if [ ! -d /tmp/backups ]; then
mkdir /tmp/backups
mount -t tmpfs tmpfs /tmp/backups
fi
}
setup_rdiff() {
@ -31,7 +27,7 @@ exclude = /var/cache/bntest/var
[dest]
type = local
directory = /tmp/backups
directory = /var/backups
host =
user =
sshoptions = -4
@ -41,8 +37,8 @@ EOF
}
finish_rdiff() {
rm -rf /tmp/backups/rdifftest
ssh vagrant@bntest1 "rm -rf /tmp/backups/rdifftest"
rm -rf /var/backups/rdifftest
ssh vagrant@bntest1 "rm -rf /var/backups/rdifftest"
}
@test "local source/dest backup action runs without errors" {