Skip to content

Commit

Permalink
Merge pull request #1223 from pemensik/fedora-tests
Browse files Browse the repository at this point in the history
Tweak test suite to also run on Fedora
  • Loading branch information
DL6ER authored Oct 21, 2021
2 parents 6c07e3a + 5715fe5 commit 7513bfa
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ version: 2
.docker_template: &docker_template
docker:
- image: pihole/ftl-build:v1.15-$CIRCLE_JOB
- image: pihole/ftl-build:v1.16-$CIRCLE_JOB
<<: *job_steps

jobs:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
bin_name: pihole-FTL-armv8-linux-gnueabihf
- arch: aarch64
bin_name: pihole-FTL-aarch64-linux-gnu
container: ghcr.io/pi-hole/ftl-build:v1.15-${{ matrix.arch }}
container: ghcr.io/pi-hole/ftl-build:v1.16-${{ matrix.arch }}
steps:
-
name: Checkout code
Expand Down
13 changes: 10 additions & 3 deletions test/pdns/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,23 @@ rm /var/lib/powerdns/pdns.sqlite3 2> /dev/null
if [ -d /etc/powerdns ]; then
# Debian
cp test/pdns/pdns.conf /etc/powerdns/pdns.conf
cp test/pdns/recursor.conf /etc/powerdns/recursor.conf
RECURSOR_CONF=/etc/powerdns/recursor.conf
elif [ -d /etc/pdns ]; then
# Alpine
cp test/pdns/pdns.conf /etc/pdns/pdns.conf
cp test/pdns/recursor.conf /etc/pdns/recursor.conf
if [ -d /etc/pdns-recursor ]; then
# Fedora
RECURSOR_CONF=/etc/pdns-recursor/recursor.conf
else
# Alpine
RECURSOR_CONF=/etc/pdns/recursor.conf
fi
else
echo "Error: Unable to determine powerDNS config directory"
exit 1
fi

cp test/pdns/recursor.conf $RECURSOR_CONF

# Create zone database
if [ -f /usr/share/doc/pdns-backend-sqlite3/schema.sqlite3.sql ]; then
# Debian
Expand Down
9 changes: 6 additions & 3 deletions test/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,11 @@ if ! su pihole -s /bin/sh -c /home/pihole/pihole-FTL; then
fi

# Prepare BATS
mkdir -p test/libs
git clone --depth=1 --quiet https://github.com/bats-core/bats-core test/libs/bats > /dev/null
if [ -z "$BATS" ]; then
mkdir -p test/libs
git clone --depth=1 --quiet https://github.com/bats-core/bats-core test/libs/bats > /dev/null
BATS=test/libs/bats/bin/bats
fi

# Give FTL some time for startup preparations
sleep 2
Expand All @@ -86,7 +89,7 @@ echo -n "Contained dnsmasq version (DNS): "
dig TXT CHAOS version.bind @127.0.0.1 +short

# Run tests
test/libs/bats/bin/bats "test/test_suite.bats"
$BATS "test/test_suite.bats"
RET=$?

curl_to_tricorder() {
Expand Down
4 changes: 2 additions & 2 deletions test/test_suite.bats
Original file line number Diff line number Diff line change
Expand Up @@ -343,14 +343,14 @@
}

@test "Local DNS test: SVCB svcb.ftl" {
run bash -c "dig TYPE64 svcb.ftl @127.0.0.1 +short"
run bash -c "dig +unknown TYPE64 svcb.ftl @127.0.0.1 +short"
printf "%s\n" "${lines[@]}"
[[ ${lines[0]} == '\# 13 000109706F72743D2238302200' ]]
[[ ${lines[1]} == "" ]]
}

@test "Local DNS test: HTTPS https.ftl" {
run bash -c "dig TYPE65 https.ftl @127.0.0.1 +short"
run bash -c "dig +unknown TYPE65 https.ftl @127.0.0.1 +short"
printf "%s\n" "${lines[@]}"
[[ ${lines[0]} == '\# 15 000100000100080322683303683222' ]]
[[ ${lines[1]} == "" ]]
Expand Down

0 comments on commit 7513bfa

Please sign in to comment.