forked from puppetlabs/puppetlabs-ntp
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathspec_helper_acceptance.rb
57 lines (46 loc) · 2.11 KB
/
spec_helper_acceptance.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
require 'beaker-rspec'
require 'beaker/puppet_install_helper'
UNSUPPORTED_PLATFORMS = ['windows', 'Darwin']
unless ENV['RS_PROVISION'] == 'no' or ENV['BEAKER_provision'] == 'no'
run_puppet_install_helper
hosts.each do |host|
# for now we have to use unreleased versions of stdlib and tea for testing
apply_manifest_on(host, 'package { "git": }')
environmentpath = host.puppet['environmentpath']
environmentpath = environmentpath.split(':').first if environmentpath
# Solaris 11 doesn't ship the SSL CA root for the forgeapi server
# therefore we need to use a different way to deploy the module to
# the host
if host['platform'] =~ /solaris-11/i
apply_manifest_on(host, 'package { "git": }')
# PE 3.x and 2015.2 require different locations to install modules
modulepath = host.puppet['modulepath']
modulepath = modulepath.split(':').first if modulepath
environmentpath = host.puppet['environmentpath']
environmentpath = environmentpath.split(':').first if environmentpath
destdir = modulepath || "#{environmentpath}/production/modules"
on host, "git clone -b 4.13.0 https://github.com/puppetlabs/puppetlabs-stdlib #{destdir}/stdlib"
else
on host, puppet('module install puppetlabs-stdlib')
end
# Need to disable update of ntp servers from DHCP, as subsequent restart of ntp causes test failures
if fact_on(host, 'osfamily') == 'Debian'
on host, 'dpkg-divert --divert /etc/dhcp-ntp.bak --local --rename --add /etc/dhcp/dhclient-exit-hooks.d/ntp'
on host, 'dpkg-divert --divert /etc/dhcp3-ntp.bak --local --rename --add /etc/dhcp3/dhclient-exit-hooks.d/ntp'
elsif fact_on(host, 'osfamily') == 'RedHat'
on host, 'echo "PEERNTP=no" >> /etc/sysconfig/network'
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
hosts.each do |host|
copy_module_to(host, :source => proj_root, :module_name => 'ntp')
end
end
end