mirror of
https://github.com/offen/docker-volume-backup.git
synced 2026-04-27 10:45:36 +02:00
Run tests Docker in Docker (#261)
* Try running tests in Docker * Spawn new container for each test * Store test artifacts outside of mount * When requested, build up to date image in test script * sudo is unneccessary in containerized test env * Skip azure test * Backdate fixture file in JSON database * Pin versions for azure tools * Mount temp volume for /var/lib/docker to prevent dangling ones created by VOLUME instruction * Fail backdating tests with message * Add some documentation on test setup * Cache images * Run compose stacks with shortened default timeout
This commit is contained in:
22
test/util.sh
22
test/util.sh
@@ -15,9 +15,31 @@ fail () {
|
||||
exit 1
|
||||
}
|
||||
|
||||
skip () {
|
||||
echo "[test:${current_test:-none}:skip] "$1""
|
||||
exit 0
|
||||
}
|
||||
|
||||
expect_running_containers () {
|
||||
if [ "$(docker ps -q | wc -l)" != "$1" ]; then
|
||||
fail "Expected $1 containers to be running, instead seen: "$(docker ps -a | wc -l)""
|
||||
fi
|
||||
pass "$1 containers running."
|
||||
}
|
||||
|
||||
docker() {
|
||||
case $1 in
|
||||
compose)
|
||||
shift
|
||||
case $1 in
|
||||
up)
|
||||
shift
|
||||
command docker compose up --timeout 3 "$@";;
|
||||
*)
|
||||
command docker compose "$@";;
|
||||
esac
|
||||
;;
|
||||
*)
|
||||
command docker "$@";;
|
||||
esac
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user