|
3 | 3 | require 'beaker/puppet_install_helper' |
4 | 4 | require 'beaker/module_install_helper' |
5 | 5 | require 'beaker/i18n_helper' |
6 | | - |
7 | | -def install_bolt_on(hosts) |
8 | | - on(hosts, "/opt/puppetlabs/puppet/bin/gem install --source http://rubygems.delivery.puppetlabs.net bolt -v '> 0.0.1'", acceptable_exit_codes: [0, 1]).stdout |
9 | | -end |
10 | | - |
11 | | -def pe_install? |
12 | | - ENV['PUPPET_INSTALL_TYPE'] =~ %r{pe}i |
13 | | -end |
| 6 | +require 'beaker/task_helper' |
14 | 7 |
|
15 | 8 | run_puppet_install_helper |
16 | | -install_ca_certs unless ENV['PUPPET_INSTALL_TYPE'] =~ %r{pe}i |
| 9 | +install_ca_certs unless pe_install? |
17 | 10 | install_bolt_on(hosts) unless pe_install? |
18 | 11 | install_module_on(hosts) |
19 | 12 | install_module_dependencies_on(hosts) |
20 | 13 |
|
21 | | -UNSUPPORTED_PLATFORMS = %w[Windows Solaris AIX].freeze |
22 | | - |
23 | | -def puppet_version |
24 | | - (on default, puppet('--version')).output.chomp |
25 | | -end |
26 | | - |
27 | | -DEFAULT_PASSWORD = if default[:hypervisor] == 'vagrant' |
28 | | - 'vagrant' |
29 | | - elsif default[:hypervisor] == 'vcloud' |
30 | | - 'Qu@lity!' |
31 | | - end |
32 | | - |
33 | | -def run_puppet_access_login(user:, password: '~!@#$%^*-/ aZ', lifetime: '5y') |
34 | | - on(master, puppet('access', 'login', '--username', user, '--lifetime', lifetime), stdin: password) |
35 | | -end |
36 | | - |
37 | | -def run_task(task_name:, params: nil, password: DEFAULT_PASSWORD) |
38 | | - if pe_install? |
39 | | - run_puppet_task(task_name: task_name, params: params) |
40 | | - else |
41 | | - run_bolt_task(task_name: task_name, params: params, password: password) |
42 | | - end |
43 | | -end |
44 | | - |
45 | | -def run_bolt_task(task_name:, params: nil, password: DEFAULT_PASSWORD) |
46 | | - on(master, "/opt/puppetlabs/puppet/bin/bolt task run #{task_name} --modulepath /etc/puppetlabs/code/modules/service --nodes localhost --password #{password} #{params}", acceptable_exit_codes: [0, 1]).stdout # rubocop:disable Metrics/LineLength |
47 | | -end |
48 | | - |
49 | | -def run_puppet_task(task_name:, params: nil) |
50 | | - on(master, puppet('task', 'run', task_name, '--nodes', fact_on(master, 'fqdn'), params.to_s), acceptable_exit_codes: [0, 1]).stdout |
51 | | -end |
52 | | - |
53 | | -def expect_multiple_regexes(result:, regexes:) |
54 | | - regexes.each do |regex| |
55 | | - expect(result).to match(regex) |
56 | | - end |
57 | | -end |
58 | | - |
59 | 14 | RSpec.configure do |c| |
60 | 15 | # Readable test descriptions |
61 | 16 | c.formatter = :documentation |
|
0 commit comments