Fix docker plugin, add ssh and docker tests.
This commit is contained in:
parent
482da4b833
commit
0e6fbcc6f1
3 changed files with 59 additions and 2 deletions
|
@ -1,4 +1,5 @@
|
|||
#!/bin/sh
|
||||
|
||||
TARBACK_TAR_CREATE_COMMAND='docker run -i --rm --workdir=/mnt --volume="$1":/mnt/"$1" alpine '"$TARBACK_TAR_CREATE_COMMAND"
|
||||
TARBACK_TAR_EXTRACT_COMMAND='docker run -i --rm --workdir=/mnt --volume="$1":/mnt/"$1" alpine '"$TARBACK_TAR_EXTRACT_COMMAND"
|
||||
_tarback_plugin_docker_cmd='docker run -i --rm --workdir=/mnt --volume="$1":/mnt/"$1" alpine '
|
||||
TARBACK_TAR_CREATE_COMMAND="$_tarback_plugin_docker_cmd "'tar c -C "/mnt/$1" .'
|
||||
TARBACK_TAR_EXTRACT_COMMAND="$_tarback_plugin_docker_cmd "'tar x -C "/mnt/$1"'
|
||||
|
|
29
tests/test-001-ssh.sh
Executable file
29
tests/test-001-ssh.sh
Executable file
|
@ -0,0 +1,29 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -eu
|
||||
|
||||
. ./tests/common.sh
|
||||
|
||||
export TARBACK_REMOTE='ssh localhost'
|
||||
|
||||
# archive whole directory
|
||||
workdir="$(create_directories)"
|
||||
./tarback.sh create "$workdir/source" "$workdir/dest/source.tar.xz"
|
||||
./tarback.sh restore "$workdir/dest/source.tar.xz" "$workdir/restore"
|
||||
diff "$workdir/source" "$workdir/restore"
|
||||
rm -rf "$workdir"
|
||||
|
||||
# archive single file
|
||||
workdir="$(create_directories)"
|
||||
./tarback.sh create "$workdir/source/hello_world.txt" "$workdir/dest/source.tar.xz"
|
||||
./tarback.sh restore "$workdir/dest/source.tar.xz" "$workdir/restore/hello_world.txt"
|
||||
diff "$workdir/source" "$workdir/restore"
|
||||
rm -rf "$workdir"
|
||||
|
||||
# split archive
|
||||
workdir="$(create_directories)"
|
||||
TARBACK_SPLIT="split -b 10 -" ./tarback.sh create "$workdir/source/hello_world.txt" "$workdir/dest/source.tar.xz"
|
||||
TARBACK_SPLIT="split -b 10 -" ./tarback.sh restore "$workdir/dest/source.tar.xz" "$workdir/restore/hello_world.txt"
|
||||
diff "$workdir/source" "$workdir/restore"
|
||||
[ "$(ls -1 "$workdir/dest/"*.part* | wc -l)" -gt 1 ]
|
||||
rm -rf "$workdir"
|
27
tests/test-002-docker.sh
Executable file
27
tests/test-002-docker.sh
Executable file
|
@ -0,0 +1,27 @@
|
|||
#!/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)"
|
||||
./tarback.sh -p docker create "$workdir/source/hello_world.txt" "$workdir/dest/source.tar.xz"
|
||||
./tarback.sh -p docker restore "$workdir/dest/source.tar.xz" "$workdir/restore/hello_world.txt"
|
||||
diff "$workdir/source" "$workdir/restore"
|
||||
rm -rf "$workdir"
|
||||
|
||||
# split archive
|
||||
workdir="$(create_directories)"
|
||||
TARBACK_SPLIT="split -b 10 -" ./tarback.sh -p docker create "$workdir/source/hello_world.txt" "$workdir/dest/source.tar.xz"
|
||||
TARBACK_SPLIT="split -b 10 -" ./tarback.sh -p docker restore "$workdir/dest/source.tar.xz" "$workdir/restore/hello_world.txt"
|
||||
diff "$workdir/source" "$workdir/restore"
|
||||
[ "$(ls -1 "$workdir/dest/"*.part* | wc -l)" -gt 1 ]
|
||||
rm -rf "$workdir"
|
Loading…
Reference in a new issue