From a364605f3b71b8a0857bbc2c47388f7bb9e11f82 Mon Sep 17 00:00:00 2001 From: Morgan Haskel Date: Tue, 3 Jun 2014 11:13:35 -0400 Subject: Merge pull request #264 from apenney/fixes-for-tests Fixes for PE3.3. --- spec/acceptance/fqdn_rotate_spec.rb | 1 + spec/acceptance/parseyaml_spec.rb | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'spec') diff --git a/spec/acceptance/fqdn_rotate_spec.rb b/spec/acceptance/fqdn_rotate_spec.rb index b7f8bf8..fc8bea2 100755 --- a/spec/acceptance/fqdn_rotate_spec.rb +++ b/spec/acceptance/fqdn_rotate_spec.rb @@ -14,6 +14,7 @@ describe 'fqdn_rotate function', :unless => UNSUPPORTED_PLATFORMS.include?(fact( shell("if [ -f #{facts_d}/fqdn.txt ] ; then rm #{facts_d}/fqdn.txt ; fi") end it 'fqdn_rotates floats' do + shell("mkdir -p #{facts_d}") shell("echo 'fqdn=fakehost.localdomain' > #{facts_d}/fqdn.txt") pp = <<-EOS $a = ['a','b','c','d'] diff --git a/spec/acceptance/parseyaml_spec.rb b/spec/acceptance/parseyaml_spec.rb index 4b4bf3d..5819837 100755 --- a/spec/acceptance/parseyaml_spec.rb +++ b/spec/acceptance/parseyaml_spec.rb @@ -26,7 +26,7 @@ describe 'parseyaml function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('o EOS apply_manifest(pp, :expect_failures => true) do |r| - expect(r.stderr).to match(/syntax error/) + expect(r.stderr).to match(/(syntax error|did not find expected key)/) end end -- cgit v1.2.3 From af71faa247043e01fc31ef8248304e8e20a25d6f Mon Sep 17 00:00:00 2001 From: Morgan Haskel Date: Tue, 3 Jun 2014 14:53:04 -0400 Subject: Merge pull request #265 from apenney/fix-tests Further fixes to tests for 14.04. --- spec/acceptance/ensure_packages_spec.rb | 2 +- spec/acceptance/shuffle_spec.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'spec') diff --git a/spec/acceptance/ensure_packages_spec.rb b/spec/acceptance/ensure_packages_spec.rb index 145bdc5..aa7b14c 100755 --- a/spec/acceptance/ensure_packages_spec.rb +++ b/spec/acceptance/ensure_packages_spec.rb @@ -11,7 +11,7 @@ describe 'ensure_packages function', :unless => UNSUPPORTED_PLATFORMS.include?(f EOS apply_manifest(pp, :expect_changes => true) do |r| - expect(r.stdout).to match(/Package\[zsh\]\/ensure: created/) + expect(r.stdout).to match(/Package\[zsh\]\/ensure: (created|ensure changed 'purged' to 'present')/) end end it 'ensures a package already declared' diff --git a/spec/acceptance/shuffle_spec.rb b/spec/acceptance/shuffle_spec.rb index 02d1201..b840d1f 100755 --- a/spec/acceptance/shuffle_spec.rb +++ b/spec/acceptance/shuffle_spec.rb @@ -5,14 +5,14 @@ describe 'shuffle function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('ope describe 'success' do it 'shuffles arrays' do pp = <<-EOS - $a = ["the","public","art","galleries"] + $a = ["1", "2", "3", "4", "5", "6", "7", "8", "the","public","art","galleries"] # Anagram: Large picture halls, I bet $o = shuffle($a) notice(inline_template('shuffle is <%= @o.inspect %>')) EOS apply_manifest(pp, :catch_failures => true) do |r| - expect(r.stdout).to_not match(/shuffle is \["the", "public", "art", "galleries"\]/) + expect(r.stdout).to_not match(/shuffle is \["1", "2", "3", "4", "5", "6", "7", "8", "the", "public", "art", "galleries"\]/) end end it 'shuffles strings' do -- cgit v1.2.3 From 197e2d7e70d6570e82d2056d89de9e5e035b5750 Mon Sep 17 00:00:00 2001 From: Hunter Haugen Date: Thu, 19 Jun 2014 15:38:23 -0700 Subject: (FM-1587) Fix test issues on solaris 10 - ensure_packages fails because Error: Sun packages must specify a package source - ensure_resource fails for the same reason - get_module_path fails because the modulepath is different - has_interface_with fails because the interface is lo0 not lo --- spec/acceptance/ensure_packages_spec.rb | 4 ++-- spec/acceptance/ensure_resource_spec.rb | 4 ++-- spec/acceptance/get_module_path_spec.rb | 18 ++---------------- spec/acceptance/has_interface_with_spec.rb | 6 +++++- 4 files changed, 11 insertions(+), 21 deletions(-) (limited to 'spec') diff --git a/spec/acceptance/ensure_packages_spec.rb b/spec/acceptance/ensure_packages_spec.rb index aa7b14c..f3d2256 100755 --- a/spec/acceptance/ensure_packages_spec.rb +++ b/spec/acceptance/ensure_packages_spec.rb @@ -6,8 +6,8 @@ describe 'ensure_packages function', :unless => UNSUPPORTED_PLATFORMS.include?(f it 'ensure_packages a package' do apply_manifest('package { "zsh": ensure => absent, }') pp = <<-EOS - $a = "zsh" - ensure_packages($a) + $a = "rake" + ensure_packages($a,{'provider' => 'gem'}) EOS apply_manifest(pp, :expect_changes => true) do |r| diff --git a/spec/acceptance/ensure_resource_spec.rb b/spec/acceptance/ensure_resource_spec.rb index c4d8887..725f5df 100755 --- a/spec/acceptance/ensure_resource_spec.rb +++ b/spec/acceptance/ensure_resource_spec.rb @@ -6,8 +6,8 @@ describe 'ensure_resource function', :unless => UNSUPPORTED_PLATFORMS.include?(f it 'ensure_resource a package' do apply_manifest('package { "zsh": ensure => absent, }') 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| 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/has_interface_with_spec.rb b/spec/acceptance/has_interface_with_spec.rb index 41ae19f..7b38c95 100755 --- a/spec/acceptance/has_interface_with_spec.rb +++ b/spec/acceptance/has_interface_with_spec.rb @@ -27,7 +27,11 @@ describe 'has_interface_with function', :unless => UNSUPPORTED_PLATFORMS.include end it 'has_interface_with existing interface' do pp = <<-EOS - $a = 'lo' + if $osfamily == 'Solaris' { + $a = 'lo0' + } else { + $a = 'lo' + } $o = has_interface_with($a) notice(inline_template('has_interface_with is <%= @o.inspect %>')) EOS -- cgit v1.2.3 From 7eda161be88e4eeca44a288cb0394f51ea9e0621 Mon Sep 17 00:00:00 2001 From: Hunter Haugen Date: Fri, 20 Jun 2014 10:41:43 -0700 Subject: Patch ensure_* tests --- spec/acceptance/ensure_packages_spec.rb | 6 ++---- spec/acceptance/ensure_resource_spec.rb | 6 ++---- 2 files changed, 4 insertions(+), 8 deletions(-) (limited to 'spec') diff --git a/spec/acceptance/ensure_packages_spec.rb b/spec/acceptance/ensure_packages_spec.rb index f3d2256..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 = "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 725f5df..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 = "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' -- cgit v1.2.3 From 24a6fecc78824ae411065aaca68e5250790bd778 Mon Sep 17 00:00:00 2001 From: Travis Fields Date: Fri, 20 Jun 2014 16:39:15 -0700 Subject: Add windows Nodesets and remove Beaker from Gemfile --- Gemfile | 1 - spec/acceptance/nodesets/windows-2003-i386.yml | 26 ++++++++++++++++++++++ spec/acceptance/nodesets/windows-2003-x86_64.yml | 26 ++++++++++++++++++++++ spec/acceptance/nodesets/windows-2008-x86_64.yml | 26 ++++++++++++++++++++++ spec/acceptance/nodesets/windows-2008r2-x86_64.yml | 26 ++++++++++++++++++++++ spec/acceptance/nodesets/windows-2012-x86_64.yml | 26 ++++++++++++++++++++++ spec/acceptance/nodesets/windows-2012r2-x86_64.yml | 26 ++++++++++++++++++++++ 7 files changed, 156 insertions(+), 1 deletion(-) create mode 100644 spec/acceptance/nodesets/windows-2003-i386.yml create mode 100644 spec/acceptance/nodesets/windows-2003-x86_64.yml create mode 100644 spec/acceptance/nodesets/windows-2008-x86_64.yml create mode 100644 spec/acceptance/nodesets/windows-2008r2-x86_64.yml create mode 100644 spec/acceptance/nodesets/windows-2012-x86_64.yml create mode 100644 spec/acceptance/nodesets/windows-2012r2-x86_64.yml (limited to 'spec') diff --git a/Gemfile b/Gemfile index bbef720..c2e58ed 100644 --- a/Gemfile +++ b/Gemfile @@ -18,7 +18,6 @@ group :development, :test do gem 'puppet-lint', :require => false gem 'pry', :require => false gem 'simplecov', :require => false - gem 'beaker', :require => false gem 'beaker-rspec', :require => false end 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/ -- cgit v1.2.3 From 4b7162896a0a4ec5dc5166c8846eb5968a3c5329 Mon Sep 17 00:00:00 2001 From: Hunter Haugen Date: Mon, 23 Jun 2014 13:45:06 -0700 Subject: OS X also has lo0 and can't manage user homedirs --- spec/acceptance/getparam_spec.rb | 12 ++++++------ spec/acceptance/has_interface_with_spec.rb | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'spec') diff --git a/spec/acceptance/getparam_spec.rb b/spec/acceptance/getparam_spec.rb index 91fc9a0..e3e442f 100755 --- a/spec/acceptance/getparam_spec.rb +++ b/spec/acceptance/getparam_spec.rb @@ -3,18 +3,18 @@ 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': + ensure => present, + 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 7b38c95..99b7681 100755 --- a/spec/acceptance/has_interface_with_spec.rb +++ b/spec/acceptance/has_interface_with_spec.rb @@ -27,7 +27,7 @@ describe 'has_interface_with function', :unless => UNSUPPORTED_PLATFORMS.include end it 'has_interface_with existing interface' do pp = <<-EOS - if $osfamily == 'Solaris' { + if $osfamily == 'Solaris' or $osfamily == 'Darwin' { $a = 'lo0' } else { $a = 'lo' -- cgit v1.2.3 From 280d808eb4284daa32b81d4ac90da96a5609a625 Mon Sep 17 00:00:00 2001 From: Hunter Haugen Date: Mon, 23 Jun 2014 13:47:34 -0700 Subject: Augeas isn't present on windows --- spec/acceptance/validate_augeas_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'spec') 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 -- cgit v1.2.3 From f7b7c4a6ece9d9e5d551ea77867289eee4cfe8e8 Mon Sep 17 00:00:00 2001 From: Hunter Haugen Date: Mon, 23 Jun 2014 15:13:29 -0700 Subject: Windows needs a tmpdir path --- spec/acceptance/loadyaml_spec.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'spec') 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 %>')) -- cgit v1.2.3 From 0199e2396aa841fb8d34e8c33da2373e2b2c9416 Mon Sep 17 00:00:00 2001 From: Travis Fields Date: Mon, 23 Jun 2014 16:59:46 -0700 Subject: Add windows support and work around issue with SCP_TO on windows systems --- spec/spec_helper_acceptance.rb | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'spec') diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index 8e56daa..dc2cfdc 100755 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -6,7 +6,12 @@ UNSUPPORTED_PLATFORMS = [] unless ENV['RS_PROVISION'] == 'no' or ENV['BEAKER_provision'] == 'no' if hosts.first.is_pe? install_pe - on hosts, 'mkdir -p /etc/puppetlabs/facter/facts.d' + hosts.each do |host| + if !(host['platform'] =~ /windows/) + on host, 'mkdir -p /etc/puppetlabs/facter/facts.d' + end + end + else install_puppet on hosts, 'mkdir -p /etc/facter/facts.d' @@ -26,6 +31,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 -- cgit v1.2.3 From 78f5141290926aaabec3980aae9d923c7bf1d359 Mon Sep 17 00:00:00 2001 From: Travis Fields Date: Mon, 23 Jun 2014 17:24:08 -0700 Subject: Removed platform check for facts.d mkdir --- spec/spec_helper_acceptance.rb | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'spec') diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index dc2cfdc..e9ccc68 100755 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -6,12 +6,7 @@ UNSUPPORTED_PLATFORMS = [] unless ENV['RS_PROVISION'] == 'no' or ENV['BEAKER_provision'] == 'no' if hosts.first.is_pe? install_pe - hosts.each do |host| - if !(host['platform'] =~ /windows/) - on host, 'mkdir -p /etc/puppetlabs/facter/facts.d' - end - end - + on hosts, 'mkdir -p /etc/puppetlabs/facter/facts.d' else install_puppet on hosts, 'mkdir -p /etc/facter/facts.d' -- cgit v1.2.3 From eb507c9a5486d269ec6a36f169eb68695910bfbf Mon Sep 17 00:00:00 2001 From: Travis Fields Date: Mon, 23 Jun 2014 23:27:59 -0700 Subject: Fixed fqdn,getparam and has_interface_with spec tests --- spec/acceptance/fqdn_rotate_spec.rb | 19 ++++++++++++++++--- spec/acceptance/getparam_spec.rb | 1 - spec/acceptance/has_interface_with_spec.rb | 10 ++++++++-- 3 files changed, 24 insertions(+), 6 deletions(-) (limited to 'spec') 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) -- cgit v1.2.3 From ca35be6480a5935a4b0e0721bdb726934269e433 Mon Sep 17 00:00:00 2001 From: Hunter Haugen Date: Tue, 24 Jun 2014 11:37:34 -0700 Subject: Fix pe facts and slashes --- spec/acceptance/fqdn_rotate_spec.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'spec') diff --git a/spec/acceptance/fqdn_rotate_spec.rb b/spec/acceptance/fqdn_rotate_spec.rb index 2527c28..bc02eb6 100755 --- a/spec/acceptance/fqdn_rotate_spec.rb +++ b/spec/acceptance/fqdn_rotate_spec.rb @@ -4,12 +4,12 @@ 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" + 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' + 'C:\\Documents and Settings\\All Users\\Application Data\\PuppetLabs\\facter\\facts.d' else - 'C:\ProgramData\PuppetLabs\facter\facts.d' + 'C:\\ProgramData\\PuppetLabs\\facter\\facts.d' end else '/etc/puppetlabs/facter/facts.d' -- cgit v1.2.3 From 0cac9fd0489180d7b6ae59ce67334dc34ddcc961 Mon Sep 17 00:00:00 2001 From: Hunter Haugen Date: Tue, 24 Jun 2014 15:03:58 -0700 Subject: Not enough escape velocity --- spec/acceptance/fqdn_rotate_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'spec') diff --git a/spec/acceptance/fqdn_rotate_spec.rb b/spec/acceptance/fqdn_rotate_spec.rb index bc02eb6..d56c2b1 100755 --- a/spec/acceptance/fqdn_rotate_spec.rb +++ b/spec/acceptance/fqdn_rotate_spec.rb @@ -7,9 +7,9 @@ describe 'fqdn_rotate function', :unless => UNSUPPORTED_PLATFORMS.include?(fact( 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' + 'C:/Documents and Settings/All Users/Application Data/PuppetLabs/facter/facts.d' else - 'C:\\ProgramData\\PuppetLabs\\facter\\facts.d' + 'C:/ProgramData/PuppetLabs/facter/facts.d' end else '/etc/puppetlabs/facter/facts.d' -- cgit v1.2.3 From 05b79dcabbdb67aab322fa6e12e77532ab044749 Mon Sep 17 00:00:00 2001 From: Hunter Haugen Date: Wed, 25 Jun 2014 10:16:06 -0700 Subject: Disable windows network stuff and quote path --- spec/acceptance/fqdn_rotate_spec.rb | 2 +- spec/acceptance/has_interface_with_spec.rb | 2 +- spec/acceptance/has_ip_address_spec.rb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'spec') diff --git a/spec/acceptance/fqdn_rotate_spec.rb b/spec/acceptance/fqdn_rotate_spec.rb index d56c2b1..ee2afb5 100755 --- a/spec/acceptance/fqdn_rotate_spec.rb +++ b/spec/acceptance/fqdn_rotate_spec.rb @@ -28,7 +28,7 @@ describe 'fqdn_rotate function', :unless => UNSUPPORTED_PLATFORMS.include?(fact( end end it 'fqdn_rotates floats' do - 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/has_interface_with_spec.rb b/spec/acceptance/has_interface_with_spec.rb index c9decdf..b09199a 100755 --- a/spec/acceptance/has_interface_with_spec.rb +++ b/spec/acceptance/has_interface_with_spec.rb @@ -1,7 +1,7 @@ #! /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')) do describe 'success' do it 'has_interface_with existing ipaddress' do pp = <<-EOS diff --git a/spec/acceptance/has_ip_address_spec.rb b/spec/acceptance/has_ip_address_spec.rb index 7d5fd87..50eb8f5 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')) do describe 'success' do it 'has_ip_address existing ipaddress' do pp = <<-EOS -- cgit v1.2.3 From b93f71f0ced2cb87e4817e2eb4858fb1e47f3901 Mon Sep 17 00:00:00 2001 From: Hunter Haugen Date: Thu, 26 Jun 2014 13:12:39 -0700 Subject: has_ip_network doesn't work on windows either --- spec/acceptance/has_ip_network_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'spec') diff --git a/spec/acceptance/has_ip_network_spec.rb b/spec/acceptance/has_ip_network_spec.rb index 692eaf9..1628746 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')) do describe 'success' do it 'has_ip_network existing ipaddress' do pp = <<-EOS -- cgit v1.2.3 From 1b893ff653d64ca8a923ab37a0c222fc35c0eb5f Mon Sep 17 00:00:00 2001 From: Hunter Haugen Date: Thu, 26 Jun 2014 13:17:07 -0700 Subject: Need quotes for spaces in path --- spec/acceptance/fqdn_rotate_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'spec') diff --git a/spec/acceptance/fqdn_rotate_spec.rb b/spec/acceptance/fqdn_rotate_spec.rb index ee2afb5..c37b35a 100755 --- a/spec/acceptance/fqdn_rotate_spec.rb +++ b/spec/acceptance/fqdn_rotate_spec.rb @@ -19,12 +19,12 @@ describe 'fqdn_rotate function', :unless => UNSUPPORTED_PLATFORMS.include?(fact( 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}") + shell("mkdir -p '#{facts_d}'") end end it 'fqdn_rotates floats' do -- cgit v1.2.3 From ec607827ad659431341383b92cee20cfd0603203 Mon Sep 17 00:00:00 2001 From: Hunter Haugen Date: Thu, 26 Jun 2014 13:55:57 -0700 Subject: Gotta single quote yer typewriter buttons --- spec/acceptance/chop_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'spec') 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.") -- cgit v1.2.3 From 07462f2c3619e4d6589b364f11b01ea9ca37ac61 Mon Sep 17 00:00:00 2001 From: Hunter Haugen Date: Tue, 8 Jul 2014 13:45:36 -0700 Subject: AIX has no facter network support These functions take advantage of IP fact information and AIX does not appear to support dynamic interface detection in facter. --- spec/acceptance/has_interface_with_spec.rb | 2 +- spec/acceptance/has_ip_address_spec.rb | 2 +- spec/acceptance/has_ip_network_spec.rb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'spec') diff --git a/spec/acceptance/has_interface_with_spec.rb b/spec/acceptance/has_interface_with_spec.rb index b09199a..9590193 100755 --- a/spec/acceptance/has_interface_with_spec.rb +++ b/spec/acceptance/has_interface_with_spec.rb @@ -1,7 +1,7 @@ #! /usr/bin/env ruby -S rspec require 'spec_helper_acceptance' -describe 'has_interface_with function', :unless => ((UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem'))) or (fact('osfamily') == 'windows')) 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 diff --git a/spec/acceptance/has_ip_address_spec.rb b/spec/acceptance/has_ip_address_spec.rb index 50eb8f5..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'))) or (fact('osfamily') == 'windows')) 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 1628746..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'))) or (fact('osfamily') == 'windows')) 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 -- cgit v1.2.3