Files
puppetlabs-java/spec/spec_helper_acceptance.rb
Eimhin Laverty 7cd34dd291 (FM-7795) Cleanup java tests (#350)
* Add idempotent_apply function

* Remove unsupported OS specific code

* Remove outdated comments

* Improve unit test coverage

* Fix typo
2019-02-26 14:22:27 +02:00

38 lines
1.2 KiB
Ruby

require 'beaker-pe'
require 'beaker-puppet'
require 'beaker-rspec'
require 'beaker/puppet_install_helper'
require 'beaker/module_install_helper'
run_puppet_install_helper
configure_type_defaults_on(hosts)
install_module_on(hosts)
install_module_dependencies_on(hosts)
UNSUPPORTED_PLATFORMS = ['Darwin', 'windows'].freeze
unless ENV['RS_PROVISION'] == 'no' || ENV['BEAKER_provision'] == 'no'
hosts.each do |host|
install_puppet_module_via_pmt_on(host, module_name: 'puppetlabs-apt')
end
end
RSpec.configure do |c|
# Readable test descriptions
c.formatter = :documentation
end
def idempotent_apply(hosts, manifest, opts = {}, &block)
block_on hosts, opts do |host|
file_path = host.tmpfile('apply_manifest.pp')
create_remote_file(host, file_path, manifest + "\n")
puppet_apply_opts = { :verbose => nil, 'detailed-exitcodes' => nil }
on_options = { acceptable_exit_codes: [0, 2] }
on host, puppet('apply', file_path, puppet_apply_opts), on_options, &block
puppet_apply_opts2 = { :verbose => nil, 'detailed-exitcodes' => nil }
on_options2 = { acceptable_exit_codes: [0] }
on host, puppet('apply', file_path, puppet_apply_opts2), on_options2, &block
end
end