(FM-7795) Cleanup java tests (#350)

* Add idempotent_apply function

* Remove unsupported OS specific code

* Remove outdated comments

* Improve unit test coverage

* Fix typo
This commit is contained in:
Eimhin Laverty
2019-02-26 12:22:27 +00:00
committed by Helen
parent 5509042cd1
commit 7cd34dd291
6 changed files with 54 additions and 126 deletions

View File

@@ -21,3 +21,17 @@ 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