]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
- Add http-response-buffer-size test
authorRalph Dolmans <ralph@nlnetlabs.nl>
Wed, 24 Jun 2020 14:31:51 +0000 (16:31 +0200)
committerRalph Dolmans <ralph@nlnetlabs.nl>
Wed, 24 Jun 2020 14:31:51 +0000 (16:31 +0200)
testdata/doh_downstream_buffer_size.tdir/doh_downstream_buffer_size.conf [new file with mode: 0644]
testdata/doh_downstream_buffer_size.tdir/doh_downstream_buffer_size.dsc [new file with mode: 0644]
testdata/doh_downstream_buffer_size.tdir/doh_downstream_buffer_size.post [new file with mode: 0644]
testdata/doh_downstream_buffer_size.tdir/doh_downstream_buffer_size.pre [new file with mode: 0644]
testdata/doh_downstream_buffer_size.tdir/doh_downstream_buffer_size.test [new file with mode: 0644]
testdata/doh_downstream_buffer_size.tdir/unbound_server.key [new file with mode: 0644]
testdata/doh_downstream_buffer_size.tdir/unbound_server.pem [new file with mode: 0644]
testdata/doh_downstream_endpoint.tdir/doh_downstream_endpoint.test

diff --git a/testdata/doh_downstream_buffer_size.tdir/doh_downstream_buffer_size.conf b/testdata/doh_downstream_buffer_size.tdir/doh_downstream_buffer_size.conf
new file mode 100644 (file)
index 0000000..30d8e2a
--- /dev/null
@@ -0,0 +1,17 @@
+server:
+       verbosity: 2
+       # num-threads: 1
+       interface: 127.0.0.1@@PORT@
+       https-port: @PORT@
+       tls-service-key: "unbound_server.key"
+       tls-service-pem: "unbound_server.pem"
+       use-syslog: no
+       directory: .
+       pidfile: "unbound.pid"
+       chroot: ""
+       username: ""
+       do-not-query-localhost: no
+       http-response-buffer-size: 500
+
+       local-zone: "example.net" redirect
+       local-data: "example.net. IN A 1.2.3.1"
diff --git a/testdata/doh_downstream_buffer_size.tdir/doh_downstream_buffer_size.dsc b/testdata/doh_downstream_buffer_size.tdir/doh_downstream_buffer_size.dsc
new file mode 100644 (file)
index 0000000..c271fcd
--- /dev/null
@@ -0,0 +1,16 @@
+BaseName: doh_downstream_buffer_size
+Version: 1.0
+Description: Test DNS-over-HTTPS http-response-buffer-size
+CreationDate: Mon Jun 12 12:00:00 CET 2020
+Maintainer:
+Category: 
+Component:
+CmdDepends: 
+Depends: 
+Help:
+Pre: doh_downstream_buffer_size.pre
+Post: doh_downstream_buffer_size.post
+Test: doh_downstream_buffer_size.test
+AuxFiles: 
+Passed:
+Failure:
diff --git a/testdata/doh_downstream_buffer_size.tdir/doh_downstream_buffer_size.post b/testdata/doh_downstream_buffer_size.tdir/doh_downstream_buffer_size.post
new file mode 100644 (file)
index 0000000..ffad089
--- /dev/null
@@ -0,0 +1,10 @@
+# #-- doh_downstream.post --#
+# source the master var file when it's there
+[ -f ../.tpkg.var.master ] && source ../.tpkg.var.master
+# source the test var file when it's there
+[ -f .tpkg.var.test ] && source .tpkg.var.test
+#
+# do your teardown here
+. ../common.sh
+kill_pid $UNBOUND_PID
+cat unbound.log
diff --git a/testdata/doh_downstream_buffer_size.tdir/doh_downstream_buffer_size.pre b/testdata/doh_downstream_buffer_size.tdir/doh_downstream_buffer_size.pre
new file mode 100644 (file)
index 0000000..1979539
--- /dev/null
@@ -0,0 +1,22 @@
+# #-- doh_downstream.pre--#
+# source the master var file when it's there
+[ -f ../.tpkg.var.master ] && source ../.tpkg.var.master
+# use .tpkg.var.test for in test variable passing
+[ -f .tpkg.var.test ] && source .tpkg.var.test
+
+. ../common.sh
+get_random_port 1
+UNBOUND_PORT=$RND_PORT
+echo "UNBOUND_PORT=$UNBOUND_PORT" >> .tpkg.var.test
+
+# make config file
+sed -e 's/@PORT\@/'$UNBOUND_PORT'/' -e 's/@TOPORT\@/'$FWD_PORT'/' < doh_downstream_buffer_size.conf > ub.conf
+# start unbound in the background
+PRE="../.."
+$PRE/unbound -vvvv -d -c ub.conf >unbound.log 2>&1 &
+UNBOUND_PID=$!
+echo "UNBOUND_PID=$UNBOUND_PID" >> .tpkg.var.test
+
+cat .tpkg.var.test
+wait_unbound_up unbound.log
+
diff --git a/testdata/doh_downstream_buffer_size.tdir/doh_downstream_buffer_size.test b/testdata/doh_downstream_buffer_size.tdir/doh_downstream_buffer_size.test
new file mode 100644 (file)
index 0000000..bbeb9eb
--- /dev/null
@@ -0,0 +1,38 @@
+# #-- doh_downstream.test --#
+# source the master var file when it's there
+[ -f ../.tpkg.var.master ] && source ../.tpkg.var.master
+# use .tpkg.var.test for in test variable passing
+[ -f .tpkg.var.test ] && source .tpkg.var.test
+
+PRE="../.."
+. ../common.sh
+get_make
+(cd $PRE; $MAKE dohclient)
+
+
+echo "> query www.example.net. endpoint /dns-query"
+$PRE/dohclient -s 127.0.0.1 -p $UNBOUND_PORT 1.example.net. A IN 2.example.net. A IN 3.example.net. A IN 4.example.net. A IN 5.example.net. A IN 6.example.net. A IN 7.example.net. A IN 8.example.net. A IN 9.example.net. A IN 10.example.net. A IN  >outfile 2>&1
+cat outfile
+if test "$?" -ne 0; then
+       echo "exit status not OK"
+       echo "> cat logfiles"
+       cat outfile
+       cat unbound.log
+       echo "Not OK"
+       exit 1
+fi
+num=$(grep "ANSWER SEC" outfile | wc -l)
+# 58 byte answers, 500 byte max response buffer -> 8 answers
+if [ $num -eq 8 ]; then
+       echo "content OK"
+else
+       echo "result contents not OK"
+       echo "> cat logfiles"
+       cat outfile
+       cat unbound.log
+       echo "result contents not OK"
+       exit 1
+fi
+echo "OK"
+
+exit 0
diff --git a/testdata/doh_downstream_buffer_size.tdir/unbound_server.key b/testdata/doh_downstream_buffer_size.tdir/unbound_server.key
new file mode 100644 (file)
index 0000000..4256c42
--- /dev/null
@@ -0,0 +1,15 @@
+-----BEGIN RSA PRIVATE KEY-----
+MIICWwIBAAKBgQC3F7Jsv2u01pLL9rFnjsMU/IaCFUIz/624DcaE84Z4gjMl5kWA
+3axQcqul1wlwSrbKwrony+d9hH/+MX0tZwvl8w3OmhmOAiaQ+SHCsIuOjVwQjX0s
+RLB61Pz5+PAiVvnPa9JIYB5QrK6DVEsxIHj8MOc5JKORrnESsFDh6yeMeQIDAQAB
+AoGAAuWoGBprTOA8UGfl5LqYkaNxSWumsYXxLMFjC8WCsjN1NbtQDDr1uAwodSZS
+6ujzvX+ZTHnofs7y64XC8k34HTOCD2zlW7kijWbT8YjRYFU6o9F5zUGD9RCan0ds
+sVscT2psLSzfdsmFAcbmnGdxYkXk2PC1FHtaqExxehralGUCQQDcqrg9uQKXlhQi
+XAaPr8SiWvtRm2a9IMMZkRfUWZclPHq6fCWNuUaCD+cTat4wAuqeknAz33VEosw3
+fXGsok//AkEA1GjIHXrOcSlpfVJb6NeOBugjRtZ7ZDT5gbtnMS9ob0qntKV6saaL
+CNmJwuD9Q3XkU5j1+uHvYGP2NzcJd2CjhwJACV0hNlVMe9w9fHvFN4Gw6WbM9ViP
+0oS6YrJafYNTu5vGZXVxLoNnL4u3NYa6aPUmuZXjNwBLfJ8f5VboZPf6RwJAINd2
+oYA8bSi/A755MX4qmozH74r4Fx1Nuq5UHTm8RwDe/0Javx8F/j9MWpJY9lZDEF3l
+In5OebPa/NyInSmW/wJAZuP9aRn0nDBkHYri++1A7NykMiJ/nH0mDECbnk+wxx0S
+LwqIetBhxb8eQwMg45+iAH7CHAMQ8BQuF/nFE6eotg==
+-----END RSA PRIVATE KEY-----
diff --git a/testdata/doh_downstream_buffer_size.tdir/unbound_server.pem b/testdata/doh_downstream_buffer_size.tdir/unbound_server.pem
new file mode 100644 (file)
index 0000000..aeda3ff
--- /dev/null
@@ -0,0 +1,11 @@
+-----BEGIN CERTIFICATE-----
+MIIBmzCCAQQCCQDsNJ1UmphEFzANBgkqhkiG9w0BAQUFADASMRAwDgYDVQQDEwd1
+bmJvdW5kMB4XDTA4MDkxMTA5MDk0MFoXDTI4MDUyOTA5MDk0MFowEjEQMA4GA1UE
+AxMHdW5ib3VuZDCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAtxeybL9rtNaS
+y/axZ47DFPyGghVCM/+tuA3GhPOGeIIzJeZFgN2sUHKrpdcJcEq2ysK6J8vnfYR/
+/jF9LWcL5fMNzpoZjgImkPkhwrCLjo1cEI19LESwetT8+fjwIlb5z2vSSGAeUKyu
+g1RLMSB4/DDnOSSjka5xErBQ4esnjHkCAwEAATANBgkqhkiG9w0BAQUFAAOBgQAZ
+9N0lnLENs4JMvPS+mn8C5m9bkkFITd32IiLjf0zgYpIUbFXH6XaEr9GNZBUG8feG
+l/6WRXnbnVSblI5odQ4XxGZ9inYY6qtW30uv76HvoKp+QZ1c3460ddR8NauhcCHH
+Z7S+QbLXi+r2JAhpPozZCjBHlRD0ixzA1mKQTJhJZg==
+-----END CERTIFICATE-----
index 6ae176dd98e0a60155a2227264efe56c558d4470..0e25a47f67752a9dbee6732276b4c16ff9a84a34 100644 (file)
@@ -17,7 +17,6 @@ if test "$?" -ne 0; then
        echo "exit status not OK"
        echo "> cat logfiles"
        cat outfile
-       cat fwd.log 
        cat unbound.log
        echo "Not OK"
        exit 1
@@ -28,7 +27,6 @@ else
        echo "result contents not OK"
        echo "> cat logfiles"
        cat outfile
-       cat fwd.log 
        cat unbound.log
        echo "result contents not OK"
        exit 1
@@ -42,7 +40,6 @@ if test "$?" -ne 0; then
        echo "exit status not OK"
        echo "> cat logfiles"
        cat outfile
-       cat fwd.log 
        cat unbound.log
        echo "Not OK"
        exit 1
@@ -53,7 +50,6 @@ else
        echo "result contents not OK"
        echo "> cat logfiles"
        cat outfile
-       cat fwd.log 
        cat unbound.log
        echo "result contents not OK"
        exit 1