summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorHunter Haugen <hunter@puppetlabs.com>2014-08-05 10:55:58 -0700
committerHunter Haugen <hunter@puppetlabs.com>2014-08-05 10:55:58 -0700
commit2ba0e375e2bb5b4a85eac781f02f6a3e8b96e0f6 (patch)
tree3e6519a658f623c81667271c8c6f9a8b431f6aa2 /spec
parente310b1fdab7be1478b464167d2be20f0d4e5f63a (diff)
parent4c62b7a2eeec8d6e49ae8b05f2ed000a2b544cc2 (diff)
downloadpuppet-stdlib-2ba0e375e2bb5b4a85eac781f02f6a3e8b96e0f6.tar.gz
puppet-stdlib-2ba0e375e2bb5b4a85eac781f02f6a3e8b96e0f6.tar.bz2
Merge branch '4.3.x'
Diffstat (limited to 'spec')
-rwxr-xr-xspec/acceptance/chop_spec.rb2
-rwxr-xr-xspec/acceptance/ensure_packages_spec.rb10
-rwxr-xr-xspec/acceptance/ensure_resource_spec.rb10
-rwxr-xr-xspec/acceptance/fqdn_rotate_spec.rb23
-rwxr-xr-xspec/acceptance/get_module_path_spec.rb18
-rwxr-xr-xspec/acceptance/getparam_spec.rb11
-rwxr-xr-xspec/acceptance/has_interface_with_spec.rb16
-rwxr-xr-xspec/acceptance/has_ip_address_spec.rb2
-rwxr-xr-xspec/acceptance/has_ip_network_spec.rb2
-rw-r--r--spec/acceptance/loadyaml_spec.rb8
-rw-r--r--spec/acceptance/nodesets/windows-2003-i386.yml26
-rw-r--r--spec/acceptance/nodesets/windows-2003-x86_64.yml26
-rw-r--r--spec/acceptance/nodesets/windows-2008-x86_64.yml26
-rw-r--r--spec/acceptance/nodesets/windows-2008r2-x86_64.yml26
-rw-r--r--spec/acceptance/nodesets/windows-2012-x86_64.yml26
-rw-r--r--spec/acceptance/nodesets/windows-2012r2-x86_64.yml26
-rwxr-xr-xspec/acceptance/validate_augeas_spec.rb2
-rwxr-xr-xspec/spec_helper_acceptance.rb11
18 files changed, 221 insertions, 50 deletions
diff --git a/spec/acceptance/chop_spec.rb b/spec/acceptance/chop_spec.rb
index dbc28da..a16a710 100755
--- a/spec/acceptance/chop_spec.rb
+++ b/spec/acceptance/chop_spec.rb
@@ -19,7 +19,7 @@ describe 'chop function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operat
end
it 'should eat the last two characters of \r\n' do
- pp = <<-EOS
+ pp = <<-'EOS'
$input = "test\r\n"
if size($input) != 6 {
fail("Size of ${input} is not 6.")
diff --git a/spec/acceptance/ensure_packages_spec.rb b/spec/acceptance/ensure_packages_spec.rb
index aa7b14c..12da0cd 100755
--- a/spec/acceptance/ensure_packages_spec.rb
+++ b/spec/acceptance/ensure_packages_spec.rb
@@ -4,15 +4,13 @@ require 'spec_helper_acceptance'
describe 'ensure_packages function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
describe 'success' do
it 'ensure_packages a package' do
- apply_manifest('package { "zsh": ensure => absent, }')
+ apply_manifest('package { "rake": ensure => absent, provider => "gem", }')
pp = <<-EOS
- $a = "zsh"
- ensure_packages($a)
+ $a = "rake"
+ ensure_packages($a,{'provider' => 'gem'})
EOS
- apply_manifest(pp, :expect_changes => true) do |r|
- expect(r.stdout).to match(/Package\[zsh\]\/ensure: (created|ensure changed 'purged' to 'present')/)
- end
+ apply_manifest(pp, :expect_changes => true)
end
it 'ensures a package already declared'
it 'takes defaults arguments'
diff --git a/spec/acceptance/ensure_resource_spec.rb b/spec/acceptance/ensure_resource_spec.rb
index c4d8887..2aad243 100755
--- a/spec/acceptance/ensure_resource_spec.rb
+++ b/spec/acceptance/ensure_resource_spec.rb
@@ -4,15 +4,13 @@ require 'spec_helper_acceptance'
describe 'ensure_resource function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
describe 'success' do
it 'ensure_resource a package' do
- apply_manifest('package { "zsh": ensure => absent, }')
+ apply_manifest('package { "rake": ensure => absent, provider => "gem", }')
pp = <<-EOS
- $a = "zsh"
- ensure_resource('package', $a)
+ $a = "rake"
+ ensure_resource('package', $a, {'provider' => 'gem'})
EOS
- apply_manifest(pp, :expect_changes => true) do |r|
- expect(r.stdout).to match(/Package\[zsh\]\/ensure: created/)
- end
+ apply_manifest(pp, :expect_changes => true)
end
it 'ensures a resource already declared'
it 'takes defaults arguments'
diff --git a/spec/acceptance/fqdn_rotate_spec.rb b/spec/acceptance/fqdn_rotate_spec.rb
index fc8bea2..c37b35a 100755
--- a/spec/acceptance/fqdn_rotate_spec.rb
+++ b/spec/acceptance/fqdn_rotate_spec.rb
@@ -4,18 +4,31 @@ require 'spec_helper_acceptance'
describe 'fqdn_rotate function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
describe 'success' do
let(:facts_d) do
- if fact('is_pe') == "true"
- '/etc/puppetlabs/facter/facts.d'
+ if fact('is_pe', '--puppet') == "true"
+ 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")
+ 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/get_module_path_spec.rb b/spec/acceptance/get_module_path_spec.rb
index 34d91fa..6ac690c 100755
--- a/spec/acceptance/get_module_path_spec.rb
+++ b/spec/acceptance/get_module_path_spec.rb
@@ -3,22 +3,6 @@ require 'spec_helper_acceptance'
describe 'get_module_path function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
describe 'success' do
- it 'get_module_paths stdlib' do
- pp = <<-EOS
- $a = $::is_pe ? {
- 'true' => '/opt/puppet/share/puppet/modules/stdlib',
- 'false' => '/etc/puppet/modules/stdlib',
- }
- $o = get_module_path('stdlib')
- if $o == $a {
- notify { 'output correct': }
- }
- EOS
-
- apply_manifest(pp, :catch_failures => true) do |r|
- expect(r.stdout).to match(/Notice: output correct/)
- end
- end
it 'get_module_paths dne' do
pp = <<-EOS
$a = $::is_pe ? {
@@ -28,6 +12,8 @@ describe 'get_module_path function', :unless => UNSUPPORTED_PLATFORMS.include?(f
$o = get_module_path('dne')
if $o == $a {
notify { 'output correct': }
+ } else {
+ notify { "failed; module path is '$o'": }
}
EOS
diff --git a/spec/acceptance/getparam_spec.rb b/spec/acceptance/getparam_spec.rb
index 91fc9a0..b1a677e 100755
--- a/spec/acceptance/getparam_spec.rb
+++ b/spec/acceptance/getparam_spec.rb
@@ -3,18 +3,17 @@ require 'spec_helper_acceptance'
describe 'getparam function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
describe 'success' do
- it 'getparam a package' do
+ it 'getparam a notify' do
pp = <<-EOS
- user { "rspec":
- ensure => present,
- managehome => true,
+ notify { 'rspec':
+ message => 'custom rspec message',
}
- $o = getparam(User['rspec'], 'managehome')
+ $o = getparam(Notify['rspec'], 'message')
notice(inline_template('getparam is <%= @o.inspect %>'))
EOS
apply_manifest(pp, :catch_failures => true) do |r|
- expect(r.stdout).to match(/getparam is true/)
+ expect(r.stdout).to match(/getparam is "custom rspec message"/)
end
end
end
diff --git a/spec/acceptance/has_interface_with_spec.rb b/spec/acceptance/has_interface_with_spec.rb
index 41ae19f..9590193 100755
--- a/spec/acceptance/has_interface_with_spec.rb
+++ b/spec/acceptance/has_interface_with_spec.rb
@@ -1,11 +1,11 @@
#! /usr/bin/env ruby -S rspec
require 'spec_helper_acceptance'
-describe 'has_interface_with function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+describe 'has_interface_with function', :unless => ((UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem'))) or (fact('osfamily') == 'windows') or (fact('osfamily') == 'AIX')) do
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
@@ -27,7 +27,17 @@ describe 'has_interface_with function', :unless => UNSUPPORTED_PLATFORMS.include
end
it 'has_interface_with existing interface' do
pp = <<-EOS
- $a = 'lo'
+ if $osfamily == 'Solaris' or $osfamily == 'Darwin' {
+ $a = 'lo0'
+ }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)
notice(inline_template('has_interface_with is <%= @o.inspect %>'))
EOS
diff --git a/spec/acceptance/has_ip_address_spec.rb b/spec/acceptance/has_ip_address_spec.rb
index 7d5fd87..149a10d 100755
--- a/spec/acceptance/has_ip_address_spec.rb
+++ b/spec/acceptance/has_ip_address_spec.rb
@@ -1,7 +1,7 @@
#! /usr/bin/env ruby -S rspec
require 'spec_helper_acceptance'
-describe 'has_ip_address function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+describe 'has_ip_address function', :unless => ((UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem'))) or (fact('osfamily') == 'windows') or (fact('osfamily') == 'AIX')) do
describe 'success' do
it 'has_ip_address existing ipaddress' do
pp = <<-EOS
diff --git a/spec/acceptance/has_ip_network_spec.rb b/spec/acceptance/has_ip_network_spec.rb
index 692eaf9..7d2f34e 100755
--- a/spec/acceptance/has_ip_network_spec.rb
+++ b/spec/acceptance/has_ip_network_spec.rb
@@ -1,7 +1,7 @@
#! /usr/bin/env ruby -S rspec
require 'spec_helper_acceptance'
-describe 'has_ip_network function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+describe 'has_ip_network function', :unless => ((UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem'))) or (fact('osfamily') == 'windows') or (fact('osfamily') == 'AIX')) do
describe 'success' do
it 'has_ip_network existing ipaddress' do
pp = <<-EOS
diff --git a/spec/acceptance/loadyaml_spec.rb b/spec/acceptance/loadyaml_spec.rb
index 944a727..1e910a9 100644
--- a/spec/acceptance/loadyaml_spec.rb
+++ b/spec/acceptance/loadyaml_spec.rb
@@ -1,16 +1,18 @@
#! /usr/bin/env ruby -S rspec
require 'spec_helper_acceptance'
+tmpdir = default.tmpdir('stdlib')
+
describe 'loadyaml function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
describe 'success' do
it 'loadyamls array of values' do
- shell('echo "---
+ shell("echo '---
aaa: 1
bbb: 2
ccc: 3
- ddd: 4" > /testyaml.yaml')
+ ddd: 4' > #{tmpdir}/testyaml.yaml")
pp = <<-EOS
- $o = loadyaml('/testyaml.yaml')
+ $o = loadyaml('#{tmpdir}/testyaml.yaml')
notice(inline_template('loadyaml[aaa] is <%= @o["aaa"].inspect %>'))
notice(inline_template('loadyaml[bbb] is <%= @o["bbb"].inspect %>'))
notice(inline_template('loadyaml[ccc] is <%= @o["ccc"].inspect %>'))
diff --git a/spec/acceptance/nodesets/windows-2003-i386.yml b/spec/acceptance/nodesets/windows-2003-i386.yml
new file mode 100644
index 0000000..47dadbd
--- /dev/null
+++ b/spec/acceptance/nodesets/windows-2003-i386.yml
@@ -0,0 +1,26 @@
+HOSTS:
+ ubuntu1204:
+ roles:
+ - master
+ - database
+ - dashboard
+ platform: ubuntu-12.04-amd64
+ template: ubuntu-1204-x86_64
+ hypervisor: vcloud
+ win2003_i386:
+ roles:
+ - agent
+ - default
+ platform: windows-2003-i386
+ template: win-2003-i386
+ hypervisor: vcloud
+CONFIG:
+ nfs_server: none
+ ssh:
+ keys: "~/.ssh/id_rsa-acceptance"
+ consoleport: 443
+ datastore: instance0
+ folder: Delivery/Quality Assurance/Enterprise/Dynamic
+ resourcepool: delivery/Quality Assurance/Enterprise/Dynamic
+ pooling_api: http://vcloud.delivery.puppetlabs.net/
+ pe_dir: http://neptune.puppetlabs.lan/3.2/ci-ready/
diff --git a/spec/acceptance/nodesets/windows-2003-x86_64.yml b/spec/acceptance/nodesets/windows-2003-x86_64.yml
new file mode 100644
index 0000000..6a884bc
--- /dev/null
+++ b/spec/acceptance/nodesets/windows-2003-x86_64.yml
@@ -0,0 +1,26 @@
+HOSTS:
+ ubuntu1204:
+ roles:
+ - master
+ - database
+ - dashboard
+ platform: ubuntu-12.04-amd64
+ template: ubuntu-1204-x86_64
+ hypervisor: vcloud
+ win2003_x86_64:
+ roles:
+ - agent
+ - default
+ platform: windows-2003-x86_64
+ template: win-2003-x86_64
+ hypervisor: vcloud
+CONFIG:
+ nfs_server: none
+ ssh:
+ keys: "~/.ssh/id_rsa-acceptance"
+ consoleport: 443
+ datastore: instance0
+ folder: Delivery/Quality Assurance/Enterprise/Dynamic
+ resourcepool: delivery/Quality Assurance/Enterprise/Dynamic
+ pooling_api: http://vcloud.delivery.puppetlabs.net/
+ pe_dir: http://neptune.puppetlabs.lan/3.2/ci-ready/
diff --git a/spec/acceptance/nodesets/windows-2008-x86_64.yml b/spec/acceptance/nodesets/windows-2008-x86_64.yml
new file mode 100644
index 0000000..ae3c11d
--- /dev/null
+++ b/spec/acceptance/nodesets/windows-2008-x86_64.yml
@@ -0,0 +1,26 @@
+HOSTS:
+ ubuntu1204:
+ roles:
+ - master
+ - database
+ - dashboard
+ platform: ubuntu-12.04-amd64
+ template: ubuntu-1204-x86_64
+ hypervisor: vcloud
+ win2008_x86_64:
+ roles:
+ - agent
+ - default
+ platform: windows-2008-x86_64
+ template: win-2008-x86_64
+ hypervisor: vcloud
+CONFIG:
+ nfs_server: none
+ ssh:
+ keys: "~/.ssh/id_rsa-acceptance"
+ consoleport: 443
+ datastore: instance0
+ folder: Delivery/Quality Assurance/Enterprise/Dynamic
+ resourcepool: delivery/Quality Assurance/Enterprise/Dynamic
+ pooling_api: http://vcloud.delivery.puppetlabs.net/
+ pe_dir: http://neptune.puppetlabs.lan/3.2/ci-ready/
diff --git a/spec/acceptance/nodesets/windows-2008r2-x86_64.yml b/spec/acceptance/nodesets/windows-2008r2-x86_64.yml
new file mode 100644
index 0000000..63923ac
--- /dev/null
+++ b/spec/acceptance/nodesets/windows-2008r2-x86_64.yml
@@ -0,0 +1,26 @@
+HOSTS:
+ ubuntu1204:
+ roles:
+ - master
+ - database
+ - dashboard
+ platform: ubuntu-12.04-amd64
+ template: ubuntu-1204-x86_64
+ hypervisor: vcloud
+ win2008r2:
+ roles:
+ - agent
+ - default
+ platform: windows-2008r2-x86_64
+ template: win-2008r2-x86_64
+ hypervisor: vcloud
+CONFIG:
+ nfs_server: none
+ ssh:
+ keys: "~/.ssh/id_rsa-acceptance"
+ consoleport: 443
+ datastore: instance0
+ folder: Delivery/Quality Assurance/Enterprise/Dynamic
+ resourcepool: delivery/Quality Assurance/Enterprise/Dynamic
+ pooling_api: http://vcloud.delivery.puppetlabs.net/
+ pe_dir: http://neptune.puppetlabs.lan/3.2/ci-ready/
diff --git a/spec/acceptance/nodesets/windows-2012-x86_64.yml b/spec/acceptance/nodesets/windows-2012-x86_64.yml
new file mode 100644
index 0000000..eaa4eca
--- /dev/null
+++ b/spec/acceptance/nodesets/windows-2012-x86_64.yml
@@ -0,0 +1,26 @@
+HOSTS:
+ ubuntu1204:
+ roles:
+ - master
+ - database
+ - dashboard
+ platform: ubuntu-12.04-amd64
+ template: ubuntu-1204-x86_64
+ hypervisor: vcloud
+ win2012:
+ roles:
+ - agent
+ - default
+ platform: windows-2012-x86_64
+ template: win-2012-x86_64
+ hypervisor: vcloud
+CONFIG:
+ nfs_server: none
+ ssh:
+ keys: "~/.ssh/id_rsa-acceptance"
+ consoleport: 443
+ datastore: instance0
+ folder: Delivery/Quality Assurance/Enterprise/Dynamic
+ resourcepool: delivery/Quality Assurance/Enterprise/Dynamic
+ pooling_api: http://vcloud.delivery.puppetlabs.net/
+ pe_dir: http://neptune.puppetlabs.lan/3.2/ci-ready/
diff --git a/spec/acceptance/nodesets/windows-2012r2-x86_64.yml b/spec/acceptance/nodesets/windows-2012r2-x86_64.yml
new file mode 100644
index 0000000..1f0ea97
--- /dev/null
+++ b/spec/acceptance/nodesets/windows-2012r2-x86_64.yml
@@ -0,0 +1,26 @@
+HOSTS:
+ ubuntu1204:
+ roles:
+ - master
+ - database
+ - dashboard
+ platform: ubuntu-12.04-amd64
+ template: ubuntu-1204-x86_64
+ hypervisor: vcloud
+ win2012r2:
+ roles:
+ - agent
+ - default
+ platform: windows-2012r2-x86_64
+ template: win-2012r2-x86_64
+ hypervisor: vcloud
+CONFIG:
+ nfs_server: none
+ ssh:
+ keys: "~/.ssh/id_rsa-acceptance"
+ consoleport: 443
+ datastore: instance0
+ folder: Delivery/Quality Assurance/Enterprise/Dynamic
+ resourcepool: delivery/Quality Assurance/Enterprise/Dynamic
+ pooling_api: http://vcloud.delivery.puppetlabs.net/
+ pe_dir: http://neptune.puppetlabs.lan/3.2/ci-ready/
diff --git a/spec/acceptance/validate_augeas_spec.rb b/spec/acceptance/validate_augeas_spec.rb
index aeec67a..71a4c84 100755
--- a/spec/acceptance/validate_augeas_spec.rb
+++ b/spec/acceptance/validate_augeas_spec.rb
@@ -1,7 +1,7 @@
#! /usr/bin/env ruby -S rspec
require 'spec_helper_acceptance'
-describe 'validate_augeas function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+describe 'validate_augeas function', :unless => ((UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem'))) or (fact('osfamily') == 'windows')) do
describe 'prep' do
it 'installs augeas for tests'
end
diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb
index 8e56daa..e9ccc68 100755
--- a/spec/spec_helper_acceptance.rb
+++ b/spec/spec_helper_acceptance.rb
@@ -26,6 +26,15 @@ RSpec.configure do |c|
# Configure all nodes in nodeset
c.before :suite do
- puppet_module_install(:source => proj_root, :module_name => 'stdlib')
+ hosts.each do |host|
+ if host['platform'] !~ /windows/i
+ copy_root_module_to(host, :source => proj_root, :module_name => 'stdlib')
+ end
+ end
+ hosts.each do |host|
+ if host['platform'] =~ /windows/i
+ on host, puppet('plugin download')
+ end
+ end
end
end