Class: PuppetCatalogTest::RakeTask
- Inherits:
-
Rake::TaskLib
- Object
- Rake::TaskLib
- PuppetCatalogTest::RakeTask
- Includes:
- Rake::DSL
- Defined in:
- lib/puppet-catalog-test/rake_task.rb
Instance Attribute Summary collapse
-
#exclude_pattern ⇒ Object
Returns the value of attribute exclude_pattern.
-
#facts ⇒ Object
Returns the value of attribute facts.
-
#include_pattern ⇒ Object
Returns the value of attribute include_pattern.
-
#manifest_path ⇒ Object
Returns the value of attribute manifest_path.
-
#module_paths ⇒ Object
Returns the value of attribute module_paths.
-
#reporter ⇒ Object
Returns the value of attribute reporter.
-
#scenario_yaml ⇒ Object
Returns the value of attribute scenario_yaml.
Instance Method Summary collapse
-
#initialize(name, &task_block) ⇒ RakeTask
constructor
A new instance of RakeTask.
- #setup ⇒ Object
Constructor Details
#initialize(name, &task_block) ⇒ RakeTask
Returns a new instance of RakeTask.
16 17 18 19 20 21 22 23 |
# File 'lib/puppet-catalog-test/rake_task.rb', line 16 def initialize(name, &task_block) desc "Compile all puppet catalogs" unless ::Rake.application.last_comment task name do task_block.call(self) if task_block setup end end |
Instance Attribute Details
#exclude_pattern ⇒ Object
Returns the value of attribute exclude_pattern.
12 13 14 |
# File 'lib/puppet-catalog-test/rake_task.rb', line 12 def exclude_pattern @exclude_pattern end |
#facts ⇒ Object
Returns the value of attribute facts.
13 14 15 |
# File 'lib/puppet-catalog-test/rake_task.rb', line 13 def facts @facts end |
#include_pattern ⇒ Object
Returns the value of attribute include_pattern.
11 12 13 |
# File 'lib/puppet-catalog-test/rake_task.rb', line 11 def include_pattern @include_pattern end |
#manifest_path ⇒ Object
Returns the value of attribute manifest_path.
9 10 11 |
# File 'lib/puppet-catalog-test/rake_task.rb', line 9 def manifest_path @manifest_path end |
#module_paths ⇒ Object
Returns the value of attribute module_paths.
8 9 10 |
# File 'lib/puppet-catalog-test/rake_task.rb', line 8 def module_paths @module_paths end |
#reporter ⇒ Object
Returns the value of attribute reporter.
14 15 16 |
# File 'lib/puppet-catalog-test/rake_task.rb', line 14 def reporter @reporter end |
#scenario_yaml ⇒ Object
Returns the value of attribute scenario_yaml.
10 11 12 |
# File 'lib/puppet-catalog-test/rake_task.rb', line 10 def scenario_yaml @scenario_yaml end |
Instance Method Details
#setup ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/puppet-catalog-test/rake_task.rb', line 25 def setup puppet_config = { :manifest_path => @manifest_path, :module_paths => @module_paths } pct = TestRunner.new(puppet_config) @filter = Filter.new @filter.include_pattern = @include_pattern if @include_pattern @filter.exclude_pattern = @exclude_pattern if @exclude_pattern if @scenario_yaml pct.load_scenario_yaml(@scenario_yaml, @filter) else nodes = pct.collect_puppet_nodes(@filter) test_facts = @facts || fallback_facts nodes.each do |nodename| facts = test_facts.merge({ 'hostname' => nodename, 'fqdn' => "#{nodename}.localdomain" }) pct.add_test_case(nodename, facts) end end pct.reporter = @reporter if @reporter pct.run_tests! end |