Last active
December 15, 2015 12:48
-
-
Save raphink/5262503 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| # /var/lib/puppet/spec/class/wrk4.wrk.cby.camptocamp.com/fail_spec.rb | |
| describe 'failure' do | |
| it { 2.should == 3 } | |
| end |
This file contains hidden or 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
| info: Retrieving plugin | |
| err: Could not retrieve catalog from remote server: Unit tests failed: | |
| .FF.F | |
| Failures: | |
| 1) puppet | |
| Failure/Error: it { should contain_package('ppet') } | |
| expected that the catalogue would contain Package[ppet] | |
| # /var/lib/puppet/spec/class/puppet__client__base/puppet_package_spec.rb:4 | |
| 2) puppet | |
| Failure/Error: it { should include_class('puppet') } | |
| expected that the catalogue would include Class[puppet] | |
| # /var/lib/puppet/spec/class/puppet__client__base/puppet_package_spec.rb:5 | |
| 3) failure | |
| Failure/Error: it { 2.should == 3 } | |
| expected: 3 | |
| got: 2 (using ==) | |
| # /var/lib/puppet/spec/class/wrk4.wrk.cby.camptocamp.com/fail_spec.rb:2 | |
| Finished in 0.94117 seconds | |
| 5 examples, 3 failures | |
| Failed examples: | |
| rspec /var/lib/puppet/spec/class/puppet__client__base/puppet_package_spec.rb:4 # puppet | |
| rspec /var/lib/puppet/spec/class/puppet__client__base/puppet_package_spec.rb:5 # puppet | |
| rspec /var/lib/puppet/spec/class/wrk4.wrk.cby.camptocamp.com/fail_spec.rb:2 # failure | |
| notice: Using cached catalog | |
| err: Could not retrieve catalog; skipping run |
This file contains hidden or 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
| # /var/lib/puppet/spec/class/puppet__client__base/puppet_package_spec.rb | |
| describe 'puppet' do | |
| subject { YAML.load_file('/tmp/catalog') } | |
| it { should contain_package('puppet') } | |
| it { should contain_package('ppet') } | |
| it { should include_class('puppet') } | |
| it { should include_class('puppet::client::base') } | |
| end |
This file contains hidden or 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
| # /usr/lib/ruby/1.8/puppet/indirector/catalog/rest_spec.rb | |
| require 'puppet/node' | |
| require 'puppet/resource/catalog' | |
| require 'puppet/indirector/code' | |
| require 'rubygems' | |
| require 'rspec' | |
| require 'rspec-puppet/matchers' | |
| require 'stringio' | |
| class Puppet::Resource::Catalog::RestSpec < Puppet::Indirector::Code | |
| def compiler | |
| @compiler ||= indirection.terminus(:rest) | |
| #@compiler ||= indirection.terminus(:yaml) | |
| end | |
| def find(request) | |
| return nil unless catalog = compiler.find(request) | |
| RSpec::configure do |c| | |
| c.include(RSpec::Puppet::ManifestMatchers) | |
| c.color = true | |
| end | |
| File.open('/tmp/catalog', 'w') do |out| | |
| YAML.dump(catalog, out) | |
| end | |
| # Test by classes, including $certname | |
| spec_dirs = [] | |
| catalog.classes.each do |c| | |
| class_dir = c.gsub(/:/, '_') | |
| class_path = "#{Puppet.settings[:vardir]}/spec/class/#{class_dir}" | |
| spec_dirs << class_path if File.directory? class_path | |
| end | |
| # Use something else than stdout/stderr to get reports? | |
| out = StringIO.new | |
| unless RSpec::Core::Runner::run(spec_dirs, $stderr, out) == 0 | |
| raise Puppet::Error, "Unit tests failed:\n#{out.string}" | |
| end | |
| catalog | |
| end | |
| end |
This file contains hidden or 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
| # /etc/puppet/routes.yaml | |
| agent: | |
| catalog: | |
| terminus: rest_spec | |
| cache: yaml |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment