Skip to content

Commit

Permalink
Prettify BATS output
Browse files Browse the repository at this point in the history
Signed-off-by: yubiuser <github@yubiuser.dev>
  • Loading branch information
yubiuser committed Sep 19, 2024
1 parent 764b0db commit 75f11f3
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
9 changes: 9 additions & 0 deletions .github/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@ ENV GIT_TAG=${GIT_TAG}
ARG BUILD_OPTS=""
ENV BUILD_OPTS=${BUILD_OPTS}

# Add ncurses used for pretty output in bats tests
RUN apk add --no-cache ncurses
ENV TERM=xterm

# Monkeypatch BATS to remove duplicate output of starting and finished test
# BATS uses ANSI escape codes to overwrite the line after the test has finished
# This is not supported by Github Actions as it does not provide a TTY to the docker build container
RUN sed -i '/buffer_with_truncation /d' /bats-core/libexec/bats-core/bats-format-pretty

# Build FTL
# Remove possible old build files
RUN rm -rf cmake && \
Expand Down
2 changes: 1 addition & 1 deletion test/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ echo -n "Contained dnsmasq version (DNS): "
dig TXT CHAOS version.bind @127.0.0.1 +short

# Run tests
$BATS "test/test_suite.bats"
$BATS -p "test/test_suite.bats"
RET=$?

curl_to_tricorder() {
Expand Down
4 changes: 4 additions & 0 deletions test/test_suite.bats
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
#!./test/libs/bats/bin/bats

@test 'fail()' {
fail 'this test always fails'
}

@test "Compare template and test TOML config files" {
# We skip the first 5 lines of the files as they contain the version and
# timestamp of the file creation/modification
Expand Down

0 comments on commit 75f11f3

Please sign in to comment.