2014-01-19 14:34:01 +00:00
|
|
|
require_relative '../spec_helper'
|
|
|
|
|
|
|
|
describe 'dhcp::default' do
|
|
|
|
let(:chef_run) do
|
|
|
|
ChefSpec::Runner.new do |node|
|
2014-01-27 10:13:56 +00:00
|
|
|
node.set["dhcp"] ={
|
|
|
|
domain: {
|
|
|
|
names: ["foo"],
|
|
|
|
servers: ["node0.foo"]
|
|
|
|
},
|
|
|
|
ntp_servers: ["foo.lctp"],
|
|
|
|
interfaces: ["eth1"],
|
|
|
|
subnet: {
|
|
|
|
gateway: "172.28.128.1",
|
|
|
|
prefix: "172.28.128.0",
|
|
|
|
netmask: "255.255.255.0"
|
|
|
|
},
|
|
|
|
hosts: {
|
|
|
|
node1: {
|
|
|
|
mac: "5c:a1:ab:1e:00:02"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2014-01-19 14:34:01 +00:00
|
|
|
end.converge(described_recipe)
|
|
|
|
end
|
|
|
|
|
|
|
|
it "should setup dhcp" do
|
2014-01-21 22:11:25 +00:00
|
|
|
chef_run.should render_file("/etc/dhcp/dhcpd.conf").with_content("node0")
|
2014-01-19 14:34:01 +00:00
|
|
|
chef_run.should install_package("isc-dhcp-server")
|
|
|
|
end
|
|
|
|
end
|