tarback/tests/test-002-docker.sh

29 lines
1.1 KiB
Bash
Executable file

#!/bin/sh
set -eu
. ./tests/common.sh
# archive whole directory
workdir="$(create_directories)"
./tarback.sh -p docker create "$workdir/source" "$workdir/dest/source.tar.xz"
./tarback.sh -p docker restore "$workdir/dest/source.tar.xz" "$workdir/restore"
diff "$workdir/source" "$workdir/restore"
rm -rf "$workdir"
# archive single file
workdir="$(create_directories)"
filename="$(basename "$(find "$workdir/source" -type f)")"
./tarback.sh -p docker create "$workdir/source/$filename" "$workdir/dest/source.tar.xz"
./tarback.sh -p docker restore "$workdir/dest/source.tar.xz" "$workdir/restore/$filename"
diff "$workdir/source" "$workdir/restore"
rm -rf "$workdir"
# split archive
workdir="$(create_directories)"
filename="$(basename "$(find "$workdir/source" -type f)")"
TARBACK_SPLIT="split -b 10 -" ./tarback.sh -p docker create "$workdir/source/$filename" "$workdir/dest/source.tar.xz"
TARBACK_SPLIT="split -b 10 -" ./tarback.sh -p docker restore "$workdir/dest/source.tar.xz" "$workdir/restore/$filename"
diff "$workdir/source" "$workdir/restore"
[ "$(ls -1 "$workdir/dest/"*.part* | wc -l)" -gt 1 ]
rm -rf "$workdir"