-
-
Save Randommood/6a10263f34ac732ea86c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let(:runner) do | |
memoized_runner('pd-gocd::agent') do |node| | |
#..... | |
end | |
end | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def clear_runner(recipe) | |
@@runners.delete recipe | |
end | |
def memoized_runner(recipe, options={}, &block) | |
@@runners[recipe] ||= converged_runner(recipe, options, &block) | |
end | |
def converged_runner(recipe, options = {}) | |
runner = ChefSpec::SoloRunner.new( | |
{file_cache_path: '/var/chef/cache'}.merge(options) | |
) | |
yield runner.node if block_given? | |
runner.converge(recipe) | |
runner | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment