Suggest different variables to use if we want to tunnel both v4 and v6
[mirror/dsa-puppet.git] / 3rdparty / modules / stdlib / spec / acceptance / has_interface_with_spec.rb
1 require 'spec_helper_acceptance'
2
3 describe 'has_interface_with function', :unless => ((fact('osfamily') == 'windows') || (fact('osfamily') == 'AIX')) do
4   describe 'success' do
5     pp1 = <<-DOC
6       $a = $::ipaddress
7       $o = has_interface_with('ipaddress', $a)
8       notice(inline_template('has_interface_with is <%= @o.inspect %>'))
9     DOC
10     it 'has_interface_with existing ipaddress' do
11       apply_manifest(pp1, :catch_failures => true) do |r|
12         expect(r.stdout).to match(%r{has_interface_with is true})
13       end
14     end
15
16     pp2 = <<-DOC
17       $a = '128.0.0.1'
18       $o = has_interface_with('ipaddress', $a)
19       notice(inline_template('has_interface_with is <%= @o.inspect %>'))
20     DOC
21     it 'has_interface_with absent ipaddress' do
22       apply_manifest(pp2, :catch_failures => true) do |r|
23         expect(r.stdout).to match(%r{has_interface_with is false})
24       end
25     end
26
27     pp3 = <<-DOC
28       if $osfamily == 'Solaris' or $osfamily == 'Darwin' {
29         $a = 'lo0'
30       }elsif $osfamily == 'windows' {
31         $a = $::kernelmajversion ? {
32           /6\.(2|3|4)/ => 'Ethernet0',
33           /6\.(0|1)/ => 'Local_Area_Connection',
34           /5\.(1|2)/  => undef, #Broken current in facter
35         }
36       }else {
37         $a = 'lo'
38       }
39       $o = has_interface_with($a)
40       notice(inline_template('has_interface_with is <%= @o.inspect %>'))
41     DOC
42     it 'has_interface_with existing interface' do
43       apply_manifest(pp3, :catch_failures => true) do |r|
44         expect(r.stdout).to match(%r{has_interface_with is true})
45       end
46     end
47   end
48   describe 'failure' do
49     it 'handles no arguments'
50     it 'handles non strings'
51   end
52 end