summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorHunter Haugen <hunter@puppetlabs.com>2014-06-19 12:29:31 -0700
committerHunter Haugen <hunter@puppetlabs.com>2014-06-19 12:29:31 -0700
commite42310c7fb082a20f4155d801e41b980400ae045 (patch)
tree4c7f1a871a24ca7dbc0378cb17abcc5186952b45 /spec
parent5a61e814677859661b473cea31c51ab8e43cb11c (diff)
parent84aac457692c18512baab28c8eae00998a7cf9a4 (diff)
downloadpuppet-vcsrepo-e42310c7fb082a20f4155d801e41b980400ae045.tar.gz
puppet-vcsrepo-e42310c7fb082a20f4155d801e41b980400ae045.tar.bz2
Merge branch '1.0.x'
Diffstat (limited to 'spec')
-rw-r--r--spec/acceptance/beaker_helper.rb36
-rw-r--r--spec/spec_helper_acceptance.rb16
2 files changed, 42 insertions, 10 deletions
diff --git a/spec/acceptance/beaker_helper.rb b/spec/acceptance/beaker_helper.rb
index 6b5fd46..05aa4e7 100644
--- a/spec/acceptance/beaker_helper.rb
+++ b/spec/acceptance/beaker_helper.rb
@@ -10,16 +10,40 @@ test_name "Installing Puppet and vcsrepo module" do
end
end
end
+
+ step 'Ensure we can install our module' do
+ # 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
+
step 'install module' do
- proj_root = File.expand_path(File.join(File.dirname(__FILE__),'..','..'))
- # Waiting on release of puppet_module_install in beaker
- #puppet_module_install(:source => proj_root, :module_name => 'vcsrepo')
- scp_to(hosts, proj_root, File.join(hosts.first['distmoduledir'], 'vcsrepo'))
- gitconfig = <<-EOS
+ hosts.each do |host|
+ proj_root = File.expand_path(File.join(File.dirname(__FILE__),'..','..'))
+
+ # This require beaker 1.12.2 I believe
+ puppet_module_install(:source => proj_root, :module_name => 'vcsrepo')
+
+ case fact_on(host, '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
+
+ gitconfig = <<-EOS
[user]
email = root@localhost
name = root
EOS
- create_remote_file(hosts.first, "/root/.gitconfig", gitconfig)
+ create_remote_file(host, "/root/.gitconfig", gitconfig)
+ end
end
end
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