Skip to content

Improve Tests #8

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Aug 24, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions run-tests
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,10 @@ for TEST in tests/*.sh; do
RUNTEST_CALLED=0
EXPECT_FAILURE=0
busctl_called=0
# Set/Reset expected results
TEST_BUSCTL_DNS=""
TEST_BUSCTL_DOMAINS=""
TEST_BUSCTL_DNSSEC=""
# Keep this random, as we will never know the ifindex up-front
ip_ifindex=$((RANDOM%=64))
# Clear foreign_option_*
Expand All @@ -153,6 +157,7 @@ for TEST in tests/*.sh; do
foreign_option_3=""
foreign_option_4=""
foreign_option_5=""
foreign_option_6=""

# Import the test configuration
source "${TEST}"
Expand Down
2 changes: 0 additions & 2 deletions tests/01_no_updates.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,3 @@ dev="tun01"

TEST_TITLE="No Updates"
TEST_BUSCTL_CALLED=0
TEST_BUSCTL_DNS=""
TEST_BUSCTL_DOMAINS=""
1 change: 0 additions & 1 deletion tests/02_single_ipv4_dns.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,3 @@ foreign_option_1="dhcp-option DNS 1.23.4.56"
TEST_TITLE="Single IPv4 DNS Server"
TEST_BUSCTL_CALLED=1
TEST_BUSCTL_DNS="1 2 4 1 23 4 56"
TEST_BUSCTL_DOMAINS=""
1 change: 0 additions & 1 deletion tests/03_multiple_ipv4_dns_1.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,3 @@ foreign_option_2="dhcp-option DNS 5.6.7.89"
TEST_TITLE="Multiple IPv4 DNS Servers (Part 1)"
TEST_BUSCTL_CALLED=1
TEST_BUSCTL_DNS="2 2 4 1 23 4 56 2 4 5 6 7 89"
TEST_BUSCTL_DOMAINS=""
1 change: 0 additions & 1 deletion tests/04_multiple_ipv4_dns_2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,3 @@ foreign_option_3="dhcp-option DNS 34.5.67.8"
TEST_TITLE="Multiple IPv4 DNS Servers (Part 2)"
TEST_BUSCTL_CALLED=1
TEST_BUSCTL_DNS="3 2 4 1 23 4 56 2 4 5 6 7 89 2 4 34 5 67 8"
TEST_BUSCTL_DOMAINS=""
1 change: 0 additions & 1 deletion tests/05_dns_domain_only.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@ foreign_option_1="dhcp-option DOMAIN example.com"

TEST_TITLE="DNS Domain Only"
TEST_BUSCTL_CALLED=1
TEST_BUSCTL_DNS=""
TEST_BUSCTL_DOMAINS="1 example.com false"
1 change: 0 additions & 1 deletion tests/06_dns_domain_and_search_1.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,4 @@ foreign_option_2="dhcp-option DOMAIN-SEARCH example.org"

TEST_TITLE="DNS Domain and Search (Part 1)"
TEST_BUSCTL_CALLED=1
TEST_BUSCTL_DNS=""
TEST_BUSCTL_DOMAINS="2 example.com false example.org true"
1 change: 0 additions & 1 deletion tests/07_dns_domain_and_search_2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@ foreign_option_3="dhcp-option DOMAIN-SEARCH example.net"

TEST_TITLE="DNS Domain and Search (Part 2)"
TEST_BUSCTL_CALLED=1
TEST_BUSCTL_DNS=""
TEST_BUSCTL_DOMAINS="3 example.com false example.org true example.net true"
1 change: 0 additions & 1 deletion tests/10_single_ipv6_dns_full.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,3 @@ foreign_option_1="dhcp-option DNS 1234:5678:90ab:cdef:4321:8765:ba09:fedc"
TEST_TITLE="Single IPv6 DNS Server (Full)"
TEST_BUSCTL_CALLED=1
TEST_BUSCTL_DNS="1 2 16 18 52 86 120 144 171 205 239 67 33 135 101 186 9 254 220"
TEST_BUSCTL_DOMAINS=""
1 change: 0 additions & 1 deletion tests/11_single_ipv6_dns_simple.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,3 @@ foreign_option_1="dhcp-option DNS 1234:567:89:0:ab:cde:f123:4567"
TEST_TITLE="Single IPv6 DNS Server (Full, Simple)"
TEST_BUSCTL_CALLED=1
TEST_BUSCTL_DNS="1 2 16 18 52 5 103 0 137 0 0 0 171 12 222 241 35 69 103"
TEST_BUSCTL_DOMAINS=""
1 change: 0 additions & 1 deletion tests/12_single_ipv6_dns_compact_1.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,3 @@ foreign_option_1="dhcp-option DNS 1234:567:89:0:ab:cde:f123:4567"
TEST_TITLE="Single IPv6 DNS Server (Compact) (Part 1)"
TEST_BUSCTL_CALLED=1
TEST_BUSCTL_DNS="1 2 16 18 52 5 103 0 137 0 0 0 171 12 222 241 35 69 103"
TEST_BUSCTL_DOMAINS=""
1 change: 0 additions & 1 deletion tests/13_single_ipv6_dns_compact_2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,3 @@ foreign_option_1="dhcp-option DNS 1234:567:89::ab:cdef"
TEST_TITLE="Single IPv6 DNS Server (Compact) (Part 2)"
TEST_BUSCTL_CALLED=1
TEST_BUSCTL_DNS="1 2 16 18 52 5 103 0 137 0 0 0 0 0 0 0 171 205 239"
TEST_BUSCTL_DOMAINS=""
1 change: 0 additions & 1 deletion tests/14_single_ipv6_dns_compact_3.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,3 @@ foreign_option_1="dhcp-option DNS 20a0::1"
TEST_TITLE="Single IPv6 DNS Server (Compact) (Part 3)"
TEST_BUSCTL_CALLED=1
TEST_BUSCTL_DNS="1 2 16 32 160 0 0 0 0 0 0 0 0 0 0 0 0 0 1"
TEST_BUSCTL_DOMAINS=""
1 change: 0 additions & 1 deletion tests/15_single_ipv6_dns_localhost.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,3 @@ foreign_option_1="dhcp-option DNS ::1"
TEST_TITLE="Single IPv6 DNS Server (Localhost)"
TEST_BUSCTL_CALLED=1
TEST_BUSCTL_DNS="1 2 16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1"
TEST_BUSCTL_DOMAINS=""
1 change: 0 additions & 1 deletion tests/16_dual_ipv6_single_ipv4.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,3 @@ foreign_option_2="dhcp-option DNS 1.23.4.56"
TEST_TITLE="Single IPv6 and Single IPv4 DNS Servers"
TEST_BUSCTL_CALLED=1
TEST_BUSCTL_DNS="2 2 16 18 52 5 103 0 137 0 0 0 0 0 0 0 171 205 239 2 4 1 23 4 56"
TEST_BUSCTL_DOMAINS=""
1 change: 0 additions & 1 deletion tests/17_single_ipv6_single_ipv4.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,3 @@ foreign_option_3="dhcp-option DNS 20a0::1"
TEST_TITLE="Single IPv6 and Single IPv4 DNS Servers"
TEST_BUSCTL_CALLED=1
TEST_BUSCTL_DNS="3 2 16 18 52 5 103 0 137 0 0 0 0 0 0 0 171 205 239 2 4 1 23 4 56 2 16 32 160 0 0 0 0 0 0 0 0 0 0 0 0 0 1"
TEST_BUSCTL_DOMAINS=""
18 changes: 9 additions & 9 deletions tests/19_dns_invalid_ipv6.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@ TEST_BUSCTL_CALLED=0
EXPECT_FAILURE=1

declare -A test_attrs=(
["has more than one \`::'"]='1234::567::89:ab'
['too long']='1234:567:89:a:b:c:d:e:f'
['single 0 shortened']='1234::567:89:ab:c:de:f'
['zero-run in wrong location']='1234:0:0:567:89::ab'
['compressed run not longest zero-run']='1234:0:0:0:567::89'
['not maximally compressed']='2001:db8::0:1'
["has more than one \`::'"]='1234::567::89:ab'
['too long']='1234:567:89:a:b:c:d:e:f'
['single 0 shortened']='1234::567:89:ab:c:de:f'
['zero-run in wrong location']='1234:0:0:567:89::ab'
['compressed run not longest zero-run']='1234:0:0:0:567::89'
['not maximally compressed']='2001:db8::0:1'
)

for test_title in "${!test_attrs[@]}"; do
TEST_TITLE="DNS IPv6 address $test_title"
foreign_option_1="dhcp-option DNS ${test_attrs["$test_title"]}"
runtest
TEST_TITLE="DNS IPv6 address $test_title"
foreign_option_1="dhcp-option DNS ${test_attrs["$test_title"]}"
runtest
done
3 changes: 1 addition & 2 deletions update-systemd-resolved
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ DBUS_NODE="/org/freedesktop/resolve1"
SCRIPT_NAME="${BASH_SOURCE[0]##*/}"

log() {
logger --id="$$" -t "$SCRIPT_NAME" "$@"
echo "$@"
logger -s --id="$$" -t "$SCRIPT_NAME" "$@"
}

for level in emerg err warning info debug; do
Expand Down