From 1ebe52ef9963391f13b406c843c8f475668f173c Mon Sep 17 00:00:00 2001 From: Phil Pham Date: Fri, 14 Feb 2014 11:16:15 -0800 Subject: add beaker-rspec support This adds support for beaker-rspec as well as basic test coverage for git --- spec/spec_helper_acceptance.rb | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 spec/spec_helper_acceptance.rb (limited to 'spec/spec_helper_acceptance.rb') diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb new file mode 100644 index 0000000..dec9331 --- /dev/null +++ b/spec/spec_helper_acceptance.rb @@ -0,0 +1,39 @@ +require 'beaker-rspec' + +unless ENV['RS_PROVISION'] == 'no' + hosts.each do |host| + # Install Puppet + if host.is_pe? + install_pe + else + install_puppet + end + end +end + +RSpec.configure do |c| + # Project root + proj_root = File.expand_path(File.join(File.dirname(__FILE__), '..')) + + # Readable test descriptions + c.formatter = :documentation + + # Configure all nodes in nodeset + c.before :suite do + # Install module and dependencies + puppet_module_install(:source => proj_root, :module_name => 'vcsrepo') + hosts.each do |host| + case fact('osfamily') + when 'RedHat' + install_package(host, 'git') + when 'Debian' + install_package(host, 'git-core') + else + if !check_for_package(host, 'git') + puts "Git package is required for this module" + exit + end + end + end + end +end -- cgit v1.2.3 From 521d321181c95eb042c23c8277e79cfe1d066117 Mon Sep 17 00:00:00 2001 From: Hunter Haugen Date: Tue, 27 May 2014 12:41:31 -0700 Subject: Update tests for ubuntu 14.04 In ubuntu 14.04 git 1.9.1 is the default version, and 1.9+ fatally fail if the user.email and user.name are not set (previously it would just warn). This commit sets those up so the tests will actually run. --- spec/spec_helper_acceptance.rb | 2 ++ 1 file changed, 2 insertions(+) (limited to 'spec/spec_helper_acceptance.rb') diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index dec9331..d0d84d0 100644 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -34,6 +34,8 @@ RSpec.configure do |c| exit end end + shell('git config --global user.email "root@localhost"') + shell('git config --global user.name "root"') end end end -- cgit v1.2.3 From b55d04145e0ff2ebcb59515fa348ff1e9d22b4e2 Mon Sep 17 00:00:00 2001 From: Hunter Haugen Date: Mon, 16 Jun 2014 10:27:12 -0700 Subject: Need to make the moduledir before scping the module to agents --- spec/spec_helper_acceptance.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'spec/spec_helper_acceptance.rb') diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index d0d84d0..7ffedf0 100644 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -7,6 +7,7 @@ unless ENV['RS_PROVISION'] == 'no' install_pe else install_puppet + on host, "mkdir -p #{host['distmoduledir']}" end end end -- cgit v1.2.3 From c98fc9385884f4e8416cbd67302ba7c94c0deb67 Mon Sep 17 00:00:00 2001 From: Hunter Haugen Date: Mon, 16 Jun 2014 10:45:29 -0700 Subject: Fix typo in mkdir --- spec/spec_helper_acceptance.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'spec/spec_helper_acceptance.rb') diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index 7ffedf0..1294710 100644 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -7,7 +7,7 @@ unless ENV['RS_PROVISION'] == 'no' install_pe else install_puppet - on host, "mkdir -p #{host['distmoduledir']}" + on hosts, "mkdir -p #{host['distmoduledir']}" end end end -- cgit v1.2.3 From 29c335fd633850db1fa60bc7b4ad19f2eaa131eb Mon Sep 17 00:00:00 2001 From: Hunter Haugen Date: Mon, 16 Jun 2014 10:51:52 -0700 Subject: More typos --- spec/spec_helper_acceptance.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'spec/spec_helper_acceptance.rb') diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index 1294710..c371f1f 100644 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -7,7 +7,7 @@ unless ENV['RS_PROVISION'] == 'no' install_pe else install_puppet - on hosts, "mkdir -p #{host['distmoduledir']}" + on hosts, "mkdir -p #{hosts.first['distmoduledir']}" end end end -- cgit v1.2.3 From 02c38ece76ba621807f0a415d0ea90fff0f395bb Mon Sep 17 00:00:00 2001 From: Justin Stoller Date: Wed, 18 Jun 2014 14:02:33 -0700 Subject: (QENG-798) Update acceptance helpers to create distmoduledir Previously we were creating the module dir on foss installs, but not on PE. PE agents do not have a module dir deployed as part of the base PE install, so to test on PE agents we need to create the module dir. `mkdir -p` is idempotent, so we use it as a cudgle here. We also update the beaker_helper and spec_helper_acceptance to contain the same installation steps for test dependencies, warnings, and installation methods. --- spec/spec_helper_acceptance.rb | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'spec/spec_helper_acceptance.rb') diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index c371f1f..e566a12 100644 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -9,6 +9,12 @@ unless ENV['RS_PROVISION'] == 'no' install_puppet on hosts, "mkdir -p #{hosts.first['distmoduledir']}" end + + # We ask the host to interpolate it's distmoduledir because we don't + # actually know it on Windows until we've let it redirect us (depending + # on whether we're running as a 32/64 bit process on 32/64 bit Windows + moduledir = on(host, "echo #{host['distmoduledir']}").stdout.chomp + on host, "mkdir -p #{moduledir}" end end @@ -21,10 +27,12 @@ RSpec.configure do |c| # Configure all nodes in nodeset c.before :suite do - # Install module and dependencies + # Install module and dependencies on all hosts puppet_module_install(:source => proj_root, :module_name => 'vcsrepo') + + # ensure test dependencies are available on all hosts hosts.each do |host| - case fact('osfamily') + case fact_on(host, 'osfamily') when 'RedHat' install_package(host, 'git') when 'Debian' @@ -35,8 +43,8 @@ RSpec.configure do |c| exit end end - shell('git config --global user.email "root@localhost"') - shell('git config --global user.name "root"') + on host, 'git config --global user.email "root@localhost"' + on host, 'git config --global user.name "root"' end end end -- cgit v1.2.3 From 6624f40651f44e184878a9fbb862bda886d899e8 Mon Sep 17 00:00:00 2001 From: Hunter Haugen Date: Wed, 18 Jun 2014 13:54:51 -0700 Subject: (MODULES-660) Correct detached HEAD on latest Previously vcsrepo detached HEAD on checkout which caused further branch revisions to fail. This corrects the behavior, and works on git 1.7, 1.8, 1.9, and 2.0 --- spec/spec_helper_acceptance.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'spec/spec_helper_acceptance.rb') diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index e566a12..d37c169 100644 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -1,6 +1,6 @@ require 'beaker-rspec' -unless ENV['RS_PROVISION'] == 'no' +unless ENV['RS_PROVISION'] == 'no' or ENV['BEAKER_provision'] == 'no' hosts.each do |host| # Install Puppet if host.is_pe? -- cgit v1.2.3 From fc07485e8b33ba4c8280900f72104e489151dec8 Mon Sep 17 00:00:00 2001 From: Morgan Haskel Date: Thu, 28 Aug 2014 18:46:41 -0400 Subject: Update spec_helper for more consistency --- spec/spec_helper_acceptance.rb | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'spec/spec_helper_acceptance.rb') diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index d37c169..8ca20a8 100644 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -1,12 +1,14 @@ require 'beaker-rspec' unless ENV['RS_PROVISION'] == 'no' or ENV['BEAKER_provision'] == 'no' + # This will install the latest available package on el and deb based + # systems fail on windows and osx, and install via gem on other *nixes + foss_opts = { :default_action => 'gem_install' } + + if default.is_pe?; then install_pe; else install_puppet( foss_opts ); end + hosts.each do |host| - # Install Puppet - if host.is_pe? - install_pe - else - install_puppet + unless host.is_pe? on hosts, "mkdir -p #{hosts.first['distmoduledir']}" end -- cgit v1.2.3 From 71e516172eff4615308c307e3cc4775a5c4d40ab Mon Sep 17 00:00:00 2001 From: Travis Fields Date: Wed, 10 Sep 2014 10:54:28 -0700 Subject: Fix issue with puppet_module_install, removed and using updated method from beaker core copy_module_to --- spec/spec_helper_acceptance.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'spec/spec_helper_acceptance.rb') diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index d37c169..06f8271 100644 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -27,11 +27,10 @@ RSpec.configure do |c| # Configure all nodes in nodeset c.before :suite do - # Install module and dependencies on all hosts - puppet_module_install(:source => proj_root, :module_name => 'vcsrepo') # ensure test dependencies are available on all hosts hosts.each do |host| + copy_module_to(host, :source => proj_root, :module_name => 'vcsrepo') case fact_on(host, 'osfamily') when 'RedHat' install_package(host, 'git') -- cgit v1.2.3 From 477c19773628c2b68c10d2bfc4dc9d6af019c2a1 Mon Sep 17 00:00:00 2001 From: Justin Stoller Date: Wed, 15 Oct 2014 12:41:46 -0700 Subject: (FM-1951) Ensure Git is installable on EL 5 platforms Git is not installed on EL 5, but it is not in the repos either. With this patch, if we are going to install git on an EL 5 platform we first ensure epel is installed(FM-1951) Ensure Git is installable on EL 5 platforms --- spec/spec_helper_acceptance.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'spec/spec_helper_acceptance.rb') diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index f37a9b0..9ef826a 100644 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -20,6 +20,7 @@ unless ENV['RS_PROVISION'] == 'no' or ENV['BEAKER_provision'] == 'no' end end + RSpec.configure do |c| # Project root proj_root = File.expand_path(File.join(File.dirname(__FILE__), '..')) @@ -35,9 +36,21 @@ RSpec.configure do |c| copy_module_to(host, :source => proj_root, :module_name => 'vcsrepo') case fact_on(host, 'osfamily') when 'RedHat' + if fact_on(host, 'operatingsystemmajrelease') == '5' + will_install_git = on(host, 'which git', :acceptable_exit_codes => [0,1]).exit_code == 1 + + if will_install_git + on host, puppet('module install stahnma-epel') + apply_manifest_on( host, 'include epel' ) + end + + end + install_package(host, 'git') + when 'Debian' install_package(host, 'git-core') + else if !check_for_package(host, 'git') puts "Git package is required for this module" -- cgit v1.2.3 From a37c388f1b4c7b2d3db12fefe35261d067486f9f Mon Sep 17 00:00:00 2001 From: Justin Stoller Date: Mon, 8 Jun 2015 22:32:54 -0700 Subject: (maint) allow setting PUPPET_VERSION in acceptance --- spec/spec_helper_acceptance.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'spec/spec_helper_acceptance.rb') diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index 9ef826a..78074f7 100644 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -3,7 +3,10 @@ require 'beaker-rspec' unless ENV['RS_PROVISION'] == 'no' or ENV['BEAKER_provision'] == 'no' # This will install the latest available package on el and deb based # systems fail on windows and osx, and install via gem on other *nixes - foss_opts = { :default_action => 'gem_install' } + foss_opts = { + :default_action => 'gem_install', + :version => (ENV['PUPPET_VERSION'] || '3.8.1'), + } if default.is_pe?; then install_pe; else install_puppet( foss_opts ); end -- cgit v1.2.3 From 153b27bef2cc146465938a7a168da5ebe439c9f8 Mon Sep 17 00:00:00 2001 From: Hunter Haugen Date: Thu, 11 Jun 2015 15:41:17 -0700 Subject: Add helper to install puppet/pe/puppet-agent --- spec/spec_helper_acceptance.rb | 25 ++----------------------- 1 file changed, 2 insertions(+), 23 deletions(-) (limited to 'spec/spec_helper_acceptance.rb') diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index 78074f7..97c43e8 100644 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -1,28 +1,7 @@ require 'beaker-rspec' +require 'beaker/puppet_install_helper' -unless ENV['RS_PROVISION'] == 'no' or ENV['BEAKER_provision'] == 'no' - # This will install the latest available package on el and deb based - # systems fail on windows and osx, and install via gem on other *nixes - foss_opts = { - :default_action => 'gem_install', - :version => (ENV['PUPPET_VERSION'] || '3.8.1'), - } - - if default.is_pe?; then install_pe; else install_puppet( foss_opts ); end - - hosts.each do |host| - unless host.is_pe? - on hosts, "mkdir -p #{hosts.first['distmoduledir']}" - end - - # We ask the host to interpolate it's distmoduledir because we don't - # actually know it on Windows until we've let it redirect us (depending - # on whether we're running as a 32/64 bit process on 32/64 bit Windows - moduledir = on(host, "echo #{host['distmoduledir']}").stdout.chomp - on host, "mkdir -p #{moduledir}" - end -end - +run_puppet_install_helper RSpec.configure do |c| # Project root -- cgit v1.2.3