]> gitweb.fluxo.info Git - puppet-dhcp.git/commitdiff
acceptance for failover
authorCédric Jeanneret <cedric.jeanneret@camptocamp.com>
Fri, 6 Nov 2015 07:43:52 +0000 (08:43 +0100)
committerCédric Jeanneret <cedric.jeanneret@camptocamp.com>
Fri, 6 Nov 2015 07:43:52 +0000 (08:43 +0100)
spec/acceptance/dhcp_failover_spec.rb [new file with mode: 0644]
spec/defines/dhcp_failover_spec.rb

diff --git a/spec/acceptance/dhcp_failover_spec.rb b/spec/acceptance/dhcp_failover_spec.rb
new file mode 100644 (file)
index 0000000..5e93c67
--- /dev/null
@@ -0,0 +1,38 @@
+require 'spec_helper_acceptance'
+
+describe 'dhcp::failover' do
+  describe 'with defaults' do
+    it 'should work with no error' do
+      pp = <<-EOS
+      class { 'dhcp::server': }
+      dhcp::failover {'my-failover':
+        peer_address => '1.1.1.1',
+        options      => {
+          'max-response-delay'       => 30,
+          'max-unacked-updates'      => 10,
+          'load balance max seconds' => 3,
+          'mclt'                     => 1800,
+          'split'                    => 128,
+        }
+      }
+      $ipaddr = split($::networking['interfaces']['eth0']['ip'], '[.]')
+      $sub = "${ipaddr[0]}.${ipaddr[1]}.${ipaddr[2]}"
+      dhcp::subnet {$::networking['interfaces']['eth0']['network']:
+        broadcast   => "${sub}.255",
+        subnet_mask => $::networking['interfaces']['eth0']['netmask'],
+        domain_name => 'test.com',
+        other_opts  => [
+          "option domain-name-servers ${sub}.1, ${sub}.2",
+          'option domain-search "test.com", "internal.test.com"',
+          'pool {',
+          'failover peer "my-failover"',
+          "range ${sub}.100 ${sub}.250",
+          '}',
+        ]
+      }
+      EOS
+      apply_manifest(pp, :catch_failures => true)
+      apply_manifest(pp, :catch_changes  => true)
+    end
+  end
+end
index d8400b0c933452a7a2af1c1f72a8fae3101c43cf..75b30fb9d8ec835f41c2e924af069b4ea9484db9 100644 (file)
@@ -21,7 +21,7 @@ describe 'dhcp::failover' do
 
         it 'should fail' do
           expect {
-            should contain_file('/etc/dhcp/failover/failover-dhcp.conf')
+            should contain_file('/etc/dhcp/failover.d/failover-dhcp.conf')
           }.to raise_error(Puppet::Error, /"foo" does not match \["present", "absent"\]/)
         end
       end
@@ -34,7 +34,7 @@ describe 'dhcp::failover' do
 
         it 'should fail' do
           expect {
-            should contain_file('/etc/dhcp/failover/failover-dhcp.conf')
+            should contain_file('/etc/dhcp/failover.d/failover-dhcp.conf')
           }.to raise_error(Puppet::Error, /true is not a string\./)
         end
       end
@@ -47,7 +47,7 @@ describe 'dhcp::failover' do
 
         it 'should fail' do
           expect {
-            should contain_file('/etc/dhcp/failover/failover-dhcp.conf')
+            should contain_file('/etc/dhcp/failover.d/failover-dhcp.conf')
           }.to raise_error(Puppet::Error, /is not a valid IPv4 address\./)
         end
       end
@@ -55,7 +55,7 @@ describe 'dhcp::failover' do
       context 'when not passing peer_address' do
         it 'should fail' do
           expect {
-            should contain_file('/etc/dhcp/failover/failover-dhcp.conf')
+            should contain_file('/etc/dhcp/failover.d/failover-dhcp.conf')
           }.to raise_error(Puppet::Error, /Must pass peer_address to Dhcp::Failover/)
         end
       end
@@ -67,7 +67,7 @@ describe 'dhcp::failover' do
 
         it 'should fail' do
           expect {
-            should contain_file('/etc/dhcp/failover/failover-dhcp.conf')
+            should contain_file('/etc/dhcp/failover.d/failover-dhcp.conf')
           }.to raise_error(Puppet::Error, /true is not a string\./)
         end
       end
@@ -79,7 +79,7 @@ describe 'dhcp::failover' do
 
         it 'should fail' do
           expect {
-            should contain_file('/etc/dhcp/failover/failover-dhcp.conf')
+            should contain_file('/etc/dhcp/failover.d/failover-dhcp.conf')
           }.to raise_error(Puppet::Error, /is not a valid IPv4 address\./)
         end
       end
@@ -92,7 +92,7 @@ describe 'dhcp::failover' do
 
         it 'should fail' do
           expect {
-            should contain_file('/etc/dhcp/failover/failover-dhcp.conf')
+            should contain_file('/etc/dhcp/failover.d/failover-dhcp.conf')
           }.to raise_error(Puppet::Error, /Expected first argument to be an Integer/)
         end
       end
@@ -105,7 +105,7 @@ describe 'dhcp::failover' do
 
         it 'should fail' do
           expect {
-            should contain_file('/etc/dhcp/failover/failover-dhcp.conf')
+            should contain_file('/etc/dhcp/failover.d/failover-dhcp.conf')
           }.to raise_error(Puppet::Error, /Expected first argument to be an Integer/)
         end
       end
@@ -117,7 +117,7 @@ describe 'dhcp::failover' do
           :peer_address => '1.2.3.4',
         } }
 
-        it { should contain_file('/etc/dhcp/failover/failover-dhcp.conf').with(
+        it { should contain_file('/etc/dhcp/failover.d/failover-dhcp.conf').with(
           :ensure  => 'file',
           :owner   => 'root',
           :group   => 'root'
@@ -135,7 +135,7 @@ describe 'dhcp::failover' do
           /peer port 647;\n/
         ) }
         it { should contain_concat__fragment('dhcp.failover.failover-dhcp').with({
-          :content => "include \"/etc/dhcp/failover/failover-dhcp.conf\";\n",
+          :content => "include \"/etc/dhcp/failover.d/failover-dhcp.conf\";\n",
           :target  => '/etc/dhcp/dhcpd.conf',
         })}
       end
@@ -152,7 +152,7 @@ describe 'dhcp::failover' do
           },
         } }
 
-        it { should contain_file('/etc/dhcp/failover/failover-dhcp.conf').with({
+        it { should contain_file('/etc/dhcp/failover.d/failover-dhcp.conf').with({
           :ensure  => 'file',
           :owner   => 'root',
           :group   => 'root'
@@ -183,7 +183,7 @@ describe 'dhcp::failover' do
           :role         => 'secondary',
         } }
 
-        it { should contain_file('/etc/dhcp/failover/failover-dhcp.conf').with({
+        it { should contain_file('/etc/dhcp/failover.d/failover-dhcp.conf').with({
           :ensure  => 'file',
           :owner   => 'root',
           :group   => 'root'