summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMorgan Haskel <morgan@puppetlabs.com>2014-06-24 09:10:25 -0400
committerMorgan Haskel <morgan@puppetlabs.com>2014-06-24 09:10:25 -0400
commit4e9906f84dc720da4b56f30895ac9dbc3037c7a0 (patch)
treea54cbd5a65d8451579d011579c27f20b364ae03d
parent0427248cf0f93b4ec9b371616b335b4918066cbb (diff)
parenteb507c9a5486d269ec6a36f169eb68695910bfbf (diff)
Merge pull request #285 from cyberious/4.3.x
Fixed fqdn,getparam and has_interface_with spec tests
-rwxr-xr-xspec/acceptance/fqdn_rotate_spec.rb19
-rwxr-xr-xspec/acceptance/getparam_spec.rb1
-rwxr-xr-xspec/acceptance/has_interface_with_spec.rb10
3 files changed, 24 insertions, 6 deletions
diff --git a/spec/acceptance/fqdn_rotate_spec.rb b/spec/acceptance/fqdn_rotate_spec.rb
index fc8bea2..2527c28 100755
--- a/spec/acceptance/fqdn_rotate_spec.rb
+++ b/spec/acceptance/fqdn_rotate_spec.rb
@@ -5,7 +5,15 @@ describe 'fqdn_rotate function', :unless => UNSUPPORTED_PLATFORMS.include?(fact(
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
@@ -13,9 +21,14 @@ describe 'fqdn_rotate function', :unless => UNSUPPORTED_PLATFORMS.include?(fact(
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)
diff --git a/spec/acceptance/getparam_spec.rb b/spec/acceptance/getparam_spec.rb
index e3e442f..b1a677e 100755
--- a/spec/acceptance/getparam_spec.rb
+++ b/spec/acceptance/getparam_spec.rb
@@ -6,7 +6,6 @@ describe 'getparam function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('op
it 'getparam a notify' do
pp = <<-EOS
notify { 'rspec':
- ensure => present,
message => 'custom rspec message',
}
$o = getparam(Notify['rspec'], 'message')
diff --git a/spec/acceptance/has_interface_with_spec.rb b/spec/acceptance/has_interface_with_spec.rb
index 99b7681..c9decdf 100755
--- a/spec/acceptance/has_interface_with_spec.rb
+++ b/spec/acceptance/has_interface_with_spec.rb
@@ -5,7 +5,7 @@ describe 'has_interface_with function', :unless => UNSUPPORTED_PLATFORMS.include
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
@@ -29,7 +29,13 @@ describe 'has_interface_with function', :unless => UNSUPPORTED_PLATFORMS.include
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)