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

Inspec > 4.17.7 breaks most of rspec matchers just by including the inspec gem #4564

Closed
frezbo opened this issue Oct 4, 2019 · 1 comment · Fixed by #4565
Closed

Inspec > 4.17.7 breaks most of rspec matchers just by including the inspec gem #4564

frezbo opened this issue Oct 4, 2019 · 1 comment · Fixed by #4565

Comments

@frezbo
Copy link
Contributor

frezbo commented Oct 4, 2019

Inspec > 4.17.7 breaks most of rspec matchers just by including the inspec gem

Describe the problem

With Inspec = 4.17.7

Gemfile

# frozen_string_literal: true

source 'https://rubygems.org'

gem 'inspec', '= 4.17.7'
gem 'rake'
gem 'rspec'

test.rb

# frozen_string_literal: true

require 'inspec'

describe 'dummy test' do
  it 'should pass' do
    expect([]).to be_empty
  end
end

Output

inspec_dynamic_resource_load_fail (aws:none)(kc:none)$ bundle exec rspec test.rb
.

Finished in 0.0058 seconds (files took 0.76283 seconds to load)
1 example, 0 failures

inspec_dynamic_resource_load_fail (aws:none)(kc:none)$

With Inspec >= 4.17.7

Gemfile

# frozen_string_literal: true

source 'https://rubygems.org'

gem 'inspec', '>= 4.17.7'
gem 'rake'
gem 'rspec'

test.rb

# frozen_string_literal: true

require 'inspec'

describe 'dummy test' do
  it 'should pass' do
    expect([]).to be_empty
  end
end

Output

inspec_dynamic_resource_load_fail (aws:none)(kc:none)$ bundle exec rspec test.rb
F

Failures:

  1) dummy test should pass
     Failure/Error: expect([]).to be_empty

     SystemStackError:
       stack level too deep
     # ./test.rb:7:in `block (2 levels) in <top (required)>'

Finished in 0.00567 seconds (files took 0.6081 seconds to load)
1 example, 1 failure

Failed examples:

rspec ./test.rb:6 # dummy test should pass

inspec_dynamic_resource_load_fail (aws:none)(kc:none)$

This works fine if I remove the require 'inspec' block. This completely breaks any tools that uses Inspec as a gem. This seems to have been caused by the regressions introduced with speeding up of inspec. Especially this PR breaks it #4526. It also seems sad that such major changes are done in minor revisions (This has happened in the past too 😢 ).

Stacktrace (obtained by running rspec with -b

inspec_dynamic_resource_load_fail (aws:none)(kc:none)$ bundle exec rspec -b test.rb
F

Failures:

  1) dummy test should pass
     Failure/Error: expect([]).to be_empty

     SystemStackError:
       stack level too deep
     # /Users/apple/.rbenv/versions/2.5.5/lib/ruby/gems/2.5.0/gems/inspec-4.17.17/lib/inspec/rspec_extensions.rb:52:in `method_missing'
     # /Users/apple/.rbenv/versions/2.5.5/lib/ruby/gems/2.5.0/gems/inspec-4.17.17/lib/inspec/rspec_extensions.rb:53:in `method_missing'
     # /Users/apple/.rbenv/versions/2.5.5/lib/ruby/gems/2.5.0/gems/inspec-4.17.17/lib/inspec/rspec_extensions.rb:53:in `method_missing'
     <thousands of lines of same message removed>
     # /Users/apple/.rbenv/versions/2.5.5/lib/ruby/gems/2.5.0/gems/inspec-4.17.17/lib/inspec/rspec_extensions.rb:53:in `method_missing'
     # /Users/apple/.rbenv/versions/2.5.5/lib/ruby/gems/2.5.0/gems/inspec-4.17.17/lib/inspec/rspec_extensions.rb:53:in `method_missing'
     # /Users/apple/.rbenv/versions/2.5.5/lib/ruby/gems/2.5.0/gems/inspec-4.17.17/lib/inspec/rspec_extensions.rb:53:in `method_missing'
     # ./test.rb:7:in `block (2 levels) in <top (required)>'
     # /Users/apple/.rbenv/versions/2.5.5/lib/ruby/gems/2.5.0/gems/rspec-core-3.8.2/lib/rspec/core/example.rb:257:in `instance_exec'
     # /Users/apple/.rbenv/versions/2.5.5/lib/ruby/gems/2.5.0/gems/rspec-core-3.8.2/lib/rspec/core/example.rb:257:in `block in run'
     # /Users/apple/.rbenv/versions/2.5.5/lib/ruby/gems/2.5.0/gems/rspec-core-3.8.2/lib/rspec/core/example.rb:503:in `block in with_around_and_singleton_context_hooks'
     # /Users/apple/.rbenv/versions/2.5.5/lib/ruby/gems/2.5.0/gems/rspec-core-3.8.2/lib/rspec/core/example.rb:460:in `block in with_around_example_hooks'
     # /Users/apple/.rbenv/versions/2.5.5/lib/ruby/gems/2.5.0/gems/rspec-core-3.8.2/lib/rspec/core/hooks.rb:464:in `block in run'
     # /Users/apple/.rbenv/versions/2.5.5/lib/ruby/gems/2.5.0/gems/rspec-core-3.8.2/lib/rspec/core/hooks.rb:602:in `run_around_example_hooks_for'
     # /Users/apple/.rbenv/versions/2.5.5/lib/ruby/gems/2.5.0/gems/rspec-core-3.8.2/lib/rspec/core/hooks.rb:464:in `run'
     # /Users/apple/.rbenv/versions/2.5.5/lib/ruby/gems/2.5.0/gems/rspec-core-3.8.2/lib/rspec/core/example.rb:460:in `with_around_example_hooks'
     # /Users/apple/.rbenv/versions/2.5.5/lib/ruby/gems/2.5.0/gems/rspec-core-3.8.2/lib/rspec/core/example.rb:503:in `with_around_and_singleton_context_hooks'
     # /Users/apple/.rbenv/versions/2.5.5/lib/ruby/gems/2.5.0/gems/rspec-core-3.8.2/lib/rspec/core/example.rb:254:in `run'
     # /Users/apple/.rbenv/versions/2.5.5/lib/ruby/gems/2.5.0/gems/rspec-core-3.8.2/lib/rspec/core/example_group.rb:633:in `block in run_examples'
     # /Users/apple/.rbenv/versions/2.5.5/lib/ruby/gems/2.5.0/gems/rspec-core-3.8.2/lib/rspec/core/example_group.rb:629:in `map'
     # /Users/apple/.rbenv/versions/2.5.5/lib/ruby/gems/2.5.0/gems/rspec-core-3.8.2/lib/rspec/core/example_group.rb:629:in `run_examples'
     # /Users/apple/.rbenv/versions/2.5.5/lib/ruby/gems/2.5.0/gems/rspec-core-3.8.2/lib/rspec/core/example_group.rb:595:in `run'
     # /Users/apple/.rbenv/versions/2.5.5/lib/ruby/gems/2.5.0/gems/rspec-core-3.8.2/lib/rspec/core/runner.rb:116:in `block (3 levels) in run_specs'
     # /Users/apple/.rbenv/versions/2.5.5/lib/ruby/gems/2.5.0/gems/rspec-core-3.8.2/lib/rspec/core/runner.rb:116:in `map'
     # /Users/apple/.rbenv/versions/2.5.5/lib/ruby/gems/2.5.0/gems/rspec-core-3.8.2/lib/rspec/core/runner.rb:116:in `block (2 levels) in run_specs'
     # /Users/apple/.rbenv/versions/2.5.5/lib/ruby/gems/2.5.0/gems/rspec-core-3.8.2/lib/rspec/core/configuration.rb:2008:in `with_suite_hooks'
     # /Users/apple/.rbenv/versions/2.5.5/lib/ruby/gems/2.5.0/gems/rspec-core-3.8.2/lib/rspec/core/runner.rb:111:in `block in run_specs'
     # /Users/apple/.rbenv/versions/2.5.5/lib/ruby/gems/2.5.0/gems/rspec-core-3.8.2/lib/rspec/core/reporter.rb:74:in `report'
     # /Users/apple/.rbenv/versions/2.5.5/lib/ruby/gems/2.5.0/gems/rspec-core-3.8.2/lib/rspec/core/runner.rb:110:in `run_specs'
     # /Users/apple/.rbenv/versions/2.5.5/lib/ruby/gems/2.5.0/gems/rspec-core-3.8.2/lib/rspec/core/runner.rb:87:in `run'
     # /Users/apple/.rbenv/versions/2.5.5/lib/ruby/gems/2.5.0/gems/rspec-core-3.8.2/lib/rspec/core/runner.rb:71:in `run'
     # /Users/apple/.rbenv/versions/2.5.5/lib/ruby/gems/2.5.0/gems/rspec-core-3.8.2/lib/rspec/core/runner.rb:45:in `invoke'
     # /Users/apple/.rbenv/versions/2.5.5/lib/ruby/gems/2.5.0/gems/rspec-core-3.8.2/exe/rspec:4:in `<top (required)>'
     # /Users/apple/.rbenv/versions/2.5.5/bin/rspec:23:in `load'
     # /Users/apple/.rbenv/versions/2.5.5/bin/rspec:23:in `<top (required)>'
     # /Users/apple/.rbenv/versions/2.5.5/lib/ruby/gems/2.5.0/gems/bundler-1.17.3/lib/bundler/cli/exec.rb:74:in `load'
     # /Users/apple/.rbenv/versions/2.5.5/lib/ruby/gems/2.5.0/gems/bundler-1.17.3/lib/bundler/cli/exec.rb:74:in `kernel_load'
     # /Users/apple/.rbenv/versions/2.5.5/lib/ruby/gems/2.5.0/gems/bundler-1.17.3/lib/bundler/cli/exec.rb:28:in `run'
     # /Users/apple/.rbenv/versions/2.5.5/lib/ruby/gems/2.5.0/gems/bundler-1.17.3/lib/bundler/cli.rb:463:in `exec'
     # /Users/apple/.rbenv/versions/2.5.5/lib/ruby/gems/2.5.0/gems/bundler-1.17.3/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
     # /Users/apple/.rbenv/versions/2.5.5/lib/ruby/gems/2.5.0/gems/bundler-1.17.3/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
     # /Users/apple/.rbenv/versions/2.5.5/lib/ruby/gems/2.5.0/gems/bundler-1.17.3/lib/bundler/vendor/thor/lib/thor.rb:387:in `dispatch'
     # /Users/apple/.rbenv/versions/2.5.5/lib/ruby/gems/2.5.0/gems/bundler-1.17.3/lib/bundler/cli.rb:27:in `dispatch'
     # /Users/apple/.rbenv/versions/2.5.5/lib/ruby/gems/2.5.0/gems/bundler-1.17.3/lib/bundler/vendor/thor/lib/thor/base.rb:466:in `start'
     # /Users/apple/.rbenv/versions/2.5.5/lib/ruby/gems/2.5.0/gems/bundler-1.17.3/lib/bundler/cli.rb:18:in `start'
     # /Users/apple/.rbenv/versions/2.5.5/lib/ruby/gems/2.5.0/gems/bundler-1.17.3/exe/bundle:30:in `block in <top (required)>'
     # /Users/apple/.rbenv/versions/2.5.5/lib/ruby/gems/2.5.0/gems/bundler-1.17.3/lib/bundler/friendly_errors.rb:124:in `with_friendly_errors'
     # /Users/apple/.rbenv/versions/2.5.5/lib/ruby/gems/2.5.0/gems/bundler-1.17.3/exe/bundle:22:in `<top (required)>'
     # /Users/apple/.rbenv/versions/2.5.5/bin/bundle:23:in `load'
     # /Users/apple/.rbenv/versions/2.5.5/bin/bundle:23:in `<main>'

Finished in 0.00444 seconds (files took 0.55445 seconds to load)
1 example, 1 failure

Failed examples:

rspec ./test.rb:6 # dummy test should pass

inspec_dynamic_resource_load_fail (aws:none)(kc:none)$
@zenspider
Copy link
Contributor

zenspider commented Oct 4, 2019

I don't think this has anything to do with #4526. Maybe #4534?

Either way, I have a patch in the works.

zenspider added a commit that referenced this issue Oct 4, 2019
…lable.

Fixes #4564

Signed-off-by: Ryan Davis <zenspider@chef.io>
aaron-lane added a commit to newcontext-oss/kitchen-terraform that referenced this issue Oct 19, 2019
This commit changes the testing dependencies to work around
inspec/inspec#4564.
aaron-lane added a commit to newcontext-oss/kitchen-terraform that referenced this issue Dec 2, 2019
This commit changes the testing dependencies to work around
inspec/inspec#4564.
aaron-lane added a commit to newcontext-oss/kitchen-terraform that referenced this issue Dec 3, 2019
This commit changes the testing dependencies to work around
inspec/inspec#4564.
aaron-lane added a commit to newcontext-oss/kitchen-terraform that referenced this issue Dec 4, 2019
This commit changes the testing dependencies to work around
inspec/inspec#4564.
aaron-lane added a commit to newcontext-oss/kitchen-terraform that referenced this issue Dec 9, 2019
This commit changes the testing dependencies to work around
inspec/inspec#4564.
aaron-lane added a commit to newcontext-oss/kitchen-terraform that referenced this issue Dec 10, 2019
This commit changes the testing dependencies to work around
inspec/inspec#4564.
aaron-lane added a commit to newcontext-oss/kitchen-terraform that referenced this issue Dec 11, 2019
* Use Bundler 2 features and binstubs

* Pin inspec >= 4.18.0 for testing

This commit changes the testing dependencies to work around
inspec/inspec#4564.

* Extract terraform to bin on Ubuntu build

* Update dev dependencies for vscode-ruby v0.26

* Add bundler to gemspec

* Update gems.locked

* Unfreeze Windows
aaron-lane added a commit to newcontext-oss/kitchen-terraform that referenced this issue Dec 11, 2019
This commit changes the testing dependencies to work around
inspec/inspec#4564.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants