Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Coverage Minimum causing errors #397

Closed
cdenneen opened this issue Jul 21, 2016 · 2 comments
Closed

Coverage Minimum causing errors #397

cdenneen opened this issue Jul 21, 2016 · 2 comments
Labels
Milestone

Comments

@cdenneen
Copy link

cdenneen commented Jul 21, 2016

Recently the code coverage report with minimum coverage percentage started failing:

RSpec.configure do |c|
  c.after(:suite) do
    RSpec::Puppet::Coverage.report!(95)
  end
end

Causes failures like so:

/tmp/profile/.bundle/gems/rspec-core-3.1.7/lib/rspec/core/example_group.rb:444:in `run': wrong number of arguments (0 for 1) (ArgumentError)
        from /tmp/profile/.bundle/bundler/gems/rspec-puppet-79d5373dcbfa/lib/rspec-puppet/coverage.rb:85:in `coverage_test'
        from /tmp/profile/.bundle/bundler/gems/rspec-puppet-79d5373dcbfa/lib/rspec-puppet/coverage.rb:74:in `report!'
        from /tmp/profile/spec/spec_helper.rb:32:in `block (2 levels) in <top (required)>'
        from /tmp/profile/.bundle/gems/rspec-core-3.1.7/lib/rspec/core/example.rb:315:in `instance_exec'
        from /tmp/profile/.bundle/gems/rspec-core-3.1.7/lib/rspec/core/example.rb:315:in `instance_exec_with_rescue'
        from /tmp/profile/.bundle/gems/rspec-core-3.1.7/lib/rspec/core/hooks.rb:357:in `run'
        from /tmp/profile/.bundle/gems/rspec-core-3.1.7/lib/rspec/core/hooks.rb:427:in `block in run'
        from /tmp/profile/.bundle/gems/rspec-core-3.1.7/lib/rspec/core/hooks.rb:427:in `each'
        from /tmp/profile/.bundle/gems/rspec-core-3.1.7/lib/rspec/core/hooks.rb:427:in `run'
        from /tmp/profile/.bundle/gems/rspec-core-3.1.7/lib/rspec/core/hooks.rb:500:in `run'
        from /tmp/profile/.bundle/gems/rspec-core-3.1.7/lib/rspec/core/runner.rb:113:in `block in run_specs'
        from /tmp/profile/.bundle/gems/rspec-core-3.1.7/lib/rspec/core/reporter.rb:53:in `report'
        from /tmp/profile/.bundle/gems/rspec-core-3.1.7/lib/rspec/core/runner.rb:107:in `run_specs'
        from /tmp/profile/.bundle/gems/rspec-core-3.1.7/lib/rspec/core/runner.rb:85:in `run'
        from /tmp/profile/.bundle/gems/rspec-core-3.1.7/lib/rspec/core/runner.rb:69:in `run'
        from /tmp/profile/.bundle/gems/rspec-core-3.1.7/lib/rspec/core/runner.rb:37:in `invoke'
        from /tmp/profile/.bundle/gems/rspec-core-3.1.7/exe/rspec:4:in `<main>'
/opt/rubies/2.1.8/bin/ruby -I/tmp/profile/.bundle/gems/rspec-core-3.1.7/lib:/tmp/profile/.bundle/gems/rspec-support-3.1.2/lib /tmp/profile/.bundle/gems/rspec-core-3.1.7/exe/rspec --pattern spec/\{classes,defines,unit,functions,hosts,integration,types\}/\*\*/\*_spec.rb --color failed

Removing the percentage causes no errors:

RSpec.configure do |c|
  c.after(:suite) do
    RSpec::Puppet::Coverage.report!
  end
end

Gemfile using

  gem "rspec-puppet", :git => 'https://github.com/rodjek/rspec-puppet.git'

Puppetversion 4.3.2
Was hoping @beergeek might have some insight

@cdenneen
Copy link
Author

I have a test module to show the issue with Percentage. Used it for another PUP bug for the #364 issue but it can be used to show the coverage percentage error here:
https://github.com/cdenneen/profile

@jantman
Copy link
Contributor

jantman commented Sep 27, 2016

From what I can tell, this is an rspec version issue. I see this also, using rspec 3.1.0 and rspec-core 3.1.7.

The relevant line, as pointed to by the error message, is lib/rspec-puppet/coverage.rb L85, coverage_test.run.

In rspec-core <= 3.2.0, the Rspec::Core::ExampleGroup.run method took a required argument for a reporter. This commit released in 3.2.0 set NullReporter as a default for that.

For me, upgrading to rspec >= 3.2.0 fixes this.

However, for people who can't do that (I have other things in my Gemfile that require rspec < 3.2.0), a better fix would be for rspec-puppet to explicitly call .run(reporter=RSpec::Core::NullReporter.new).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants