mirror of
https://0xacab.org/liberate/backupninja.git
synced 2024-11-08 11:52:32 +01:00
tests: improve setconfig_repeat
This commit is contained in:
parent
b3ca5e956c
commit
5bc6b9c1b5
@ -137,7 +137,7 @@ finish_borg() {
|
||||
greplog 'Debug: executing borg create$' "'${BN_SRCDIR}'$"
|
||||
|
||||
# multiple paths
|
||||
setconfig_repeat backup.d/test.borg include "$BN_SRCDIR" /foo /bar
|
||||
setconfig_repeat backup.d/test.borg source include "$BN_SRCDIR" /foo /bar
|
||||
testaction test.borg
|
||||
[ "$status" -eq 0 ]
|
||||
greplog 'Debug: executing borg create$' "'${BN_SRCDIR}' '/foo' '/bar'$"
|
||||
@ -157,7 +157,7 @@ finish_borg() {
|
||||
greplog 'Debug: executing borg create$' "\s--exclude '${BN_SRCDIR}/var'\s"
|
||||
|
||||
# multiple paths
|
||||
setconfig_repeat backup.d/test.borg exclude "$BN_SRCDIR/var" "$BN_SRCDIR/foo" "$BN_SRCDIR/bar"
|
||||
setconfig_repeat backup.d/test.borg source exclude "$BN_SRCDIR/var" "$BN_SRCDIR/foo" "$BN_SRCDIR/bar"
|
||||
testaction test.borg
|
||||
[ "$status" -eq 0 ]
|
||||
greplog 'Debug: executing borg create$' "\s--exclude '${BN_SRCDIR}/var' --exclude '${BN_SRCDIR}/foo' --exclude '${BN_SRCDIR}/bar'\s"
|
||||
|
@ -95,12 +95,14 @@ setconfig() {
|
||||
# (used for include and exclude parameters)
|
||||
setconfig_repeat() {
|
||||
conffile="${BATS_TMPDIR}/$1"
|
||||
param="$2"
|
||||
shift; shift;
|
||||
for p in "$@"; do
|
||||
conf="${conf}${param} = ${p}\n"
|
||||
section="$2"
|
||||
param="$3"
|
||||
shift 3
|
||||
crudini --del "$conffile" "$section" "$param"
|
||||
for v; do
|
||||
crudini --set --list --list-sep=$'\nREPEAT = ' "$conffile" "$section" "$param" "$v"
|
||||
done
|
||||
sed -i "s#^${param} =.*#${conf}#" "${conffile}"
|
||||
sed -i "s#^\s\+REPEAT =#${param} =#" "${conffile}"
|
||||
}
|
||||
|
||||
# delete config parameter
|
||||
|
@ -141,7 +141,7 @@ finish_dup() {
|
||||
greplog 'Debug: executing duplicity$' "\s--include '${BN_SRCDIR}'"
|
||||
|
||||
# multiple paths
|
||||
setconfig_repeat backup.d/test.dup include "$BN_SRCDIR" /foo /bar
|
||||
setconfig_repeat backup.d/test.dup source include "$BN_SRCDIR" /foo /bar
|
||||
testaction test.dup
|
||||
[ "$status" -eq 0 ]
|
||||
greplog 'Debug: executing duplicity$' "\s--include '${BN_SRCDIR}' --include '/foo' --include '/bar'\s"
|
||||
@ -161,7 +161,7 @@ finish_dup() {
|
||||
greplog 'Debug: executing duplicity$' "\s--exclude '${BN_SRCDIR}/var'\s"
|
||||
|
||||
# multiple paths
|
||||
setconfig_repeat backup.d/test.dup exclude "$BN_SRCDIR/var" "$BN_SRCDIR/foo" "$BN_SRCDIR/bar"
|
||||
setconfig_repeat backup.d/test.dup source exclude "$BN_SRCDIR/var" "$BN_SRCDIR/foo" "$BN_SRCDIR/bar"
|
||||
testaction test.dup
|
||||
[ "$status" -eq 0 ]
|
||||
greplog 'Debug: executing duplicity$' "\s--exclude '${BN_SRCDIR}/var' --exclude '${BN_SRCDIR}/foo' --exclude '${BN_SRCDIR}/bar'\s"
|
||||
|
Loading…
Reference in New Issue
Block a user