-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
base.bats
executable file
·29 lines (26 loc) · 1.22 KB
/
base.bats
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/usr/bin/env bats
docker_test() {
local docker_opts=$1
local status=$2
local output_file=$3
local data_folder=$4
shift
shift
shift
shift
echo docker container run -t $docker_opts -w /data -v $(pwd)/${data_folder:-}:/data ${DOCKER_IMAGE} "$@" >>tests/output/$output_file-command.log
run docker container run -t $docker_opts -w /data -v $(pwd)/${data_folder:-}:/data ${DOCKER_IMAGE} "$@"
# Remove timed logging tags on electron logs by default.
echo "$output" | tee "tests/output/$output_file.log" | sed 's#\[.*:.*/.*\..*:.*:.*\(.*\)\] ##' >"tests/output/$output_file-comp.log"
[ "$status" -eq $status ]
if [ -f "tests/expected/$output_file.log" ]; then
diff -u --strip-trailing-cr "tests/output/$output_file-comp.log" "tests/expected/$output_file.log" >"tests/output/$output_file-diff.log"
elif [ -f "tests/expected/uniq-$output_file.log" ]; then
diff -u --strip-trailing-cr <(sort -u "tests/output/$output_file-comp.log") "tests/expected/uniq-$output_file.log" >"tests/output/$output_file-diff.log"
else
echo "No output test file at 'tests/expected/[uniq-]$output_file.log'"
fi
if [ -f "tests/output/$output_file-diff.log"]; then
[ "$(cat "tests/output/$output_file-diff.log")" = "" ]
fi
}