git » dnss » commit ad1cacc

tests: Add some JSON-specific tests

author Alberto Bertogli
2018-07-21 11:26:45 UTC
committer Alberto Bertogli
2018-07-21 11:26:45 UTC
parent 9e7d1cfa452cda4b3ea9d36f7ff0a2aafc9768cf

tests: Add some JSON-specific tests

This patch adds some JSON specific tests: edns_client_subnet (both ipv4
and ipv6) and an invalid query.

The tests are not particularly good, as for example we don't check that
the edns_client_subnet is parsed properly, but they're better than
nothing.

tests/external.sh +9 -0

diff --git a/tests/external.sh b/tests/external.sh
index 5e0e23b..0de84db 100755
--- a/tests/external.sh
+++ b/tests/external.sh
@@ -109,6 +109,15 @@ dnss -enable_dns_to_https -dns_listen_addr "localhost:1053" \
 	-https_upstream "http://localhost:1999/dns-query"
 
 resolve
+
+# Exercise some interesting JSON requests.
+get "http://localhost:1999/dns-query?name=test&edns_client_subnet=1.2.3.4/24"
+get "http://localhost:1999/dns-query?name=test&edns_client_subnet=2001:700:300::/48"
+if get "http://localhost:1999/dns-query?name=test&type=lalala"; then
+	echo "GET with invalid query did not fail"
+	exit 1
+fi
+
 kill $PID
 
 echo "## DoH against dnss"