aboutsummaryrefslogtreecommitdiff
path: root/testdata/fwd_three.tdir/fwd_three.test
blob: 962d0bf1c12b3fa0ec66dfba89b7d272344ea54e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# #-- fwd_three.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="../.."
# do the test
echo "> dig www1.example.com."
dig @localhost -p $UNBOUND_PORT www1.example.com. | tee outfile
echo "> cat logfiles"
cat fwd.log 
cat unbound.log
echo "> check answer for single query"
if grep "10.20.30.40" outfile; then
	echo "OK"
else
	echo "Not OK"
	exit 1
fi

echo "> do three queries"
dig @localhost -p $UNBOUND_PORT +retry=10 +time=1 www1.example.com. >outfile1 &
digpid1=$!
dig @localhost -p $UNBOUND_PORT +retry=10 +time=1 www2.example.com. >outfile2 &
digpid2=$!
dig @localhost -p $UNBOUND_PORT +retry=10 +time=1 www3.example.com. >outfile3 &
digpid3=$!
sleep 5
kill -9 $digpid1
kill -9 $digpid2
kill -9 $digpid3

echo "> cat outfile1"
cat outfile1 
echo "> cat outfile2"
cat outfile2 
echo "> cat outfile3"
cat outfile3
echo "> cat logfiles"
cat fwd.log 
cat unbound.log
echo "> check answers for three queries"
if grep "10.20.30.40" outfile1; then
	echo "1 is OK"
else
	echo "1 is not OK"
	exit 1
fi
if grep "10.20.30.50" outfile2; then
	echo "2 is OK"
else
	echo "2 is not OK"
	exit 1
fi
if grep "10.20.30.60" outfile3; then
	echo "3 is OK"
else
	echo "3 is not OK"
	exit 1
fi

exit 0