tests: improve testaction and runaction

Auto-find test component/file and check status code.
This commit is contained in:
Jerome Charaoui 2021-01-05 23:48:13 -05:00
parent 5bc6b9c1b5
commit 20ea06b603
3 changed files with 106 additions and 183 deletions

View File

@ -49,56 +49,48 @@ finish_borg() {
setconfig backup.d/test.borg testconnect yes
setconfig backup.d/test.borg dest user $BN_REMOTEUSER
setconfig backup.d/test.borg dest host $BN_REMOTEHOST
testaction test.borg
[ "$status" -eq 0 ]
testaction
greplog "Debug: Connected to ${BN_REMOTEHOST} as ${BN_REMOTEUSER} successfully$"
}
@test "check config parameter nicelevel" {
# nicelevel is 0 by default
delconfig backup.d/test.borg nicelevel
testaction test.borg
[ "$status" -eq 0 ]
testaction
greplog 'Debug: executing borg create$' '\bnice -n 0\b'
# nicelevel is defined
setconfig backup.d/test.borg nicelevel -19
testaction test.borg
[ "$status" -eq 0 ]
testaction
greplog 'Debug: executing borg create$' '\bnice -n -19\b'
}
@test "check config parameter ionicelevel" {
# no ionice by default
delconfig backup.d/test.borg ionicelevel
testaction test.borg
[ "$status" -eq 0 ]
testaction
not_greplog 'Debug: executing borg create$' '\bionice -c2\b'
# acceptable value
setconfig backup.d/test.borg ionicelevel 7
testaction test.borg
[ "$status" -eq 0 ]
testaction
greplog 'Debug: executing borg create$' '\bionice -c2 -n 7\b'
# unacceptable value
setconfig backup.d/test.borg ionicelevel 10
testaction test.borg
[ "$status" -eq 0 ]
testaction
greplog 'Fatal: The value of ionicelevel is expected to be either empty or an integer from 0 to 7. Got: 10$'
}
@test "check config parameter bwlimit" {
# no limit by default
delconfig backup.d/test.borg bwlimit
testaction test.borg
[ "$status" -eq 0 ]
testaction
not_greplog 'Debug: executing borg create$' '\s--remote-ratelimit='
# limit is defined
setconfig backup.d/test.borg bwlimit 1024
testaction test.borg
[ "$status" -eq 0 ]
testaction
greplog 'Debug: executing borg create$' '\s--remote-ratelimit=1024\b'
}
@ -106,95 +98,81 @@ finish_borg() {
@test "check config parameter source/init" {
# do repository init by default
delconfig backup.d/test.borg source init
testaction test.borg
[ "$status" -eq 0 ]
testaction
greplog 'Debug: executing borg init$'
# do repository init
setconfig backup.d/test.borg source init yes
testaction test.borg
[ "$status" -eq 0 ]
testaction
greplog 'Debug: executing borg init$'
# don't do repository init
setconfig backup.d/test.borg source init no
testaction test.borg
[ "$status" -eq 0 ]
testaction
not_greplog 'Debug: executing borg init$'
}
@test "check config parameter source/include" {
# missing path
delconfig backup.d/test.borg source include
testaction test.borg
[ "$status" -eq 0 ]
testaction
greplog 'Fatal: No source includes specified$'
# single path
setconfig backup.d/test.borg source include "$BN_SRCDIR"
testaction test.borg
[ "$status" -eq 0 ]
testaction
greplog 'Debug: executing borg create$' "'${BN_SRCDIR}'$"
# multiple paths
setconfig_repeat backup.d/test.borg source include "$BN_SRCDIR" /foo /bar
testaction test.borg
[ "$status" -eq 0 ]
testaction
greplog 'Debug: executing borg create$' "'${BN_SRCDIR}' '/foo' '/bar'$"
}
@test "check config parameter source/exclude" {
# absent path
delconfig backup.d/test.borg source exclude
testaction test.borg
[ "$status" -eq 0 ]
testaction
not_greplog 'Debug: executing borg create$' "\s--exclude\s"
# single path
setconfig backup.d/test.borg source exclude "${BN_SRCDIR}/var"
testaction test.borg
[ "$status" -eq 0 ]
testaction
greplog 'Debug: executing borg create$' "\s--exclude '${BN_SRCDIR}/var'\s"
# multiple paths
setconfig_repeat backup.d/test.borg source exclude "$BN_SRCDIR/var" "$BN_SRCDIR/foo" "$BN_SRCDIR/bar"
testaction test.borg
[ "$status" -eq 0 ]
testaction
greplog 'Debug: executing borg create$' "\s--exclude '${BN_SRCDIR}/var' --exclude '${BN_SRCDIR}/foo' --exclude '${BN_SRCDIR}/bar'\s"
}
@test "check config parameter source/create_options" {
# absent parameter
delconfig backup.d/test.borg source create_options
testaction test.borg
[ "$status" -eq 0 ]
testaction
not_greplog 'Debug: executing borg create$' "\s--create-options\s"
# defined parameter
setconfig backup.d/test.borg source create_options "--exclude-caches"
testaction test.borg
[ "$status" -eq 0 ]
testaction
greplog 'Debug: executing borg create$' "\s--exclude-caches\b"
}
@test "check config parameter source/prune" {
# absent parameter, defaults enabled
delconfig backup.d/test.borg source prune
testaction test.borg
[ "$status" -eq 0 ]
testaction
greplog 'Debug: executing borg prune$'
# defined parameter, enabled
setconfig backup.d/test.borg source prune yes
testaction test.borg
[ "$status" -eq 0 ]
testaction
greplog 'Debug: executing borg prune$'
# defined parameter, disabled
setconfig backup.d/test.borg source prune no
cat "${BATS_TMPDIR}/backup.d/test.borg"
testaction test.borg
[ "$status" -eq 0 ]
testaction
not_greplog 'Debug: executing borg prune$'
}
@ -202,51 +180,44 @@ finish_borg() {
# absent parameter, defaults to '30d'
setconfig backup.d/test.borg source prune yes
delconfig backup.d/test.borg source keep
testaction test.borg
[ "$status" -eq 0 ]
testaction
greplog 'Debug: executing borg prune$' '\s--keep-within=30d\b'
# defined parameter, set to 60d
setconfig backup.d/test.borg source prune yes
setconfig backup.d/test.borg source keep 60d
testaction test.borg
[ "$status" -eq 0 ]
testaction
greplog 'Debug: executing borg prune$' '\s--keep-within=60d\b'
# defined parameter, disabled, set to 0
setconfig backup.d/test.borg source prune yes
setconfig backup.d/test.borg source keep 0
cat "${BATS_TMPDIR}/backup.d/test.borg"
testaction test.borg
[ "$status" -eq 0 ]
testaction
not_greplog 'Debug: executing borg prune$' '\s--keep-within='
}
@test "check config parameter source/prune_options" {
# absent parameter
delconfig backup.d/test.borg source prune_options
testaction test.borg
[ "$status" -eq 0 ]
testaction
greplog 'Debug: executing borg prune$' "Debug: borg prune --keep-within=30d ${BN_BACKUPDIR}/testborg$"
# defined parameter
setconfig backup.d/test.borg source prune_options "--save-space"
testaction test.borg
[ "$status" -eq 0 ]
testaction
greplog 'Debug: executing borg prune$' '\s--save-space\b'
}
@test "check config parameter source/cache_directory" {
# absent parameter
delconfig backup.d/test.borg source cache_directory
testaction test.borg
[ "$status" -eq 0 ]
testaction
not_greplog 'Debug: export BORG_CACHE_DIR='
# defined parameter
setconfig backup.d/test.borg source cache_directory "/var/cache/borg"
testaction test.borg
[ "$status" -eq 0 ]
testaction
greplog 'Debug: export BORG_CACHE_DIR="/var/cache/borg"$'
}
@ -254,15 +225,13 @@ finish_borg() {
# absent parameter
delconfig backup.d/test.borg dest user
setconfig backup.d/test.borg dest host "$BN_REMOTEHOST"
testaction test.borg
[ "$status" -eq 0 ]
testaction
greplog 'Fatal: Destination user not set$'
# defined parameter
setconfig backup.d/test.borg dest user "$BN_REMOTEUSER"
setconfig backup.d/test.borg dest host "$BN_REMOTEHOST"
testaction test.borg
[ "$status" -eq 0 ]
testaction
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::"
}
@ -271,15 +240,13 @@ finish_borg() {
# absent parameter
delconfig backup.d/test.borg dest host
setconfig backup.d/test.borg dest user "$BN_REMOTEUSER"
testaction test.borg
[ "$status" -eq 0 ]
testaction
greplog 'Fatal: Destination host not set$'
# defined parameter
setconfig backup.d/test.borg dest user "$BN_REMOTEUSER"
setconfig backup.d/test.borg dest host "$BN_REMOTEHOST"
testaction test.borg
[ "$status" -eq 0 ]
testaction
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::"
}
@ -289,8 +256,7 @@ finish_borg() {
setconfig backup.d/test.borg dest user "$BN_REMOTEUSER"
setconfig backup.d/test.borg dest host "$BN_REMOTEHOST"
delconfig backup.d/test.borg dest port
testaction test.borg
[ "$status" -eq 0 ]
testaction
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::"
@ -298,8 +264,7 @@ finish_borg() {
setconfig backup.d/test.borg dest port 7722
setconfig backup.d/test.borg dest user "$BN_REMOTEUSER"
setconfig backup.d/test.borg dest host "$BN_REMOTEHOST"
testaction test.borg
[ "$status" -eq 0 ]
testaction
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::"
}
@ -307,42 +272,36 @@ finish_borg() {
@test "check config parameter dest/directory" {
# absent parameter
delconfig backup.d/test.borg dest directory
testaction test.borg
[ "$status" -eq 0 ]
testaction
greplog 'Fatal: Destination directory not set$'
# defined parameter
setconfig backup.d/test.borg dest directory "${BN_BACKUPDIR}/testborg"
testaction test.borg
[ "$status" -eq 0 ]
testaction
greplog 'Debug: executing borg create$' "\s${BN_BACKUPDIR}/testborg::"
}
@test "check config parameter dest/archive" {
# absent parameter, defaults to {now:%Y-%m-%dT%H:%M:%S}
delconfig backup.d/test.borg dest archive
testaction test.borg
[ "$status" -eq 0 ]
testaction
greplog 'Debug: executing borg create$' "\s${BN_BACKUPDIR}/testborg::{now:%Y-%m-%dT%H:%M:%S}"
# defined parameter
setconfig backup.d/test.borg dest archive foo
testaction test.borg
[ "$status" -eq 0 ]
testaction
greplog 'Debug: executing borg create$' "\s${BN_BACKUPDIR}/testborg::foo"
}
@test "check config parameter dest/compression" {
# absent parameter, defaults to lz4
delconfig backup.d/test.borg dest compression
testaction test.borg
[ "$status" -eq 0 ]
testaction
greplog 'Debug: executing borg create$' "\s--compression lz4\b"
# defined parameter
setconfig backup.d/test.borg dest compression auto,zstd,13
testaction test.borg
[ "$status" -eq 0 ]
testaction
greplog 'Debug: executing borg create$' "\s--compression auto,zstd,13\b"
}
@ -352,8 +311,7 @@ finish_borg() {
setconfig backup.d/test.borg dest encryption none
delconfig backup.d/test.borg dest passphrase
cleanup_backups local
runaction test.borg
[ "$status" -eq 0 ]
runaction
greplog 'Debug: executing borg init$' 'Debug: borg init --encryption=none'
greplog "Warning: Repository has been initialized"
}
@ -370,8 +328,7 @@ finish_borg() {
setconfig backup.d/test.borg dest encryption repokey
setconfig backup.d/test.borg dest passphrase 123test
cleanup_backups local
runaction test.borg
[ "$status" -eq 0 ]
runaction
greplog 'Debug: executing borg init$' 'Debug: borg init --encryption=repokey'
greplog "Warning: Repository has been initialized"
}
@ -391,8 +348,7 @@ finish_borg() {
setconfig backup.d/test.borg dest host "${BN_REMOTEHOST}"
setconfig backup.d/test.borg dest user "${BN_REMOTEUSER}"
cleanup_backups remote
runaction test.borg
[ "$status" -eq 0 ]
runaction
greplog 'Debug: executing borg init$' 'Debug: borg init --encryption=repokey'
greplog "Warning: Repository has been initialized"
}

View File

@ -139,24 +139,33 @@ cleanup_backups() {
# run backupninja action, removing previous log file if exists
runaction() {
if [ -f "${BATS_TMPDIR}/backup.d/${1}" ]; then
[ -f "${BATS_TMPDIR}/log/backupninja.log" ] && rm -f "${BATS_TMPDIR}/log/backupninja.log"
run backupninja -f "${BATS_TMPDIR}/backupninja.conf" --now --run "${BATS_TMPDIR}/backup.d/${1}"
# enable test mode?
if [ "$1" == "test" ]; then
local TEST="--test"
shift
else
echo "action file not found: ${BATS_TMPDIR}/backup.d/${1}"
local TEST=""
fi
# get component
if [ -n "$1" ]; then
local ACTIONFILE="$1"
else
local ACTIONFILE="test.$(basename -s .bats "${BATS_TEST_FILENAME}")"
fi
# run action
if [ -f "${BATS_TMPDIR}/backup.d/${ACTIONFILE}" ]; then
[ -f "${BATS_TMPDIR}/log/backupninja.log" ] && rm -f "${BATS_TMPDIR}/log/backupninja.log"
run backupninja -f "${BATS_TMPDIR}/backupninja.conf" $TEST --debug --now --run "${BATS_TMPDIR}/backup.d/${ACTIONFILE}"
[ "$status" -eq 0 ]
else
echo "action file not found: ${BATS_TMPDIR}/backup.d/${ACTIONFILE}"
false
fi
}
# run backupninja action in test mode, removing previous log file if exist
testaction() {
if [ -f "${BATS_TMPDIR}/backup.d/${1}" ]; then
[ -f "${BATS_TMPDIR}/log/backupninja.log" ] && rm -f "${BATS_TMPDIR}/log/backupninja.log"
run backupninja -f "${BATS_TMPDIR}/backupninja.conf" --now --test --run "${BATS_TMPDIR}/backup.d/${1}"
else
echo "action file not found: ${BATS_TMPDIR}/backup.d/${1}"
false
fi
runaction test "$1"
}
# grep the backupninja log

View File

@ -67,163 +67,139 @@ finish_dup() {
setconfig backup.d/test.dup dest destuser $BN_REMOTEUSER
setconfig backup.d/test.dup dest desthost $BN_REMOTEHOST
delconfig backup.d/test.dup dest desturl
testaction test.dup
[ "$status" -eq 0 ]
testaction
greplog "Debug: Connected to ${BN_REMOTEHOST} as ${BN_REMOTEUSER} successfully$"
}
@test "check config parameter nicelevel" {
# nicelevel is 0 by default
delconfig backup.d/test.dup nicelevel
testaction test.dup
[ "$status" -eq 0 ]
testaction
greplog 'Debug: executing duplicity$' '\bnice -n 0\b'
# nicelevel is defined
setconfig backup.d/test.dup nicelevel -19
testaction test.dup
[ "$status" -eq 0 ]
testaction
greplog 'Debug: executing duplicity$' '\bnice -n -19\b'
}
@test "check config parameter ionicelevel" {
# no ionice by default
delconfig backup.d/test.dup ionicelevel
testaction test.dup
[ "$status" -eq 0 ]
testaction
not_greplog 'Debug: executing duplicity$' '\bionice -c2\b'
# acceptable value
setconfig backup.d/test.dup ionicelevel 7
testaction test.dup
[ "$status" -eq 0 ]
testaction
greplog 'Debug: executing duplicity$' '\bionice -c2 -n 7\b'
# unacceptable value
setconfig backup.d/test.dup ionicelevel 10
testaction test.dup
[ "$status" -eq 0 ]
testaction
greplog 'Fatal: The value of ionicelevel is expected to be either empty or an integer from 0 to 7. Got: 10$'
}
@test "check config parameter options" {
setconfig backup.d/test.dup options "--verbosity 8"
testaction test.dup
[ "$status" -eq 0 ]
testaction
greplog 'Debug: executing duplicity$' '\s--verbosity 8\b'
}
@test "check config parameter tmpdir" {
# tmpdir undefined
delconfig backup.d/test.dup tmpdir
testaction test.dup
[ "$status" -eq 0 ]
testaction
not_greplog 'Debug: executing duplicity$' '\s--tmpdir\b'
# tmpdir defined
setconfig backup.d/test.dup tmpdir /tmp
testaction test.dup
[ "$status" -eq 0 ]
testaction
not_greplog 'Debug: executing duplicity$' '\s--tmpdir /tmp\b'
}
@test "check config parameter source/include" {
# missing path
delconfig backup.d/test.dup source include
testaction test.dup
[ "$status" -eq 0 ]
testaction
greplog 'Fatal: No source includes specified.$'
# single path
setconfig backup.d/test.dup source include "$BN_SRCDIR"
testaction test.dup
[ "$status" -eq 0 ]
testaction
greplog 'Debug: executing duplicity$' "\s--include '${BN_SRCDIR}'"
# multiple paths
setconfig_repeat backup.d/test.dup source include "$BN_SRCDIR" /foo /bar
testaction test.dup
[ "$status" -eq 0 ]
testaction
greplog 'Debug: executing duplicity$' "\s--include '${BN_SRCDIR}' --include '/foo' --include '/bar'\s"
}
@test "check config parameter source/exclude" {
# absent path
delconfig backup.d/test.dup source exclude
testaction test.dup
[ "$status" -eq 0 ]
testaction
greplog 'Debug: executing duplicity$' "\s--include '${BN_SRCDIR}' --exclude '\*\*' /\s"
# single path
setconfig backup.d/test.dup source exclude "${BN_SRCDIR}/var"
testaction test.dup
[ "$status" -eq 0 ]
testaction
greplog 'Debug: executing duplicity$' "\s--exclude '${BN_SRCDIR}/var'\s"
# multiple paths
setconfig_repeat backup.d/test.dup source exclude "$BN_SRCDIR/var" "$BN_SRCDIR/foo" "$BN_SRCDIR/bar"
testaction test.dup
[ "$status" -eq 0 ]
testaction
greplog 'Debug: executing duplicity$' "\s--exclude '${BN_SRCDIR}/var' --exclude '${BN_SRCDIR}/foo' --exclude '${BN_SRCDIR}/bar'\s"
}
@test "check config parameter dest/incremental" {
# absent parameter, defaults to yes
delconfig backup.d/test.dup dest incremental
testaction test.dup
[ "$status" -eq 0 ]
testaction
greplog 'Debug: executing duplicity$' 'Debug: nice -n 0 LC_ALL=C duplicity --no-print-statistics'
# defined, set to yes
setconfig backup.d/test.dup dest incremental yes
testaction test.dup
[ "$status" -eq 0 ]
testaction
greplog 'Debug: executing duplicity$' 'Debug: nice -n 0 LC_ALL=C duplicity --no-print-statistics'
# defined, set to no
setconfig backup.d/test.dup dest incremental no
testaction test.dup
[ "$status" -eq 0 ]
testaction
greplog 'Debug: executing duplicity$' 'Debug: nice -n 0 LC_ALL=C duplicity full --no-print-statistics'
}
@test "check config parameter dest/increments" {
# absent parameter, defaults to 30
delconfig backup.d/test.dup dest increments
testaction test.dup
[ "$status" -eq 0 ]
testaction
greplog 'Debug: executing duplicity$' '\s--full-if-older-than 30D\b'
# defined, set to 60
setconfig backup.d/test.dup dest increments 60
testaction test.dup
[ "$status" -eq 0 ]
testaction
greplog 'Debug: executing duplicity$' '\s--full-if-older-than 60D\b'
# defined, set to keep
setconfig backup.d/test.dup dest increments keep
testaction test.dup
[ "$status" -eq 0 ]
testaction
not_greplog 'Debug: executing duplicity$' '\s--full-if-older-than\s'
}
@test "check config parameter dest/keep" {
# absent parameter, defaults to 60
delconfig backup.d/test.dup dest keep
testaction test.dup
[ "$status" -eq 0 ]
testaction
greplog 'Debug: executing duplicity remove-older-than$' '\sduplicity remove-older-than 60D\b'
# defined, set to 180
setconfig backup.d/test.dup dest keep 180
testaction test.dup
[ "$status" -eq 0 ]
testaction
greplog 'Debug: executing duplicity remove-older-than$' '\sduplicity remove-older-than 180D\b'
# defined, set to yes
setconfig backup.d/test.dup dest keep yes
testaction test.dup
[ "$status" -eq 0 ]
testaction
not_greplog 'Debug: executing duplicity remove-older-than$'
}
@ -231,22 +207,19 @@ finish_dup() {
# absent parameter, defaults to all
setconfig backup.d/test.dup dest keep 30
delconfig backup.d/test.dup dest keepincroffulls
testaction test.dup
[ "$status" -eq 0 ]
testaction
not_greplog 'Debug: executing duplicity remove-all-inc-of-but-n-full$'
# defined, set to 1
setconfig backup.d/test.dup dest keep 30
setconfig backup.d/test.dup dest keepincroffulls 1
testaction test.dup
[ "$status" -eq 0 ]
testaction
greplog 'Debug: executing duplicity remove-all-inc-of-but-n-full$' '\sduplicity remove-all-inc-of-but-n-full 1\b'
# defined, set to all
setconfig backup.d/test.dup dest keep 30
setconfig backup.d/test.dup dest keepincroffulls all
testaction test.dup
[ "$status" -eq 0 ]
testaction
not_greplog 'Debug: executing duplicity remove-all-inc-of-but-n-full$'
}
@ -289,37 +262,32 @@ finish_dup() {
@test "check config parameter dest/sshoptions" {
# undefined
delconfig backup.d/test.dup dest sshoptions
testaction test.dup
[ "$status" -eq 0 ]
testaction
greplog 'Debug: executing duplicity$' "\s--ssh-options ''\s"
# defined
setconfig backup.d/test.dup dest sshoptions "-oIdentityFile=/root/.ssh/id_rsa"
testaction test.dup
[ "$status" -eq 0 ]
testaction
greplog 'Debug: executing duplicity$' "\s--ssh-options '-oIdentityFile=/root/.ssh/id_rsa'\s"
}
@test "check config parameter dest/bandwidthlimit" {
# undefined, disabled by default
delconfig backup.d/test.dup dest bandwidthlimit
testaction test.dup
[ "$status" -eq 0 ]
testaction
not_greplog "\btrickle -s\b"
# defined, set to 250, local file path
setconfig backup.d/test.dup dest bandwidthlimit 250
setconfig backup.d/test.dup dest desturl "file://${BN_BACKUPDIR}/testdup"
testaction test.dup
[ "$status" -eq 0 ]
testaction
greplog 'Warning: The bandwidthlimit option is not used with a local file path destination.'
not_greplog 'Debug: executing duplicity$' "\strickle -s -d 250 -u 250 duplicity\s"
# defined, set to 250, remote path
setconfig backup.d/test.dup dest bandwidthlimit 250
setconfig backup.d/test.dup dest desturl "sftp://${BN_REMOTEUSER}@${BN_REMOTEHOST}:22${BN_BACKUPDIR}/testdup"
testaction test.dup
[ "$status" -eq 0 ]
testaction
greplog 'Debug: executing duplicity$' "\strickle -s -d 250 -u 250 duplicity\s"
}
@ -327,20 +295,17 @@ finish_dup() {
# undefined desturl
delconfig backup.d/test.dup dest desturl
delconfig backup.d/test.dup dest desthost
testaction test.dup
[ "$status" -eq 0 ]
testaction
greplog 'Fatal: The destination host (desthost) must be set when desturl is not used.$'
# desturl, file protocol
setconfig backup.d/test.dup dest desturl "file://${BN_BACKUPDIR}/testdup"
testaction test.dup
[ "$status" -eq 0 ]
testaction
greplog 'Debug: executing duplicity$' "\sfile://${BN_BACKUPDIR}/testdup$"
# desturl, sftp protocol
setconfig backup.d/test.dup dest desturl "sftp://${BN_REMOTEUSER}@${BN_REMOTEHOST}:22${BN_BACKUPDIR}/testdup"
testaction test.dup
[ "$status" -eq 0 ]
testaction
greplog 'Debug: executing duplicity$' "\ssftp://${BN_REMOTEUSER}@${BN_REMOTEHOST}:22${BN_BACKUPDIR}/testdup$"
}
@ -349,8 +314,7 @@ finish_dup() {
setconfig backup.d/test.dup dest desthost "$BN_REMOTEHOST"
setconfig backup.d/test.dup dest destuser "$BN_REMOTEUSER"
setconfig backup.d/test.dup dest destdir "$BN_BACKUPDIR/testdup"
testaction test.dup
[ "$status" -eq 0 ]
testaction
greplog 'Debug: executing duplicity$' "\sscp://${BN_REMOTEUSER}@${BN_REMOTEHOST}/${BN_BACKUPDIR}/testdup$"
}
@ -360,8 +324,7 @@ finish_dup() {
setconfig backup.d/test.dup gpg password 123test
setconfig backup.d/test.dup dest desturl "file://${BN_BACKUPDIR}/testdup"
delconfig backup.d/test.dup dest destdir
runaction test.dup
[ "$status" -eq 0 ]
runaction
greplog "Debug: Data will be encrypted using symmetric encryption."
greplog "Info: Duplicity finished successfully."
}
@ -382,8 +345,7 @@ finish_dup() {
setconfig backup.d/test.dup gpg password 123test
setconfig backup.d/test.dup dest desturl "file://${BN_BACKUPDIR}/testdup"
delconfig backup.d/test.dup dest destdir
runaction test.dup
[ "$status" -eq 0 ]
runaction
greplog "Debug: Data will be encrypted with the GnuPG key $BN_ENCRYPTKEY.$"
greplog "Debug: Data won't be signed."
greplog "Info: Duplicity finished successfully."
@ -407,8 +369,7 @@ finish_dup() {
setconfig backup.d/test.dup gpg sign yes
setconfig backup.d/test.dup dest desturl "file://${BN_BACKUPDIR}/testdup"
delconfig backup.d/test.dup dest destdir
runaction test.dup
[ "$status" -eq 0 ]
runaction
greplog "Debug: Data will be encrypted ang signed with the GnuPG key ${BN_ENCRYPTKEY}.$"
greplog "Info: Duplicity finished successfully."
}
@ -433,8 +394,7 @@ finish_dup() {
setconfig backup.d/test.dup gpg signpassword 123sign
setconfig backup.d/test.dup dest desturl "file://${BN_BACKUPDIR}/testdup"
delconfig backup.d/test.dup dest destdir
runaction test.dup
[ "$status" -eq 0 ]
runaction
greplog "Debug: Data will be encrypted with the GnuPG key ${BN_ENCRYPTKEY}.$"
greplog "Debug: Data will be signed with the GnuPG key ${BN_SIGNKEY}.$"
greplog "Info: Duplicity finished successfully."
@ -456,8 +416,7 @@ finish_dup() {
setconfig backup.d/test.dup dest desthost "$BN_REMOTEHOST"
setconfig backup.d/test.dup dest destdir "${BN_BACKUPDIR}/testdup"
cleanup_backups remote
runaction test.dup
[ "$status" -eq 0 ]
runaction
greplog "Debug: Data will be encrypted using symmetric encryption."
greplog "Info: Duplicity finished successfully."
}
@ -480,8 +439,7 @@ finish_dup() {
setconfig backup.d/test.dup dest desthost "$BN_REMOTEHOST"
setconfig backup.d/test.dup dest destdir "${BN_BACKUPDIR}/testdup"
cleanup_backups remote
runaction test.dup
[ "$status" -eq 0 ]
runaction
greplog "Debug: Data will be encrypted ang signed with the GnuPG key ${BN_ENCRYPTKEY}.$"
greplog "Info: Duplicity finished successfully."
}