|
| 1 | +require 'beaker-rspec' |
| 2 | + |
| 3 | +files_dir = ENV['files_dir'] || '/home/jenkins/puppet' |
| 4 | + |
| 5 | +proxy_host = ENV['BEAKER_PACKAGE_PROXY'] || '' |
| 6 | + |
| 7 | +if !proxy_host.empty? |
| 8 | + gem_proxy = "http_proxy=#{proxy_host}" unless proxy_host.empty? |
| 9 | + |
| 10 | + hosts.each do |host| |
| 11 | + on host, "echo 'export http_proxy='#{proxy_host}'' >> /root/.bashrc" |
| 12 | + on host, "echo 'export https_proxy='#{proxy_host}'' >> /root/.bashrc" |
| 13 | + on host, "echo 'export no_proxy=\"localhost,127.0.0.1,localaddress,.localdomain.com,#{host.name}\"' >> /root/.bashrc" |
| 14 | + end |
| 15 | +else |
| 16 | + gem_proxy = '' |
| 17 | +end |
| 18 | + |
| 19 | +hosts.each do |host| |
| 20 | + # Install Puppet |
| 21 | + if host.is_pe? |
| 22 | + install_pe |
| 23 | + else |
| 24 | + puppetversion = ENV['VM_PUPPET_VERSION'] |
| 25 | + on host, "#{gem_proxy} gem install puppet --no-ri --no-rdoc --version '~> #{puppetversion}'" |
| 26 | + on host, "mkdir -p #{host['distmoduledir']}" |
| 27 | + |
| 28 | + if fact('osfamily') == 'Suse' |
| 29 | + install_package host, 'rubygems ruby-devel augeas-devel libxml2-devel' |
| 30 | + on host, "#{gem_proxy} gem install ruby-augeas --no-ri --no-rdoc" |
| 31 | + end |
| 32 | + |
| 33 | + end |
| 34 | + |
| 35 | + # on debian/ubuntu nodes ensure we get the latest info |
| 36 | + # Can happen we have stalled data in the images |
| 37 | + if fact('osfamily') == 'Debian' |
| 38 | + on host, "apt-get update" |
| 39 | + end |
| 40 | + |
| 41 | +end |
| 42 | + |
| 43 | +RSpec.configure do |c| |
| 44 | + # Project root |
| 45 | + proj_root = File.expand_path(File.join(File.dirname(__FILE__), '..')) |
| 46 | + |
| 47 | + # Readable test descriptions |
| 48 | + c.formatter = :documentation |
| 49 | + |
| 50 | + # Configure all nodes in nodeset |
| 51 | + c.before :suite do |
| 52 | + # Install module and dependencies |
| 53 | + puppet_module_install(:source => proj_root, :module_name => 'file_concat') |
| 54 | + end |
| 55 | +end |
0 commit comments