Project

General

Profile

« Previous | Next » 

Revision 4192af33

Added by Ewoud Kohl van Wijngaarden about 4 years ago

Modulesync: use voxpupuli helper gems

View differences:

spec/spec_helper_acceptance.rb
ENV['PUPPET_INSTALL_TYPE'] ||= 'agent'
ENV['BEAKER_IS_PE'] ||= 'no'
ENV['BEAKER_PUPPET_COLLECTION'] ||= 'puppet6'
ENV['BEAKER_debug'] ||= 'true'
ENV['BEAKER_setfile'] ||= 'centos7-64{hostname=centos7-64.example.com}'
ENV['BEAKER_HYPERVISOR'] ||= 'docker'
require 'beaker-puppet'
require 'beaker-rspec'
require 'beaker/puppet_install_helper'
require 'beaker/module_install_helper'
run_puppet_install_helper unless ENV['BEAKER_provision'] == 'no'
install_module_on(hosts)
install_module_dependencies_on(hosts)
RSpec.configure do |c|
# Readable test descriptions
c.formatter = :documentation
# Configure all nodes in nodeset
c.before :suite do
# Install module and dependencies
hosts.each do |host|
if fact_on(host, 'os.family') == 'RedHat'
# don't delete downloaded rpm for use with BEAKER_provision=no +
# BEAKER_destroy=no
on host, 'sed -i "s/keepcache=.*/keepcache=1/" /etc/yum.conf'
# refresh check if cache needs refresh on next yum command
on host, 'yum clean expire-cache'
require 'voxpupuli/acceptance/spec_helper_acceptance'
major = fact_on(host, 'os.release.major')
if major == '8'
on host, puppet('resource', 'package', 'glibc-langpack-en', 'ensure=installed')
end
# foreman nightly provides katello-cert-tools
baseurl = if ENV['FOREMAN_REPO_RELEASE']
"https://yum.theforeman.org/releases/nightly/el#{major}/x86_64/"
else
"http://koji.katello.org/releases/yum/foreman-nightly/RHEL/#{major}/x86_64/"
end
ENV['BEAKER_setfile'] ||= 'centos7-64{hostname=centos7-64.example.com}'
on host, puppet_resource('yumrepo', 'foreman', "baseurl=#{baseurl}", 'gpgcheck=0')
end
configure_beaker do |host|
if fact_on(host, 'os.family') == 'RedHat'
unless fact_on(host, 'os.name') == 'Fedora'
# don't delete downloaded rpm for use with BEAKER_provision=no +
# BEAKER_destroy=no
on host, 'sed -i "s/keepcache=.*/keepcache=1/" /etc/yum.conf'
end
# refresh check if cache needs refresh on next yum command
on host, 'yum clean expire-cache'
end
local_setup = File.join(__dir__, 'setup_acceptance_node.pp')
if File.exist?(local_setup)
puts "Configuring #{host} by applying #{local_setup}"
apply_manifest_on(host, File.read(local_setup), catch_failures: true)
end
end
......
shared_examples 'the example' do |name|
let(:pp) do
path = File.join(File.dirname(File.dirname(__FILE__)), 'examples', name)
path = File.join(File.dirname(__dir__), 'examples', name)
File.read(path)
end

Also available in: Unified diff