File tree Expand file tree Collapse file tree 1 file changed +19
-4
lines changed
Expand file tree Collapse file tree 1 file changed +19
-4
lines changed Original file line number Diff line number Diff line change @@ -7,15 +7,24 @@ apk add --no-cache --update bind-tools 1>/dev/null
77
88EXIT_CODE=0
99
10+ # Arguments
11+ # - The name to query
12+ # - The exit code (default: 1)
13+ # - Some more options (default: none)
14+ #
1015testQuery () {
11- _RESULT=" $( dig " $1 " +noall +answer +short " @${DNS_SERVER} " ) "
16+ _RESULT=" $( dig ${3 :- } " $1 " +noall +answer +short " @${DNS_SERVER} " ) "
1217 if [ -n " $_RESULT " ]; then
13- echo " SUCCESS for $1 "
18+ echo " SUCCESS for $1 ( $_RESULT ) "
1419 return ;
1520 fi
1621 # Set exit code from second arg or use 1
1722 EXIT_CODE=" ${2:- 1} "
18- echo " FAILURE for $1 "
23+ if [ " ${2:- 1} " = " 0" ]; then
24+ echo " SUCCESS (successfully failed) for $1 "
25+ else
26+ echo " FAILURE for $1 "
27+ fi
1928}
2029
2130testServer () {
@@ -31,8 +40,14 @@ testServer() {
3140 # A query that only the server can answer
3241 testQuery ' test-domain.custom'
3342 testQuery ' dns-server.custom'
43+ testQuery ' 127.0.0.11' 0 ' -x'
44+ testQuery ' 8.8.8.8' 0 ' -x'
45+ testQuery ' 1.1.1.1' 0 ' -x'
46+
47+ DNS_SERVER=" 127.0.0.11"
3448 # Using docker server
35- testQuery ' dns-server' 1 127.0.0.11
49+ testQuery " ${1} "
50+ DNS_SERVER=" ${1} "
3651
3752 echo ' Ended'
3853}
You can’t perform that action at this time.
0 commit comments