git » chasquid » commit 57f5a09

test: Replace dnsmasq with minidns

author Alberto Bertogli
2018-11-28 09:50:44 UTC
committer Alberto Bertogli
2018-11-30 10:03:48 UTC
parent a0ae5fb41bc0d063d877d527f342f344c567dfe3

test: Replace dnsmasq with minidns

This commit replaces test/t-14-tls_tracking usage of dnsmasq (an
external test dependency) with our new minidns.

test/Dockerfile +1 -2
test/t-14-tls_tracking/dnsmasq.conf +0 -24
test/t-14-tls_tracking/run.sh +2 -10
test/t-14-tls_tracking/zones +11 -0

diff --git a/test/Dockerfile b/test/Dockerfile
index 6966aeb..128f05c 100644
--- a/test/Dockerfile
+++ b/test/Dockerfile
@@ -25,8 +25,7 @@ RUN apt-get install -y -q python3 msmtp
 # Install the optional packages for the integration tests.
 RUN apt-get install -y -q \
 	gettext-base dovecot-imapd \
-	exim4-daemon-light \
-	dnsmasq
+	exim4-daemon-light
 
 # Prepare exim.
 RUN mkdir -p test/t-02-exim/.exim4 \
diff --git a/test/t-14-tls_tracking/dnsmasq.conf b/test/t-14-tls_tracking/dnsmasq.conf
deleted file mode 100644
index 2b69bb1..0000000
--- a/test/t-14-tls_tracking/dnsmasq.conf
+++ /dev/null
@@ -1,24 +0,0 @@
-# Configuration for dnsmasq, for testing purposes.
-
-interface=lo
-port=9053
-no-resolv
-no-poll
-no-hosts
-
-log-queries
-
-# Note we need both ipv4 and ipv6 A record because some test environments may
-# not support one or the other.
-
-# srv-a zone
-address=/srv-a/::1
-address=/srv-a/127.0.0.1
-mx-host=srv-a,srv-a,10
-txt-record=srv-a,"v=spf1 a"
-
-# srv-b zone
-address=/srv-b/::1
-address=/srv-b/127.0.0.1
-mx-host=srv-b,srv-b,10
-txt-record=srv-b,"v=spf1 a"
diff --git a/test/t-14-tls_tracking/run.sh b/test/t-14-tls_tracking/run.sh
index 2fd25ef..d6cc1bf 100755
--- a/test/t-14-tls_tracking/run.sh
+++ b/test/t-14-tls_tracking/run.sh
@@ -7,11 +7,6 @@ set -e
 
 init
 
-if ! dnsmasq --version > /dev/null; then
-        skip "dnsmasq binary is not functional"
-        exit 0
-fi
-
 # To fake SPF we need to override the resolver, which is only supported in Go
 # >= 1.8, so this test depends on that version.
 # TODO: remove this once we only support go >= 1.8.
@@ -25,11 +20,8 @@ fi
 # Build with the DNS override, so we can fake DNS records.
 export GOTAGS="dnsoverride"
 
-# Launch dnsmasq in the background using our configuration.
-# We run with -d as it takes care of a lot of options (log file, pid file,
-# etc.) for our use case.
-# It listens on localhost:9053 as  configuration.
-dnsmasq --conf-file=dnsmasq.conf -d >> .dnsmasq.log 2>&1 &
+# Launch minidns in the background using our configuration.
+minidns --addr=":9053" -zones=zones >> .minidns.log 2>&1 &
 
 
 # Two chasquid servers:
diff --git a/test/t-14-tls_tracking/zones b/test/t-14-tls_tracking/zones
new file mode 100644
index 0000000..76711dc
--- /dev/null
+++ b/test/t-14-tls_tracking/zones
@@ -0,0 +1,11 @@
+# srv-a zone
+srv-a A    127.0.0.1
+srv-a AAAA ::1
+srv-a MX   srv-a
+srv-a TXT  v=spf1 a
+
+# srv-b zone
+srv-b A    127.0.0.1
+srv-b AAAA ::1
+srv-b MX   srv-b
+srv-b TXT  v=spf1 a