Skip to content

Commit 4e9906f

Browse files
author
Morgan Haskel
committed
Merge pull request redhat-openstack#285 from cyberious/4.3.x
Fixed fqdn,getparam and has_interface_with spec tests
2 parents 0427248 + eb507c9 commit 4e9906f

3 files changed

Lines changed: 24 additions & 6 deletions

File tree

spec/acceptance/fqdn_rotate_spec.rb

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,30 @@
55
describe 'success' do
66
let(:facts_d) do
77
if fact('is_pe') == "true"
8-
'/etc/puppetlabs/facter/facts.d'
8+
if fact('osfamily') =~ /windows/i
9+
if fact('kernelmajversion').to_f < 6.0
10+
'C:\Documents and Settings\All Users\Application Data\PuppetLabs\facter\facts.d'
11+
else
12+
'C:\ProgramData\PuppetLabs\facter\facts.d'
13+
end
14+
else
15+
'/etc/puppetlabs/facter/facts.d'
16+
end
917
else
1018
'/etc/facter/facts.d'
1119
end
1220
end
1321
after :each do
1422
shell("if [ -f #{facts_d}/fqdn.txt ] ; then rm #{facts_d}/fqdn.txt ; fi")
1523
end
24+
before :all do
25+
#No need to create on windows, PE creates by default
26+
if fact('osfamily') !~ /windows/i
27+
shell("mkdir -p #{facts_d}")
28+
end
29+
end
1630
it 'fqdn_rotates floats' do
17-
shell("mkdir -p #{facts_d}")
18-
shell("echo 'fqdn=fakehost.localdomain' > #{facts_d}/fqdn.txt")
31+
shell("echo fqdn=fakehost.localdomain > #{facts_d}/fqdn.txt")
1932
pp = <<-EOS
2033
$a = ['a','b','c','d']
2134
$o = fqdn_rotate($a)

spec/acceptance/getparam_spec.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
it 'getparam a notify' do
77
pp = <<-EOS
88
notify { 'rspec':
9-
ensure => present,
109
message => 'custom rspec message',
1110
}
1211
$o = getparam(Notify['rspec'], 'message')

spec/acceptance/has_interface_with_spec.rb

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
describe 'success' do
66
it 'has_interface_with existing ipaddress' do
77
pp = <<-EOS
8-
$a = '127.0.0.1'
8+
$a = $::ipaddress
99
$o = has_interface_with('ipaddress', $a)
1010
notice(inline_template('has_interface_with is <%= @o.inspect %>'))
1111
EOS
@@ -29,7 +29,13 @@
2929
pp = <<-EOS
3030
if $osfamily == 'Solaris' or $osfamily == 'Darwin' {
3131
$a = 'lo0'
32-
} else {
32+
}elsif $osfamily == 'windows' {
33+
$a = $::kernelmajversion ? {
34+
/6\.(2|3|4)/ => 'Ethernet0',
35+
/6\.(0|1)/ => 'Local_Area_Connection',
36+
/5\.(1|2)/ => undef, #Broken current in facter
37+
}
38+
}else {
3339
$a = 'lo'
3440
}
3541
$o = has_interface_with($a)

0 commit comments

Comments
 (0)