1# #-- doh_downstream.test --#
2# source the master var file when it's there
3[ -f ../.tpkg.var.master ] && source ../.tpkg.var.master
4# use .tpkg.var.test for in test variable passing
5[ -f .tpkg.var.test ] && source .tpkg.var.test
6
7PRE="../.."
8. ../common.sh
9get_make
10(cd $PRE; $MAKE dohclient)
11
12
13echo "> query www.example.net. endpoint /dns-query"
14$PRE/dohclient -s 127.0.0.1 -p $UNBOUND_PORT www.example.net. A IN >outfile 2>&1
15cat outfile
16if test "$?" -ne 0; then
17	echo "exit status not OK"
18	echo "> cat logfiles"
19	cat outfile
20	cat unbound.log
21	echo "Not OK"
22	exit 1
23fi
24if grep "status 404" outfile; then
25	echo "content OK"
26else
27	echo "result contents not OK"
28	echo "> cat logfiles"
29	cat outfile
30	cat unbound.log
31	echo "result contents not OK"
32	exit 1
33fi
34echo "OK"
35
36echo "> query www.example.net. endpoint /abc"
37$PRE/dohclient -e /abc -s 127.0.0.1 -p $UNBOUND_PORT www.example.net. A IN >outfile 2>&1
38cat outfile
39if test "$?" -ne 0; then
40	echo "exit status not OK"
41	echo "> cat logfiles"
42	cat outfile
43	cat unbound.log
44	echo "Not OK"
45	exit 1
46fi
47if grep ":status 200" outfile; then
48	echo "content OK"
49else
50	echo "result contents not OK"
51	echo "> cat logfiles"
52	cat outfile
53	cat unbound.log
54	echo "result contents not OK"
55	exit 1
56fi
57echo "OK"
58exit 0
59