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
-
#config_dir ⇒ Object
Returns the value of attribute config_dir.
-
#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.
17 18 19 20 21 22 23 24 |
# File 'lib/puppet-catalog-test/rake_task.rb', line 17 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
#config_dir ⇒ Object
Returns the value of attribute config_dir.
10 11 12 |
# File 'lib/puppet-catalog-test/rake_task.rb', line 10 def config_dir @config_dir end |
#exclude_pattern ⇒ Object
Returns the value of attribute exclude_pattern.
13 14 15 |
# File 'lib/puppet-catalog-test/rake_task.rb', line 13 def exclude_pattern @exclude_pattern end |
#facts ⇒ Object
Returns the value of attribute facts.
14 15 16 |
# File 'lib/puppet-catalog-test/rake_task.rb', line 14 def facts @facts end |
#include_pattern ⇒ Object
Returns the value of attribute include_pattern.
12 13 14 |
# File 'lib/puppet-catalog-test/rake_task.rb', line 12 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.
15 16 17 |
# File 'lib/puppet-catalog-test/rake_task.rb', line 15 def reporter @reporter end |
#scenario_yaml ⇒ Object
Returns the value of attribute scenario_yaml.
11 12 13 |
# File 'lib/puppet-catalog-test/rake_task.rb', line 11 def scenario_yaml @scenario_yaml end |
Instance Method Details
#setup ⇒ Object
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 58 59 |
# File 'lib/puppet-catalog-test/rake_task.rb', line 26 def setup puppet_config = { :manifest_path => @manifest_path, :module_paths => @module_paths, :config_dir => @config_dir } 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 |