2 require 'beaker-puppet'
4 require 'beaker/puppet_install_helper'
5 require 'beaker/module_install_helper'
6 require 'beaker-task_helper'
8 run_puppet_install_helper
9 configure_type_defaults_on(hosts)
10 install_bolt_on(hosts) unless pe_install?
11 install_module_on(hosts)
12 install_module_dependencies_on(hosts)
14 UNSUPPORTED_PLATFORMS = ['RedHat', 'Suse', 'windows', 'AIX', 'Solaris'].freeze
17 ERROR_MATCHER = %r{(no valid OpenPGP data found|keyserver timed out|keyserver receive failed)}
19 # This method allows a block to be passed in and if an exception is raised
20 # that matches the 'error_matcher' matcher, the block will wait a set number
21 # of seconds before retrying.
23 # - max_retry_count - Max number of retries
24 # - retry_wait_interval_secs - Number of seconds to wait before retry
25 # - error_matcher - Matcher which the exception raised must match to allow retry
27 # retry_on_error_matching(3, 5, /OpenGPG Error/) do
28 # apply_manifest(pp, :catch_failures => true)
30 def retry_on_error_matching(max_retry_count = MAX_RETRY_COUNT, retry_wait_interval_secs = RETRY_WAIT, error_matcher = ERROR_MATCHER)
33 puts "retry_on_error_matching: try #{try}" unless try.zero?
36 rescue StandardError => e
37 raise unless try < max_retry_count && (error_matcher.nil? || e.message =~ error_matcher)
38 sleep retry_wait_interval_secs
43 RSpec.configure do |c|
44 File.expand_path(File.join(File.dirname(__FILE__), '..'))
46 # Readable test descriptions
47 c.formatter = :documentation
49 # Configure all nodes in nodeset
51 run_puppet_access_login(user: 'admin') if pe_install? && puppet_version =~ %r{(5\.\d\.\d)}