rspec_tap icon indicating copy to clipboard operation
rspec_tap copied to clipboard

Format ci-queue output - undefined method `parent_groups' for nil:NilClass

Open schneems opened this issue 7 years ago • 2 comments

Hello, thanks for the gem!

I'm trying to use this in combination with ci-queue which is a gem that distributes all your tests across N workers using redis (maintained by shopify). When I try to run with the rspec tap formatter I get a failure undefined method parent_groups' for nil:NilClass. I'm not sure if the issue is in ci-queueor withrspec_tap`. If you can point me in the right direction then I can look deeper and maybe fix.

Reproduction instructions:

cd /tmp
git clone https://github.com/heroku/heroku-buildpack-ruby
cd heroku-buildpack-ruby
git checkout schneems/heroku-ci
bundle install
bundle exec rspec-queue --max-requeues=3 --timeout 180 --queue redis://localhost:6379 --format RspecTap::Formatter --build 1 --worker 1

Results in a failure:

$ bundle exec rspec-queue --max-requeues=3 --timeout 180 --queue redis://localhost:6379 --format RspecTap::Formatter --build 1 --worker 1
Run options: include {:focused=>true}

All examples were filtered out; ignoring {:focused=>true}
1..101

Finished in 0.00574 seconds (files took 0.60376 seconds to load)
1 example, 1 failure

Failed examples:

rspec ./spec/hatchet/rails4_spec.rb:71 # Rails 4.x upgraded from 3 to 4.2 missing ./bin still works

bundler: failed to load command: rspec-queue (/Users/rschneeman/.gem/ruby/2.5.1/bin/rspec-queue)
NoMethodError: undefined method `parent_groups' for nil:NilClass
  /Users/rschneeman/.gem/ruby/2.5.1/gems/rspec_tap-0.1.0/lib/rspec_tap/formatter.rb:57:in `example_line'
  /Users/rschneeman/.gem/ruby/2.5.1/gems/rspec_tap-0.1.0/lib/rspec_tap/formatter.rb:32:in `example_failed'
  /Users/rschneeman/.gem/ruby/2.5.1/gems/rspec-core-3.6.0/lib/rspec/core/reporter.rb:206:in `block in notify'
  /Users/rschneeman/.gem/ruby/2.5.1/gems/rspec-core-3.6.0/lib/rspec/core/reporter.rb:205:in `each'
  /Users/rschneeman/.gem/ruby/2.5.1/gems/rspec-core-3.6.0/lib/rspec/core/reporter.rb:205:in `notify'
  /Users/rschneeman/.gem/ruby/2.5.1/gems/rspec-core-3.6.0/lib/rspec/core/reporter.rb:142:in `example_failed'
  /Users/rschneeman/.rubies/ruby-2.5.1/lib/ruby/2.5.0/delegate.rb:83:in `method_missing'
  /Users/rschneeman/.gem/ruby/2.5.1/gems/rspec-core-3.6.0/lib/rspec/core/example.rb:473:in `finish'
  /Users/rschneeman/.gem/ruby/2.5.1/gems/ci-queue-0.13.6/lib/rspec/queue.rb:227:in `finish'
  /Users/rschneeman/.gem/ruby/2.5.1/gems/rspec-core-3.6.0/lib/rspec/core/example.rb:283:in `run'
  /Users/rschneeman/.gem/ruby/2.5.1/gems/ci-queue-0.13.6/lib/rspec/queue.rb:264:in `run'
  /Users/rschneeman/.gem/ruby/2.5.1/gems/ci-queue-0.13.6/lib/rspec/queue.rb:389:in `block (3 levels) in run_specs'
  /Users/rschneeman/.gem/ruby/2.5.1/gems/ci-queue-0.13.6/lib/ci/queue/redis/worker.rb:49:in `poll'
  /Users/rschneeman/.gem/ruby/2.5.1/gems/ci-queue-0.13.6/lib/rspec/queue.rb:388:in `block (2 levels) in run_specs'
  /Users/rschneeman/.gem/ruby/2.5.1/gems/rspec-core-3.6.0/lib/rspec/core/configuration.rb:1894:in `with_suite_hooks'
  /Users/rschneeman/.gem/ruby/2.5.1/gems/ci-queue-0.13.6/lib/rspec/queue.rb:386:in `block in run_specs'
  /Users/rschneeman/.gem/ruby/2.5.1/gems/rspec-core-3.6.0/lib/rspec/core/reporter.rb:79:in `report'
  /Users/rschneeman/.gem/ruby/2.5.1/gems/ci-queue-0.13.6/lib/rspec/queue.rb:383:in `run_specs'
  /Users/rschneeman/.gem/ruby/2.5.1/gems/rspec-core-3.6.0/lib/rspec/core/runner.rb:87:in `run'
  /Users/rschneeman/.gem/ruby/2.5.1/gems/rspec-core-3.6.0/lib/rspec/core/runner.rb:71:in `run'
  /Users/rschneeman/.gem/ruby/2.5.1/gems/rspec-core-3.6.0/lib/rspec/core/runner.rb:45:in `invoke'
  /Users/rschneeman/.gem/ruby/2.5.1/gems/ci-queue-0.13.6/exe/rspec-queue:4:in `<top (required)>'
  /Users/rschneeman/.gem/ruby/2.5.1/bin/rspec-queue:23:in `load'
  /Users/rschneeman/.gem/ruby/2.5.1/bin/rspec-queue:23:in `<top (required)>'

schneems avatar Jul 24 '18 17:07 schneems

Hey @schneems, thanks for bringing this up and thanks for the detailed report!

My initial impression is that this is a bug in rspec_tap here, I wonder if instead of referencing the instance variable it should we should be using the accessor http://rspec.info/documentation/2.14/rspec-core/RSpec/Core/Formatters/BaseFormatter.html#example_group-instance_method?

appleton avatar Aug 23 '18 14:08 appleton

Fix in #4

pelletencate avatar Aug 08 '19 18:08 pelletencate