forked from dgolja/golja-influxdb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
spec_helper_acceptance.rb
53 lines (41 loc) · 1.82 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
require 'beaker-rspec'
require 'beaker_spec_helper'
require 'beaker-rspec/spec_helper'
require 'beaker-rspec/helpers/serverspec'
require 'beaker/puppet_install_helper'
include BeakerSpecHelper
# https://github.com/puppetlabs/beaker-puppet_install_helper
run_puppet_install_helper
UNSUPPORTED_PLATFORMS = %w(Suse windows AIX Solaris).freeze
BEAKER_LOG = '/tmp/beaker.log'.freeze
RSpec.configure do |c|
# Project root
proj_root = File.expand_path(File.join(File.dirname(__FILE__), '..'))
module_name = File.basename(proj_root.split('-').last)
# Readable test descriptions
c.formatter = :documentation
# Configure all nodes in nodeset
c.before :suite do
# Install module and dependencies
hosts.each do |host|
File.open(BEAKER_LOG, 'w') do |fd|
fd.write(JSON.pretty_generate(host.host_hash))
fd.write("\n" + '-' * 80 + "\n")
fd.write(JSON.pretty_generate(host.options))
end
if host['platform'] =~ %r{ubuntu}
on host, puppet('resource package apt-transport-https ensure=installed')
end
on host, puppet('resource package git ensure=installed')
on host, puppet('resource package net-tools ensure=installed')
on host, puppet('resource package iproute ensure=installed')
# on host, puppet('module install puppetlabs-stdlib --version 4.12.0'), { :acceptable_exit_codes => [0,1] }
# on host, puppet('module install puppetlabs-apt --version 2.3.0'), { :acceptable_exit_codes => [0,1] }
scp_to(host, "#{proj_root}/spec/fixtures/test_facter.sh", '/usr/bin/test_facter.sh')
scp_to(host, "#{proj_root}/spec/fixtures/test_facter.rb", '/usr/bin/test_facter.rb')
copy_module_to(host, source: proj_root, module_name: module_name)
# https://github.com/camptocamp/beaker_spec_helper
BeakerSpecHelper.spec_prep(host)
end
end
end