Shopify / Shopify/ci-queue

rspec-queue does not fail if there are NameErrors in specs

Open
#100 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Ruby
Stars
239
Forks
36
Avg merge
28m
Merged PRs (30d)
3

Description

I've just encountered the following behaviour with the rspec runner of ci-queue:

  1. Modify a spec to reference an uninitialized constant so as to trigger a NameError, e.g. by referring to a non-existent class:
describe MyNonExistentClass do
 ...
end
  1. Run rspec-queue
  2. rspec-queue exits successfully.

I guessed wrongly that rspec-queue would fail with a non-zero exit code, but it exited with 0.

Bare rspec exits with 1 in the above situation.

I'm wondering if this is intended behaviour - perhaps its needed for retries to work?

The error message output is:

NameError: uninitialized constant MyNonExistentClass

Debugging shows that line 400 is where the 0 exit code is returned, because the NameError causes @world.non_example_failure to be true. Syntax errors appear to have the same result:

https://github.com/Shopify/ci-queue/blob/cba2cddb6de4342fc7b5dd911f53d99651e3723e/ruby/lib/rspec/queue.rb#L387-L401

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with ruby/lib/rspec/queue.rb around lines 387-401 and reproduce the NameError case using rspec-queue, comparing its exit status with bare rspec. Trace how NameError and syntax errors affect the reported result and determine whether the completed behavior should return a non-zero status without breaking retries; done means regression coverage and correct failure status.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
cli, testing-qa
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.