Skip to content

Commit

Permalink
tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rlespinasse committed Oct 23, 2023
1 parent c5e0864 commit 12a5041
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 5 deletions.
6 changes: 4 additions & 2 deletions tests/base.bats
Expand Up @@ -9,6 +9,7 @@ docker_test() {
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.
Expand All @@ -17,8 +18,9 @@ docker_test() {
[ "$status" -eq $status ]
if [ -f "tests/expected/$output_file.log" ]; then
[ "$(diff --strip-trailing-cr "tests/output/$output_file-comp.log" "tests/expected/$output_file.log")" = "" ]
fi
if [ -f "tests/expected/uniq-$output_file.log" ]; then
elif [ -f "tests/expected/uniq-$output_file.log" ]; then
[ "$(diff --strip-trailing-cr <(sort -u "tests/output/$output_file-comp.log") "tests/expected/uniq-$output_file.log")" = "" ]
else
echo "No output test file at 'tests/expected/[uniq-]$output_file.log'"
fi
}
File renamed without changes.
1 change: 1 addition & 0 deletions tests/expected/output-create-command.log
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions tests/expected/output-wrong-command.log
@@ -0,0 +1 @@

6 changes: 3 additions & 3 deletions tests/timeout.bats
Expand Up @@ -3,13 +3,13 @@
. tests/base.bats

@test "Timeout for using create command" {
docker_test "-e DRAWIO_DESKTOP_COMMAND_TIMEOUT=2s" 1 "output-nothing" "tests" --create output/empty.drawio
docker_test "-e DRAWIO_DESKTOP_COMMAND_TIMEOUT=2s" 1 "output-create-command" "tests" --create output/empty.drawio
}

@test "Timeout for using check command" {
docker_test "-e DRAWIO_DESKTOP_COMMAND_TIMEOUT=2s" 1 "output-nothing" "tests" --check output/empty.drawio
docker_test "-e DRAWIO_DESKTOP_COMMAND_TIMEOUT=2s" 1 "output-check-command" "tests" --check output/empty.drawio
}

@test "Timeout for using wrong command" {
docker_test "-e DRAWIO_DESKTOP_COMMAND_TIMEOUT=2s" 1 "output-nothing" "tests/data" --wrong-command
docker_test "-e DRAWIO_DESKTOP_COMMAND_TIMEOUT=2s" 1 "output-wrong-command" "tests/data" --wrong-command
}

0 comments on commit 12a5041

Please sign in to comment.