diff --git a/tests/fixtures/dhcp-hostname-rewrite.interfaces b/tests/fixtures/dhcp-hostname-rewrite.interfaces new file mode 100644 index 0000000..0aa4f71 --- /dev/null +++ b/tests/fixtures/dhcp-hostname-rewrite.interfaces @@ -0,0 +1,10 @@ +iface eth0 + use dhcp + hostname foo + +iface eth1 + use dhcp + +iface eth2 + use dhcp + dhcp-hostname bar \ No newline at end of file diff --git a/tests/ifquery_test b/tests/ifquery_test index 3fac522..955bb6c 100755 --- a/tests/ifquery_test +++ b/tests/ifquery_test @@ -40,7 +40,10 @@ tests_init \ default_netmask_v4 \ default_netmask_v6 \ stanza_merging_with_cidr \ - stanza_merging_without_cidr + stanza_merging_without_cidr \ + dhcp_hostname_rewrite \ + dhcp_hostname_inference \ + dhcp_hostname_replacement noargs_body() { atf_check -s exit:1 -e ignore ifquery -S/dev/null @@ -272,3 +275,22 @@ stanza_merging_without_cidr_body() { -o match:"203.0.113.2/24" \ ifquery -i $FIXTURES/stanza-merging.interfaces -p address without-cidr } + +dhcp_hostname_rewrite_body() { + atf_check -s exit:0 \ + -o match:"dhcp-hostname foo" \ + ifquery -i $FIXTURES/dhcp-hostname-rewrite.interfaces -P eth0 +} + +dhcp_hostname_inference_body() { + hostname=$(uname -n) + atf_check -s exit:0 \ + -o match:"dhcp-hostname $hostname" \ + ifquery -i $FIXTURES/dhcp-hostname-rewrite.interfaces -P eth1 +} + +dhcp_hostname_replacement_body() { + atf_check -s exit:0 \ + -o match:"dhcp-hostname bar" \ + ifquery -i $FIXTURES/dhcp-hostname-rewrite.interfaces -P eth2 +} \ No newline at end of file