Skip to content

Commit

Permalink
Merge pull request redhat-openstack#285 from cyberious/4.3.x
Browse files Browse the repository at this point in the history
Fixed fqdn,getparam and has_interface_with spec tests
  • Loading branch information
Morgan Haskel committed Jun 24, 2014
2 parents 0427248 + eb507c9 commit 4e9906f
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 6 deletions.
19 changes: 16 additions & 3 deletions spec/acceptance/fqdn_rotate_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,30 @@
describe 'success' do
let(:facts_d) do
if fact('is_pe') == "true"
'/etc/puppetlabs/facter/facts.d'
if fact('osfamily') =~ /windows/i
if fact('kernelmajversion').to_f < 6.0
'C:\Documents and Settings\All Users\Application Data\PuppetLabs\facter\facts.d'
else
'C:\ProgramData\PuppetLabs\facter\facts.d'
end
else
'/etc/puppetlabs/facter/facts.d'
end
else
'/etc/facter/facts.d'
end
end
after :each do
shell("if [ -f #{facts_d}/fqdn.txt ] ; then rm #{facts_d}/fqdn.txt ; fi")
end
before :all do
#No need to create on windows, PE creates by default
if fact('osfamily') !~ /windows/i
shell("mkdir -p #{facts_d}")
end
end
it 'fqdn_rotates floats' do
shell("mkdir -p #{facts_d}")
shell("echo 'fqdn=fakehost.localdomain' > #{facts_d}/fqdn.txt")
shell("echo fqdn=fakehost.localdomain > #{facts_d}/fqdn.txt")
pp = <<-EOS
$a = ['a','b','c','d']
$o = fqdn_rotate($a)
Expand Down
1 change: 0 additions & 1 deletion spec/acceptance/getparam_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
it 'getparam a notify' do
pp = <<-EOS
notify { 'rspec':
ensure => present,
message => 'custom rspec message',
}
$o = getparam(Notify['rspec'], 'message')
Expand Down
10 changes: 8 additions & 2 deletions spec/acceptance/has_interface_with_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
describe 'success' do
it 'has_interface_with existing ipaddress' do
pp = <<-EOS
$a = '127.0.0.1'
$a = $::ipaddress
$o = has_interface_with('ipaddress', $a)
notice(inline_template('has_interface_with is <%= @o.inspect %>'))
EOS
Expand All @@ -29,7 +29,13 @@
pp = <<-EOS
if $osfamily == 'Solaris' or $osfamily == 'Darwin' {
$a = 'lo0'
} else {
}elsif $osfamily == 'windows' {
$a = $::kernelmajversion ? {
/6\.(2|3|4)/ => 'Ethernet0',
/6\.(0|1)/ => 'Local_Area_Connection',
/5\.(1|2)/ => undef, #Broken current in facter
}
}else {
$a = 'lo'
}
$o = has_interface_with($a)
Expand Down

0 comments on commit 4e9906f

Please sign in to comment.