summaryrefslogtreecommitdiff
path: root/tests/setup_dns_test
blob: 146cbf095608d484a3f6f8da5f87d28af7b9b25d (plain)
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
#!/usr/bin/env atf-sh

. $(atf_get_srcdir)/test_env.sh
init_tests \
	setup_dns_usage \
	setup_dns_ip \
	setup_dns_domain

setup_dns_usage_body() {
	test_usage setup-dns
}

setup_dns_ip_body() {
	init_env
	atf_check -s exit:0 \
		-o empty \
		-e empty \
		setup-dns 1.1.1.1
	grep -q '^nameserver 1.1.1.1' etc/resolv.conf || atf_fail "nameserver was not set in etc/resolv.conf"
}

setup_dns_domain_body() {
	init_env
	atf_check -s exit:0 \
		-o empty \
		-e empty \
		setup-dns -d example.com 1.1.1.1
	grep -q '^nameserver 1.1.1.1' etc/resolv.conf || atf_fail "nameserver was not set in etc/resolv.conf"
	grep -q 'search example\.com' etc/resolv.conf || atf_fail "search was not set in etc/resolv.conf"
}