Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tweak test suite to also run on Fedora #1223

Merged
merged 4 commits into from
Oct 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
pemensik marked this conversation as resolved.
Show resolved Hide resolved
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"
pemensik marked this conversation as resolved.
Show resolved Hide resolved
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