Browse Source

Fix test errors caused by DNS_CHECK_OPTIONS

Use a regexp rather than a partial match to skip any DNS_CHECK_OPTIONS,
which in the current tests create whitespace, but could be anything.

Catch a missing inclusion of DNS_CHECK_OPTIONS for dig CNAME
pull/660/head
Timothe Litt 5 years ago
parent
commit
db2ec987d7
Failed to extract signature
4 changed files with 18 additions and 18 deletions
  1. +2
    -2
      getssl
  2. +7
    -7
      test/u1-test-get_auth_dns-dig.bats
  3. +7
    -7
      test/u2-test-get_auth_dns-drill.bats
  4. +2
    -2
      test/u5-test-get_auth_dns-no-root-servers.bats

+ 2
- 2
getssl View File

@ -674,7 +674,7 @@ check_config() { # check the config files for all obvious errors
# check domain exists using all DNS utilities. DNS_CHECK_OPTIONS may bind IP address or provide TSIG
found_ip=false
if [[ -n "$HAS_DIG_OR_DRILL" ]]; then
debug "DNS lookup using $HAS_DIG_OR_DRILL ${d}"
debug "DNS lookup using $HAS_DIG_OR_DRILL $DNS_CHECK_OPTIONS ${d}"
if [[ "$($HAS_DIG_OR_DRILL $DNS_CHECK_OPTIONS -t SOA "${d}" |grep -c -i "^${d}")" -ge 1 ]]; then
found_ip=true
elif [[ "$($HAS_DIG_OR_DRILL $DNS_CHECK_OPTIONS -t A "${d}"|grep -c -i "^${d}")" -ge 1 ]]; then
@ -1389,7 +1389,7 @@ get_auth_dns() { # get the authoritative dns server for a domain (sets primary_n
fi
# Check if domain is a CNAME, first
test_output "Using $HAS_DIG_OR_DRILL CNAME"
test_output "Using $HAS_DIG_OR_DRILL $DNS_CHECK_OPTIONS CNAME"
# Two options here; either dig CNAME will return the CNAME and the NS or just the CNAME
debug Checking for CNAME using "$HAS_DIG_OR_DRILL $DNS_CHECK_OPTIONS CNAME $gad_d $gad_s"


+ 7
- 7
test/u1-test-get_auth_dns-dig.bats View File

@ -61,7 +61,7 @@ teardown() {
# Assert that we've found the primary_ns server
assert_output --regexp 'set primary_ns = ns[1-4]+\.duckdns\.org'
# Assert that we had to use dig NS
assert_line --partial 'Using dig NS'
assert_line --regexp 'Using dig.* NS'
# Check all Authoritive DNS servers are returned if requested
CHECK_ALL_AUTH_DNS=true
@ -89,8 +89,8 @@ teardown() {
assert_output --regexp 'set primary_ns = ns[1-4]+\.duckdns\.org'
# Assert that we had to use dig NS
assert_line --partial 'Using dig SOA'
refute_line --partial 'Using dig NS'
assert_line --regexp 'Using dig.* SOA'
refute_line --regexp 'Using dig.* NS'
# Check all Authoritive DNS servers are returned if requested
CHECK_ALL_AUTH_DNS=true
@ -125,8 +125,8 @@ teardown() {
assert_output --regexp 'set primary_ns = ns.*\.awsdns.*\.com'
# Assert that we found a CNAME and use dig NS
assert_line --partial 'Using dig CNAME'
assert_line --partial 'Using dig NS'
assert_line --regexp 'Using dig.* CNAME'
assert_line --regexp 'Using dig.* NS'
# Check all Authoritive DNS servers are returned if requested
CHECK_ALL_AUTH_DNS=true
@ -168,8 +168,8 @@ teardown() {
assert_output --regexp 'set primary_ns = ns[1-4]+\.duckdns\.org'
# Assert that we found a CNAME but didn't use dig NS
assert_line --partial 'Using dig CNAME'
refute_line --partial 'Using dig NS'
assert_line --regexp 'Using dig.* CNAME'
refute_line --regexp 'Using dig.* NS'
# Check all Authoritive DNS servers are returned if requested
CHECK_ALL_AUTH_DNS=true


+ 7
- 7
test/u2-test-get_auth_dns-drill.bats View File

@ -67,7 +67,7 @@ teardown() {
# Assert that we've found the primary_ns server
assert_output --regexp 'set primary_ns = ns[1-4]+\.duckdns\.org'
# Assert that we had to use drill NS
assert_line --partial 'Using drill NS'
assert_line --regexp 'Using drill.* NS'
# Check all Authoritive DNS servers are returned if requested
CHECK_ALL_AUTH_DNS=true
@ -100,8 +100,8 @@ teardown() {
assert_output --regexp 'set primary_ns = ns[1-4]+\.duckdns\.org'
# Assert that we had to use drill NS
assert_line --partial 'Using drill SOA'
refute_line --partial 'Using drill NS'
assert_line --regexp 'Using drill.* SOA'
refute_line --regexp 'Using drill.* NS'
# Check all Authoritive DNS servers are returned if requested
CHECK_ALL_AUTH_DNS=true
@ -141,8 +141,8 @@ teardown() {
assert_output --regexp 'set primary_ns = ns.*\.awsdns.*\.com'
# Assert that we found a CNAME and use drill NS
assert_line --partial 'Using drill CNAME'
assert_line --partial 'Using drill NS'
assert_line --regexp 'Using drill.* CNAME'
assert_line --regexp 'Using drill.* NS'
# Check all Authoritive DNS servers are returned if requested
CHECK_ALL_AUTH_DNS=true
@ -192,8 +192,8 @@ teardown() {
assert_output --regexp 'set primary_ns = ns[1-4]+\.duckdns\.org'
# Assert that we found a CNAME but didn't use drill NS
assert_line --partial 'Using drill CNAME'
refute_line --partial 'Using drill NS'
assert_line --regexp 'Using drill.* CNAME'
refute_line --regexp 'Using drill.* NS'
# Check all Authoritive DNS servers are returned if requested
CHECK_ALL_AUTH_DNS=true


+ 2
- 2
test/u5-test-get_auth_dns-no-root-servers.bats View File

@ -60,7 +60,7 @@ teardown() {
# Assert that we've found the primary_ns server
assert_output --regexp 'set primary_ns = '
# Assert that we had to use dig NS
assert_line --partial 'Using dig NS'
assert_line --regexp 'Using dig.* NS'
# Check we didn't include any root servers
refute_line --partial 'root-servers.net'
@ -89,7 +89,7 @@ teardown() {
# Assert that we've found the primary_ns server
assert_output --regexp 'set primary_ns = '
# Assert that we had to use dig SOA
assert_line --partial 'Using dig SOA'
assert_line --regexp 'Using dig.* SOA'
# Check we didn't include any root servers
refute_line --partial 'root-servers.net'


Loading…
Cancel
Save