2021-01-02 21:50:00 +01:00
|
|
|
load common
|
|
|
|
|
|
|
|
begin_borg() {
|
|
|
|
apt-get -qq install debootstrap borgbackup
|
2021-01-03 23:55:02 +01:00
|
|
|
if [ ! -d "$BN_SRCDIR" ]; then
|
|
|
|
debootstrap --variant=minbase testing "$BN_SRCDIR"
|
2021-01-02 21:50:00 +01:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
setup_borg() {
|
|
|
|
cat << EOF > "${BATS_TMPDIR}/backup.d/test.borg"
|
|
|
|
when = manual
|
|
|
|
testconnect = no
|
|
|
|
nicelevel = 0
|
|
|
|
ionicelevel =
|
|
|
|
bwlimit =
|
|
|
|
|
|
|
|
[source]
|
|
|
|
init = yes
|
2021-01-03 23:55:02 +01:00
|
|
|
include = ${BN_SRCDIR}
|
|
|
|
exclude = ${BN_SRCDIR}/var
|
2021-01-02 21:50:00 +01:00
|
|
|
create_options =
|
|
|
|
prune = yes
|
|
|
|
keep = 30d
|
|
|
|
prune_options =
|
|
|
|
cache_directory =
|
|
|
|
|
|
|
|
[dest]
|
|
|
|
user =
|
2021-01-03 23:55:02 +01:00
|
|
|
host = localhost
|
2021-01-02 21:50:00 +01:00
|
|
|
port = 22
|
2021-01-03 23:55:02 +01:00
|
|
|
directory = ${BN_BACKUPDIR}/testborg
|
2021-01-02 21:50:00 +01:00
|
|
|
archive =
|
|
|
|
compression = lz4
|
|
|
|
encryption = none
|
|
|
|
passphrase =
|
|
|
|
EOF
|
|
|
|
|
|
|
|
chmod 0640 "${BATS_TMPDIR}/backup.d/test.borg"
|
2021-01-03 23:56:13 +01:00
|
|
|
rm -rf /root/.cache/borg
|
2021-01-02 21:50:00 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
finish_borg() {
|
|
|
|
cleanup_backups local remote
|
|
|
|
rm -rf /root/.cache/borg
|
|
|
|
}
|
|
|
|
|
2021-01-05 17:56:51 +01:00
|
|
|
@test "check ssh connection test" {
|
2021-01-06 06:26:09 +01:00
|
|
|
setconfig testconnect yes
|
|
|
|
setconfig dest user $BN_REMOTEUSER
|
|
|
|
setconfig dest host $BN_REMOTEHOST
|
2021-01-06 05:48:13 +01:00
|
|
|
testaction
|
2021-01-03 23:57:03 +01:00
|
|
|
greplog "Debug: Connected to ${BN_REMOTEHOST} as ${BN_REMOTEUSER} successfully$"
|
2021-01-02 21:50:00 +01:00
|
|
|
}
|
|
|
|
|
2021-01-05 17:56:51 +01:00
|
|
|
@test "check config parameter nicelevel" {
|
2021-01-03 23:57:03 +01:00
|
|
|
# nicelevel is 0 by default
|
2021-01-06 06:26:09 +01:00
|
|
|
delconfig nicelevel
|
2021-01-06 05:48:13 +01:00
|
|
|
testaction
|
2021-01-03 23:57:03 +01:00
|
|
|
greplog 'Debug: executing borg create$' '\bnice -n 0\b'
|
|
|
|
|
|
|
|
# nicelevel is defined
|
2021-01-06 06:26:09 +01:00
|
|
|
setconfig nicelevel -19
|
2021-01-06 05:48:13 +01:00
|
|
|
testaction
|
2021-01-03 23:57:03 +01:00
|
|
|
greplog 'Debug: executing borg create$' '\bnice -n -19\b'
|
2021-01-02 21:50:00 +01:00
|
|
|
}
|
|
|
|
|
2021-01-05 17:56:51 +01:00
|
|
|
@test "check config parameter ionicelevel" {
|
2021-01-03 23:57:03 +01:00
|
|
|
# no ionice by default
|
2021-01-06 06:26:09 +01:00
|
|
|
delconfig ionicelevel
|
2021-01-06 05:48:13 +01:00
|
|
|
testaction
|
2021-01-03 23:57:03 +01:00
|
|
|
not_greplog 'Debug: executing borg create$' '\bionice -c2\b'
|
|
|
|
|
|
|
|
# acceptable value
|
2021-01-06 06:26:09 +01:00
|
|
|
setconfig ionicelevel 7
|
2021-01-06 05:48:13 +01:00
|
|
|
testaction
|
2021-01-03 23:57:03 +01:00
|
|
|
greplog 'Debug: executing borg create$' '\bionice -c2 -n 7\b'
|
|
|
|
|
|
|
|
# unacceptable value
|
2021-01-06 06:26:09 +01:00
|
|
|
setconfig ionicelevel 10
|
2021-01-06 05:48:13 +01:00
|
|
|
testaction
|
2021-01-03 23:57:03 +01:00
|
|
|
greplog 'Fatal: The value of ionicelevel is expected to be either empty or an integer from 0 to 7. Got: 10$'
|
2021-01-02 21:50:00 +01:00
|
|
|
}
|
|
|
|
|
2021-01-05 17:56:51 +01:00
|
|
|
@test "check config parameter bwlimit" {
|
2021-01-03 23:57:03 +01:00
|
|
|
# no limit by default
|
2021-01-06 06:26:09 +01:00
|
|
|
delconfig bwlimit
|
2021-01-06 05:48:13 +01:00
|
|
|
testaction
|
2021-01-03 23:57:03 +01:00
|
|
|
not_greplog 'Debug: executing borg create$' '\s--remote-ratelimit='
|
|
|
|
|
|
|
|
# limit is defined
|
2021-01-06 06:26:09 +01:00
|
|
|
setconfig bwlimit 1024
|
2021-01-06 05:48:13 +01:00
|
|
|
testaction
|
2021-01-03 23:57:03 +01:00
|
|
|
greplog 'Debug: executing borg create$' '\s--remote-ratelimit=1024\b'
|
|
|
|
|
2021-01-02 21:50:00 +01:00
|
|
|
}
|
|
|
|
|
2021-01-05 17:56:51 +01:00
|
|
|
@test "check config parameter source/init" {
|
2021-01-03 23:57:03 +01:00
|
|
|
# do repository init by default
|
2021-01-06 06:26:09 +01:00
|
|
|
delconfig source init
|
2021-01-06 05:48:13 +01:00
|
|
|
testaction
|
2021-01-03 23:57:03 +01:00
|
|
|
greplog 'Debug: executing borg init$'
|
|
|
|
|
|
|
|
# do repository init
|
2021-01-06 06:26:09 +01:00
|
|
|
setconfig source init yes
|
2021-01-06 05:48:13 +01:00
|
|
|
testaction
|
2021-01-03 23:57:03 +01:00
|
|
|
greplog 'Debug: executing borg init$'
|
|
|
|
|
|
|
|
# don't do repository init
|
2021-01-06 06:26:09 +01:00
|
|
|
setconfig source init no
|
2021-01-06 05:48:13 +01:00
|
|
|
testaction
|
2021-01-03 23:57:03 +01:00
|
|
|
not_greplog 'Debug: executing borg init$'
|
2021-01-02 21:50:00 +01:00
|
|
|
}
|
|
|
|
|
2021-01-05 17:56:51 +01:00
|
|
|
@test "check config parameter source/include" {
|
2021-01-03 23:57:03 +01:00
|
|
|
# missing path
|
2021-01-06 06:26:09 +01:00
|
|
|
delconfig source include
|
2021-01-06 05:48:13 +01:00
|
|
|
testaction
|
2021-01-03 23:57:03 +01:00
|
|
|
greplog 'Fatal: No source includes specified$'
|
|
|
|
|
|
|
|
# single path
|
2021-01-06 06:26:09 +01:00
|
|
|
setconfig source include "$BN_SRCDIR"
|
2021-01-06 05:48:13 +01:00
|
|
|
testaction
|
2021-01-03 23:57:03 +01:00
|
|
|
greplog 'Debug: executing borg create$' "'${BN_SRCDIR}'$"
|
|
|
|
|
|
|
|
# multiple paths
|
2021-01-06 06:26:09 +01:00
|
|
|
setconfig_repeat source include "$BN_SRCDIR" /foo /bar
|
2021-01-06 05:48:13 +01:00
|
|
|
testaction
|
2021-01-03 23:57:03 +01:00
|
|
|
greplog 'Debug: executing borg create$' "'${BN_SRCDIR}' '/foo' '/bar'$"
|
2021-01-02 21:50:00 +01:00
|
|
|
}
|
|
|
|
|
2021-01-05 17:56:51 +01:00
|
|
|
@test "check config parameter source/exclude" {
|
2021-01-03 23:57:03 +01:00
|
|
|
# absent path
|
2021-01-06 06:26:09 +01:00
|
|
|
delconfig source exclude
|
2021-01-06 05:48:13 +01:00
|
|
|
testaction
|
2021-01-03 23:57:03 +01:00
|
|
|
not_greplog 'Debug: executing borg create$' "\s--exclude\s"
|
|
|
|
|
|
|
|
# single path
|
2021-01-06 06:26:09 +01:00
|
|
|
setconfig source exclude "${BN_SRCDIR}/var"
|
2021-01-06 05:48:13 +01:00
|
|
|
testaction
|
2021-01-03 23:57:03 +01:00
|
|
|
greplog 'Debug: executing borg create$' "\s--exclude '${BN_SRCDIR}/var'\s"
|
|
|
|
|
|
|
|
# multiple paths
|
2021-01-06 06:26:09 +01:00
|
|
|
setconfig_repeat source exclude "$BN_SRCDIR/var" "$BN_SRCDIR/foo" "$BN_SRCDIR/bar"
|
2021-01-06 05:48:13 +01:00
|
|
|
testaction
|
2021-01-03 23:57:03 +01:00
|
|
|
greplog 'Debug: executing borg create$' "\s--exclude '${BN_SRCDIR}/var' --exclude '${BN_SRCDIR}/foo' --exclude '${BN_SRCDIR}/bar'\s"
|
2021-01-02 21:50:00 +01:00
|
|
|
}
|
|
|
|
|
2021-01-05 17:56:51 +01:00
|
|
|
@test "check config parameter source/create_options" {
|
2021-01-03 23:57:03 +01:00
|
|
|
# absent parameter
|
2021-01-06 06:26:09 +01:00
|
|
|
delconfig source create_options
|
2021-01-06 05:48:13 +01:00
|
|
|
testaction
|
2021-01-07 04:34:03 +01:00
|
|
|
greplog 'Debug: executing borg create$' "\sborg create --stats --compression lz4\s\+--exclude\s"
|
2021-01-03 23:57:03 +01:00
|
|
|
|
|
|
|
# defined parameter
|
2021-01-07 04:34:03 +01:00
|
|
|
setconfig source create_options "-x --exclude-caches"
|
2021-01-06 05:48:13 +01:00
|
|
|
testaction
|
2021-01-07 04:34:03 +01:00
|
|
|
greplog 'Debug: executing borg create$' "\s\+-x --exclude-caches\s\+"
|
2021-01-02 21:50:00 +01:00
|
|
|
}
|
|
|
|
|
2021-01-05 17:56:51 +01:00
|
|
|
@test "check config parameter source/prune" {
|
2021-01-03 23:57:03 +01:00
|
|
|
# absent parameter, defaults enabled
|
2021-01-06 06:26:09 +01:00
|
|
|
delconfig source prune
|
2021-01-06 05:48:13 +01:00
|
|
|
testaction
|
2021-01-03 23:57:03 +01:00
|
|
|
greplog 'Debug: executing borg prune$'
|
|
|
|
|
|
|
|
# defined parameter, enabled
|
2021-01-06 06:26:09 +01:00
|
|
|
setconfig source prune yes
|
2021-01-06 05:48:13 +01:00
|
|
|
testaction
|
2021-01-03 23:57:03 +01:00
|
|
|
greplog 'Debug: executing borg prune$'
|
|
|
|
|
|
|
|
# defined parameter, disabled
|
2021-01-06 06:26:09 +01:00
|
|
|
setconfig source prune no
|
2021-01-06 05:48:13 +01:00
|
|
|
testaction
|
2021-01-03 23:57:03 +01:00
|
|
|
not_greplog 'Debug: executing borg prune$'
|
2021-01-02 21:50:00 +01:00
|
|
|
}
|
|
|
|
|
2021-01-05 17:56:51 +01:00
|
|
|
@test "check config parameter source/keep" {
|
2021-01-03 23:57:03 +01:00
|
|
|
# absent parameter, defaults to '30d'
|
2021-01-06 06:26:09 +01:00
|
|
|
setconfig source prune yes
|
|
|
|
delconfig source keep
|
2021-01-06 05:48:13 +01:00
|
|
|
testaction
|
2021-01-03 23:57:03 +01:00
|
|
|
greplog 'Debug: executing borg prune$' '\s--keep-within=30d\b'
|
|
|
|
|
|
|
|
# defined parameter, set to 60d
|
2021-01-06 06:26:09 +01:00
|
|
|
setconfig source prune yes
|
|
|
|
setconfig source keep 60d
|
2021-01-06 05:48:13 +01:00
|
|
|
testaction
|
2021-01-03 23:57:03 +01:00
|
|
|
greplog 'Debug: executing borg prune$' '\s--keep-within=60d\b'
|
|
|
|
|
|
|
|
# defined parameter, disabled, set to 0
|
2021-01-06 06:26:09 +01:00
|
|
|
setconfig source prune yes
|
|
|
|
setconfig source keep 0
|
2021-01-06 05:48:13 +01:00
|
|
|
testaction
|
2021-01-03 23:57:03 +01:00
|
|
|
not_greplog 'Debug: executing borg prune$' '\s--keep-within='
|
|
|
|
}
|
|
|
|
|
2021-01-05 17:56:51 +01:00
|
|
|
@test "check config parameter source/prune_options" {
|
2021-01-03 23:57:03 +01:00
|
|
|
# absent parameter
|
2021-01-06 06:26:09 +01:00
|
|
|
delconfig source prune_options
|
2021-01-06 05:48:13 +01:00
|
|
|
testaction
|
2021-01-03 23:57:03 +01:00
|
|
|
greplog 'Debug: executing borg prune$' "Debug: borg prune --keep-within=30d ${BN_BACKUPDIR}/testborg$"
|
|
|
|
|
|
|
|
# defined parameter
|
2021-01-07 04:34:03 +01:00
|
|
|
setconfig source prune_options "--keep-daily 9 --save-space"
|
2021-01-06 05:48:13 +01:00
|
|
|
testaction
|
2021-01-07 04:34:03 +01:00
|
|
|
greplog 'Debug: executing borg prune$' "\s\+--keep-daily 9 --save-space\s\+"
|
2021-01-03 23:57:03 +01:00
|
|
|
}
|
|
|
|
|
2021-01-05 17:56:51 +01:00
|
|
|
@test "check config parameter source/cache_directory" {
|
2021-01-03 23:57:03 +01:00
|
|
|
# absent parameter
|
2021-01-06 06:26:09 +01:00
|
|
|
delconfig source cache_directory
|
2021-01-06 05:48:13 +01:00
|
|
|
testaction
|
2021-01-03 23:57:03 +01:00
|
|
|
not_greplog 'Debug: export BORG_CACHE_DIR='
|
|
|
|
|
|
|
|
# defined parameter
|
2021-01-06 06:26:09 +01:00
|
|
|
setconfig source cache_directory "/var/cache/borg"
|
2021-01-06 05:48:13 +01:00
|
|
|
testaction
|
2021-01-03 23:57:03 +01:00
|
|
|
greplog 'Debug: export BORG_CACHE_DIR="/var/cache/borg"$'
|
|
|
|
}
|
|
|
|
|
2021-01-05 17:56:51 +01:00
|
|
|
@test "check config parameter dest/user" {
|
2021-01-03 23:57:03 +01:00
|
|
|
# absent parameter
|
2021-01-06 06:26:09 +01:00
|
|
|
delconfig dest user
|
|
|
|
setconfig dest host "$BN_REMOTEHOST"
|
2021-01-06 05:48:13 +01:00
|
|
|
testaction
|
2021-01-03 23:57:03 +01:00
|
|
|
greplog 'Fatal: Destination user not set$'
|
|
|
|
|
|
|
|
# defined parameter
|
2021-01-06 06:26:09 +01:00
|
|
|
setconfig dest user "$BN_REMOTEUSER"
|
|
|
|
setconfig dest host "$BN_REMOTEHOST"
|
2021-01-06 05:48:13 +01:00
|
|
|
testaction
|
2021-01-03 23:57:03 +01:00
|
|
|
greplog "Debug: ssh -o PasswordAuthentication=no ${BN_REMOTEHOST} -p 22 -l ${BN_REMOTEUSER} 'echo -n 1'"
|
|
|
|
greplog 'Debug: executing borg create$' "\bssh://${BN_REMOTEUSER}@${BN_REMOTEHOST}:22${BN_BACKUPDIR}/testborg::"
|
|
|
|
}
|
|
|
|
|
2021-01-05 17:56:51 +01:00
|
|
|
@test "check config parameter dest/host" {
|
2021-01-03 23:57:03 +01:00
|
|
|
# absent parameter
|
2021-01-06 06:26:09 +01:00
|
|
|
delconfig dest host
|
|
|
|
setconfig dest user "$BN_REMOTEUSER"
|
2021-01-06 05:48:13 +01:00
|
|
|
testaction
|
2021-01-03 23:57:03 +01:00
|
|
|
greplog 'Fatal: Destination host not set$'
|
|
|
|
|
|
|
|
# defined parameter
|
2021-01-06 06:26:09 +01:00
|
|
|
setconfig dest user "$BN_REMOTEUSER"
|
|
|
|
setconfig dest host "$BN_REMOTEHOST"
|
2021-01-06 05:48:13 +01:00
|
|
|
testaction
|
2021-01-03 23:57:03 +01:00
|
|
|
greplog "Debug: ssh -o PasswordAuthentication=no ${BN_REMOTEHOST} -p 22 -l ${BN_REMOTEUSER} 'echo -n 1'"
|
|
|
|
greplog 'Debug: executing borg create$' "\bssh://${BN_REMOTEUSER}@${BN_REMOTEHOST}:22${BN_BACKUPDIR}/testborg::"
|
|
|
|
}
|
|
|
|
|
2021-01-05 17:56:51 +01:00
|
|
|
@test "check config parameter dest/port" {
|
2021-01-03 23:57:03 +01:00
|
|
|
# absent parameter, defaults to 22
|
2021-01-06 06:26:09 +01:00
|
|
|
setconfig dest user "$BN_REMOTEUSER"
|
|
|
|
setconfig dest host "$BN_REMOTEHOST"
|
|
|
|
delconfig dest port
|
2021-01-06 05:48:13 +01:00
|
|
|
testaction
|
2021-01-03 23:57:03 +01:00
|
|
|
greplog "Debug: ssh -o PasswordAuthentication=no ${BN_REMOTEHOST} -p 22 -l ${BN_REMOTEUSER} 'echo -n 1'"
|
|
|
|
greplog 'Debug: executing borg create$' "\bssh://${BN_REMOTEUSER}@${BN_REMOTEHOST}:22${BN_BACKUPDIR}/testborg::"
|
|
|
|
|
|
|
|
# defined parameter
|
2021-01-06 06:26:09 +01:00
|
|
|
setconfig dest port 7722
|
|
|
|
setconfig dest user "$BN_REMOTEUSER"
|
|
|
|
setconfig dest host "$BN_REMOTEHOST"
|
2021-01-06 05:48:13 +01:00
|
|
|
testaction
|
2021-01-03 23:57:03 +01:00
|
|
|
greplog "Debug: ssh -o PasswordAuthentication=no ${BN_REMOTEHOST} -p 7722 -l ${BN_REMOTEUSER} 'echo -n 1'"
|
|
|
|
greplog 'Debug: executing borg create$' "\bssh://${BN_REMOTEUSER}@${BN_REMOTEHOST}:7722${BN_BACKUPDIR}/testborg::"
|
|
|
|
}
|
|
|
|
|
2021-01-05 17:56:51 +01:00
|
|
|
@test "check config parameter dest/directory" {
|
2021-01-03 23:57:03 +01:00
|
|
|
# absent parameter
|
2021-01-06 06:26:09 +01:00
|
|
|
delconfig dest directory
|
2021-01-06 05:48:13 +01:00
|
|
|
testaction
|
2021-01-03 23:57:03 +01:00
|
|
|
greplog 'Fatal: Destination directory not set$'
|
|
|
|
|
|
|
|
# defined parameter
|
2021-01-06 06:26:09 +01:00
|
|
|
setconfig dest directory "${BN_BACKUPDIR}/testborg"
|
2021-01-06 05:48:13 +01:00
|
|
|
testaction
|
2021-01-03 23:57:03 +01:00
|
|
|
greplog 'Debug: executing borg create$' "\s${BN_BACKUPDIR}/testborg::"
|
|
|
|
}
|
|
|
|
|
2021-01-05 17:56:51 +01:00
|
|
|
@test "check config parameter dest/archive" {
|
2021-01-03 23:57:03 +01:00
|
|
|
# absent parameter, defaults to {now:%Y-%m-%dT%H:%M:%S}
|
2021-01-06 06:26:09 +01:00
|
|
|
delconfig dest archive
|
2021-01-06 05:48:13 +01:00
|
|
|
testaction
|
2021-01-03 23:57:03 +01:00
|
|
|
greplog 'Debug: executing borg create$' "\s${BN_BACKUPDIR}/testborg::{now:%Y-%m-%dT%H:%M:%S}"
|
|
|
|
|
|
|
|
# defined parameter
|
2021-01-06 06:26:09 +01:00
|
|
|
setconfig dest archive foo
|
2021-01-06 05:48:13 +01:00
|
|
|
testaction
|
2021-01-03 23:57:03 +01:00
|
|
|
greplog 'Debug: executing borg create$' "\s${BN_BACKUPDIR}/testborg::foo"
|
|
|
|
}
|
|
|
|
|
2021-01-05 17:56:51 +01:00
|
|
|
@test "check config parameter dest/compression" {
|
2021-01-03 23:57:03 +01:00
|
|
|
# absent parameter, defaults to lz4
|
2021-01-06 06:26:09 +01:00
|
|
|
delconfig dest compression
|
2021-01-06 05:48:13 +01:00
|
|
|
testaction
|
2021-01-03 23:57:03 +01:00
|
|
|
greplog 'Debug: executing borg create$' "\s--compression lz4\b"
|
|
|
|
|
|
|
|
# defined parameter
|
2021-01-06 06:26:09 +01:00
|
|
|
setconfig dest compression auto,zstd,13
|
2021-01-06 05:48:13 +01:00
|
|
|
testaction
|
2021-01-03 23:57:03 +01:00
|
|
|
greplog 'Debug: executing borg create$' "\s--compression auto,zstd,13\b"
|
|
|
|
}
|
|
|
|
|
2021-01-05 17:56:51 +01:00
|
|
|
@test "create local backup without encryption" {
|
2021-01-04 04:36:14 +01:00
|
|
|
# no encryption, no passphrase
|
2021-01-06 06:26:09 +01:00
|
|
|
setconfig dest archive testarchive
|
|
|
|
setconfig dest encryption none
|
|
|
|
delconfig dest passphrase
|
2021-01-03 23:57:03 +01:00
|
|
|
cleanup_backups local
|
2021-01-06 05:48:13 +01:00
|
|
|
runaction
|
2021-01-04 04:36:14 +01:00
|
|
|
greplog 'Debug: executing borg init$' 'Debug: borg init --encryption=none'
|
2021-01-03 23:57:03 +01:00
|
|
|
greplog "Warning: Repository has been initialized"
|
2021-01-05 17:56:51 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@test "verify local backup without encryption" {
|
2021-01-03 23:57:03 +01:00
|
|
|
unset BORG_PASSPHRASE
|
2021-01-04 04:36:14 +01:00
|
|
|
borg extract --dry-run "${BN_BACKUPDIR}/testborg::testarchive"
|
|
|
|
}
|
2021-01-03 23:57:03 +01:00
|
|
|
|
2021-01-05 17:56:51 +01:00
|
|
|
@test "create local backup with encryption" {
|
2021-01-04 04:36:14 +01:00
|
|
|
# encryption enabled, wrong passphrase
|
2021-01-06 06:26:09 +01:00
|
|
|
setconfig dest archive testarchive
|
|
|
|
setconfig dest encryption repokey
|
|
|
|
setconfig dest passphrase 123test
|
2021-01-03 23:57:03 +01:00
|
|
|
cleanup_backups local
|
2021-01-06 05:48:13 +01:00
|
|
|
runaction
|
2021-01-04 04:36:14 +01:00
|
|
|
greplog 'Debug: executing borg init$' 'Debug: borg init --encryption=repokey'
|
2021-01-03 23:57:03 +01:00
|
|
|
greplog "Warning: Repository has been initialized"
|
2021-01-05 17:57:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@test "verify local backup with encryption" {
|
2021-01-04 04:36:14 +01:00
|
|
|
export BORG_PASSPHRASE="123foo"
|
|
|
|
run borg extract --dry-run "${BN_BACKUPDIR}/testborg::testarchive"
|
|
|
|
[ "$status" -eq 2 ]
|
2021-01-03 23:57:03 +01:00
|
|
|
export BORG_PASSPHRASE="123test"
|
2021-01-04 04:36:14 +01:00
|
|
|
borg extract --dry-run "${BN_BACKUPDIR}/testborg::testarchive"
|
2021-01-03 23:57:03 +01:00
|
|
|
}
|
|
|
|
|
2021-01-05 17:56:51 +01:00
|
|
|
@test "create remote backup with encryption" {
|
2021-01-06 06:26:09 +01:00
|
|
|
setconfig dest archive testarchive
|
|
|
|
setconfig dest encryption repokey
|
|
|
|
setconfig dest passphrase 123test
|
|
|
|
setconfig dest host "${BN_REMOTEHOST}"
|
|
|
|
setconfig dest user "${BN_REMOTEUSER}"
|
2021-01-04 04:36:14 +01:00
|
|
|
cleanup_backups remote
|
2021-01-06 05:48:13 +01:00
|
|
|
runaction
|
2021-01-04 04:36:14 +01:00
|
|
|
greplog 'Debug: executing borg init$' 'Debug: borg init --encryption=repokey'
|
2021-01-03 23:57:03 +01:00
|
|
|
greplog "Warning: Repository has been initialized"
|
2021-01-05 17:57:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@test "verify remote backup with encryption" {
|
2021-01-04 04:36:14 +01:00
|
|
|
export BORG_PASSPHRASE="123foo"
|
|
|
|
run borg extract --dry-run "ssh://${BN_REMOTEUSER}@${BN_REMOTEHOST}:22${BN_BACKUPDIR}/testborg::testarchive"
|
|
|
|
[ "$status" -eq 2 ]
|
|
|
|
export BORG_PASSPHRASE="123test"
|
|
|
|
borg extract --dry-run "ssh://${BN_REMOTEUSER}@${BN_REMOTEHOST}:22${BN_BACKUPDIR}/testborg::testarchive"
|
2021-01-02 21:50:00 +01:00
|
|
|
}
|