diff options
author | Hunter Haugen <hunter@puppetlabs.com> | 2014-08-05 10:55:58 -0700 |
---|---|---|
committer | Hunter Haugen <hunter@puppetlabs.com> | 2014-08-05 10:55:58 -0700 |
commit | 2ba0e375e2bb5b4a85eac781f02f6a3e8b96e0f6 (patch) | |
tree | 3e6519a658f623c81667271c8c6f9a8b431f6aa2 /spec/acceptance | |
parent | e310b1fdab7be1478b464167d2be20f0d4e5f63a (diff) | |
parent | 4c62b7a2eeec8d6e49ae8b05f2ed000a2b544cc2 (diff) |
Merge branch '4.3.x'
Diffstat (limited to 'spec/acceptance')
-rwxr-xr-x | spec/acceptance/chop_spec.rb | 2 | ||||
-rwxr-xr-x | spec/acceptance/ensure_packages_spec.rb | 10 | ||||
-rwxr-xr-x | spec/acceptance/ensure_resource_spec.rb | 10 | ||||
-rwxr-xr-x | spec/acceptance/fqdn_rotate_spec.rb | 23 | ||||
-rwxr-xr-x | spec/acceptance/get_module_path_spec.rb | 18 | ||||
-rwxr-xr-x | spec/acceptance/getparam_spec.rb | 11 | ||||
-rwxr-xr-x | spec/acceptance/has_interface_with_spec.rb | 16 | ||||
-rwxr-xr-x | spec/acceptance/has_ip_address_spec.rb | 2 | ||||
-rwxr-xr-x | spec/acceptance/has_ip_network_spec.rb | 2 | ||||
-rw-r--r-- | spec/acceptance/loadyaml_spec.rb | 8 | ||||
-rw-r--r-- | spec/acceptance/nodesets/windows-2003-i386.yml | 26 | ||||
-rw-r--r-- | spec/acceptance/nodesets/windows-2003-x86_64.yml | 26 | ||||
-rw-r--r-- | spec/acceptance/nodesets/windows-2008-x86_64.yml | 26 | ||||
-rw-r--r-- | spec/acceptance/nodesets/windows-2008r2-x86_64.yml | 26 | ||||
-rw-r--r-- | spec/acceptance/nodesets/windows-2012-x86_64.yml | 26 | ||||
-rw-r--r-- | spec/acceptance/nodesets/windows-2012r2-x86_64.yml | 26 | ||||
-rwxr-xr-x | spec/acceptance/validate_augeas_spec.rb | 2 |
17 files changed, 211 insertions, 49 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 |