Skip to content

Commit

Permalink
No assert
Browse files Browse the repository at this point in the history
Signed-off-by: yubiuser <[email protected]>
  • Loading branch information
yubiuser committed Sep 19, 2024
1 parent 3d9d562 commit dc230f3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
4 changes: 3 additions & 1 deletion .github/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ ENV TERM=xterm
RUN git clone --depth=1 --quiet https://github.com/bats-core/bats-support test/libs/bats-support > /dev/null
RUN git clone --depth=1 --quiet https://github.com/bats-core/bats-assert test/libs/bats-assert > /dev/null

# Monkeypatch
# 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
Expand Down
14 changes: 4 additions & 10 deletions test/test_suite.bats
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# load bats-support
load 'libs/bats-support/load'
load 'libs/bats-assert/load'
#load 'libs/bats-assert/load'

@test 'fail()' {
fail 'this test always fails'
Expand All @@ -19,20 +19,14 @@ load 'libs/bats-assert/load'
@test "Running a second instance is detected and prevented" {
run bash -c 'su pihole -s /bin/sh -c "./pihole-FTL -f"'
printf "%s\n" "${lines[@]}"
assert_output --partial 'CRIT: pihole-FTL is already running'
}

@test "Running a second instance is detected and prevented (fail)" {
run bash -c 'su pihole -s /bin/sh -c "./pihole-FTL -f"'
printf "%s\n" "${lines[@]}"
assert_output --partial 'dfgdfgfdg'
[[ "${lines[@]}" == *"CRIT: pihole-FTL is already running"* ]]
}

@test "dnsmasq options as expected" {
run bash -c './pihole-FTL -vv | grep "cryptohash"'
printf "%s\n" "${lines[@]}"
assert_line --index 0 "Features: IPv6 GNU-getopt no-DBus no-UBus no-i18n IDN2 DHCP DHCPv6 Lua TFTP no-conntrack ipset no-nftset auth cryptohash DNSSEC loop-detect inotify dumpfile"
assert_line --index 1 ''
[[ ${lines[0]} == "Features: IPv6 GNU-getopt no-DBus no-UBus no-i18n IDN2 DHCP DHCPv6 Lua TFTP no-conntrack ipset no-nftset auth cryptohash DNSSEC loop-detect inotify dumpfile" ]]
[[ ${lines[1]} == "" ]]
}

@test "Initial blocking status is enabled" {
Expand Down

0 comments on commit dc230f3

Please sign in to comment.