Skip to content

Fix sanity check specs warnings #2231

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

Closed
wants to merge 10 commits into from
Closed

Conversation

benoittgt
Copy link
Member

Fix build errors on sanity check specs.

  1. Bundler.with_clean_env is deprecated
  2. Avoid warning with open-ended dependency
WARNING:  open-ended dependency on activesupport (>= 4.2) is not recommended
  if activesupport is semantically versioned, use:
    add_runtime_dependency 'activesupport', '~> 4.2'
WARNING:  open-ended dependency on actionpack (>= 4.2) is not recommended
  if actionpack is semantically versioned, use:
    add_runtime_dependency 'actionpack', '~> 4.2'
WARNING:  open-ended dependency on railties (>= 4.2) is not recommended
  if railties is semantically versioned, use:
    add_runtime_dependency 'railties', '~> 4.2'
WARNING:  See http://guides.rubygems.org/specification-reference/ for help

@benoittgt benoittgt changed the title Fix sanity check dep Fix sanity check specs warnings Dec 16, 2019
@benoittgt
Copy link
Member Author

It seems there is an issue with the last Bundler. I downgrade to 2.0.2 on my machine and I don't have the error anymore.

@benoittgt benoittgt force-pushed the fix-sanity-check-dep branch 6 times, most recently from 62749f3 to a5e0e26 Compare December 16, 2019 13:17
@benoittgt
Copy link
Member Author

Related issue for bundler rubygems/bundler#7487

@benoittgt benoittgt force-pushed the fix-sanity-check-dep branch 2 times, most recently from 5adc963 to ff2929f Compare December 16, 2019 14:40
@benoittgt
Copy link
Member Author

Sorry for the noise. I will look at JRuby errors.

@pirj
Copy link
Member

pirj commented Dec 17, 2019

Just a heads-up regarding Overwrite the executable? [yN] No output has been received in the last 10m0s - will try to fix it here #2234

@benoittgt
Copy link
Member Author

@pirj I don't think we need to change this part anymore. We still have this kind of noise.

Verify required rspec dependencies
WARNING:  pessimistic dependency on rake (~> 10.0.0, development) may be overly strict
  if rake is semantically versioned, use:
    add_development_dependency 'rake', '~> 10.0', '>= 10.0.0'
WARNING:  pessimistic dependency on thread_order (~> 1.1.0, development) may be overly strict
  if thread_order is semantically versioned, use:
    add_development_dependency 'thread_order', '~> 1.1', '>= 1.1.0'
WARNING:  See http://guides.rubygems.org/specification-reference/ for help
WARNING:  pessimistic dependency on rake (~> 10.0.0, development) may be overly strict
  if rake is semantically versioned, use:
    add_development_dependency 'rake', '~> 10.0', '>= 10.0.0'
WARNING:  pessimistic dependency on cucumber (~> 1.3.15, development) may be overly strict
  if cucumber is semantically versioned, use:
    add_development_dependency 'cucumber', '~> 1.3', '>= 1.3.15'
WARNING:  See http://guides.rubygems.org/specification-reference/ for help
WARNING:  pessimistic dependency on rake (~> 10.0.0, development) may be overly strict
  if rake is semantically versioned, use:
    add_development_dependency 'rake', '~> 10.0', '>= 10.0.0'
WARNING:  See http://guides.rubygems.org/specification-reference/ for help
WARNING:  See http://guides.rubygems.org/specification-reference/ for help
WARNING:  pessimistic dependency on rake (~> 10.0.0, development) may be overly strict
  if rake is semantically versioned, use:
    add_development_dependency 'rake', '~> 10.0', '>= 10.0.0'
WARNING:  pessimistic dependency on thread_order (~> 1.1.0, development) may be overly strict
  if thread_order is semantically versioned, use:
    add_development_dependency 'thread_order', '~> 1.1', '>= 1.1.0'
WARNING:  See http://guides.rubygems.org/specification-reference/ for help
WARNING:  See http://guides.rubygems.org/specification-reference/ for help
WARNING:  pessimistic dependency on rake (~> 10.0.0, development) may be overly strict
  if rake is semantically versioned, use:
    add_development_dependency 'rake', '~> 10.0', '>= 10.0.0'
WARNING:  See http://guides.rubygems.org/specification-reference/ for help
WARNING:  pessimistic dependency on rake (~> 10.0.0, development) may be overly strict
  if rake is semantically versioned, use:
    add_development_dependency 'rake', '~> 10.0', '>= 10.0.0'
WARNING:  pessimistic dependency on cucumber (~> 1.3.15, development) may be overly strict
  if cucumber is semantically versioned, use:
    add_development_dependency 'cucumber', '~> 1.3', '>= 1.3.15'
WARNING:  See http://guides.rubygems.org/specification-reference/ for help
  passes when libraries are required (FAILED - 1)

Failures:

  1) Verify required rspec dependencies passes when libraries are required
     Failure/Error: expect(`bundle exec #{script} 2>&1`).to be_empty
       expected `"WARNING:  pessimistic dependency on rake (~> 10.0.0, development) may be overly strict\n  if rake is...'~> 1.3', '>= 1.3.15'\nWARNING:  See http://guides.rubygems.org/specification-reference/ for help\n".empty?` to return true, got false

With

--- a/spec/sanity_check_spec.rb
+++ b/spec/sanity_check_spec.rb
@@ -47,6 +47,7 @@ RSpec.describe "Verify required rspec dependencies" do
     FileUtils.chmod 0777, script

     bundler_env do
+      puts `bundle exec #{script} 2>&1`
       expect(`bundle exec #{script} 2>&1`).to be_empty
       expect($?.exitstatus).to eq(0)
     end

But where are those dependencies? It seems this noise come from other gemspec of dependencies of gems we install. If think we should rewrite this test.

@pirj
Copy link
Member

pirj commented Dec 17, 2019

@benoittgt I meant that some Travis build jobs get stuck and fail with timeout while trying to read user input from console on build setup stage. It currently fails on 2.6.3 and 2.3.8 builds. I'll debug it later today.

@pirj

This comment has been minimized.

@pirj pirj force-pushed the fix-sanity-check-dep branch 2 times, most recently from f441a34 to aeb5cf2 Compare December 18, 2019 14:02
@@ -1,6 +1,6 @@
function run_cukes {
if is_mri_192_plus; then
bin/rake acceptance --trace
(unset RUBYOPT; bin/rake acceptance --trace)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok I see why that was recommended in the bundler thread, this becomes a question of do we want to keep disabling rubygems on rspec-rails, I mean if rails depends on bundler, and bundler depends on rubygems...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we now need to add require rubygems instead?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe it's required by default unless you set --disable=gems in RUBYOPT.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we want to keep disabling rubygems on rspec-rails

I don't think we have to. But this is a change we have to address on rspec-dev.
I tried to readd only rubygems as an option but I get warnings. unset seems to be a good option.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the only build we have an issue with so it doesn't need to be propagated.

Avoid:
Failures:

  1) Verify required rspec dependencies passes when libraries are required
     Got 1 failure and 1 other error:

     1.1) Failure/Error: expect(`bundle exec #{script} 2>&1`).to be_empty
            expected `"WARNING:  open-ended dependency on activesupport (>= 4.2) is not recommended\n  if activesupport is ... 'railties', '~> 4.2'\nWARNING:  See http://guides.rubygems.org/specification-reference/ for help\n".empty?` to return true, got false
On Bundler 2.1.0 the loading of rubygems has been rewritten. It breaks
our existing usage of command execution. The --disable=gem flag is
problematic because we need to load rubygems in Bundler. It is
not explicitly loaded in Bundle 2.1.0

Related:
  - rubygems/bundler#7487
@pirj pirj force-pushed the fix-sanity-check-dep branch from aeb5cf2 to 0007e19 Compare December 18, 2019 14:04
@JonRowe
Copy link
Member

JonRowe commented Dec 18, 2019

I cherry-picked my suggested version of this to another PR, #2240 and merged it because I'm working on fixing the other builds, but I think this is getting closer to fixing rails too.

@pirj pirj force-pushed the fix-sanity-check-dep branch from d246c82 to 9c13baf Compare December 18, 2019 14:57
@benoittgt
Copy link
Member Author

This is so broken.

Installing RubyGems 3.1.1
  Successfully built RubyGem
  Name: bundler
  Version: 2.1.0
  File: bundler-2.1.0.gem
ERROR:  While executing gem ... (Gem::InstallError)
    "bundle" from bundler conflicts with /home/travis/.rvm/rubies/ruby-2.6.3/bin/bundle

🤦🏼‍♂️

We have the again the issue where it seems we have bundler 2.1.0 and bundler 2.1.1 installed and the default bundler is 2.1.0?
I am not able to reproduce this error locally.

** Execute cucumber

/home/travis/.rvm/rubies/ruby-2.6.3/bin/ruby -S bundle exec cucumber --tag ~@rails_pre_5.1 --tag ~@rails_pre_5 --tag ~@rails_post_6

(....)

+/home/travis/.rvm/gems/ruby-2.6.3/gems/bundler-2.1.1/lib/bundler/runtime.rb:312:in `check_for_activated_spec!': You have already activated bundler 2.1.0, but your Gemfile requires bundler 2.1.1. Since bundler is a default gem, you can either remove your dependency on it or try updating to a newer version of bundler that supports bundler as a default gem. (Gem::LoadError)

Locally I have:

$ gem list | grep '^bundler ('                                                                           
bundler (2.1.1, 2.1.0, 2.0.2)
$ bundle exec rake cucumber   
/Users/bti/.rvm/rubies/ruby-2.6.3/bin/ruby -S bundle exec cucumber --tag ~@rails_pre_5.1 --tag ~@rails_pre_5 --tag ~@rails_pre_6

Using the default profile...
................... (no errors)

@benoittgt
Copy link
Member Author

benoittgt commented Dec 18, 2019

It's worst than before.

Good output:

Fetching bundler-2.1.1.gem
Successfully installed bundler-2.1.1 as a default gem
Done installing documentation for bundler after 0 seconds
1 gem installed
Current bundler versions installed after 'gem install bundler': bundler (default: 2.1.1, default: 2.1.0)

But after

$ bundle install --binstubs --path ../bundle --retry=3 --jobs=3
Traceback (most recent call last):
	1: from /home/travis/.rvm/gems/ruby-2.6.3/bin/bundle:23:in `<main>'
/home/travis/.rvm/gems/ruby-2.6.3/bin/bundle:23:in `load': cannot load such file -- /home/travis/.rvm/rubies/ruby-2.6.3/lib/ruby/gems/2.6.0/gems/bundler-2.1.1/exe/bundle (LoadError)

The command "eval bundle install --binstubs --path ../bundle --retry=3 --jobs=3 " failed. Retrying, 2 of 3.

I have to move and could not probably look at it today, but tomorrow. Feel free to remove my commits.

@pirj pirj force-pushed the fix-sanity-check-dep branch from 4ec4160 to 02a7a6b Compare December 18, 2019 19:40
@pirj
Copy link
Member

pirj commented Dec 18, 2019

Hey @mvz, can you please take a look?

We're experiencing a weird issue:

You have already activated bundler 2.1.0, but your Gemfile requires bundler 2.1.1. Since bundler is a default gem, you can either remove your dependency on it or try updating to a newer version of bundler that supports bundler as a default gem. (Gem::LoadError)
from /home/travis/.rvm/gems/ruby-2.6.3/gems/bundler-2.1.1/lib/bundler/runtime.rb:31:in `block in setup'
from /home/travis/.rvm/gems/ruby-2.6.3/gems/bundler-2.1.1/lib/bundler/spec_set.rb:147:in `each'
from /home/travis/.rvm/gems/ruby-2.6.3/gems/bundler-2.1.1/lib/bundler/spec_set.rb:147:in `each'
from /home/travis/.rvm/gems/ruby-2.6.3/gems/bundler-2.1.1/lib/bundler/runtime.rb:26:in `map'
from /home/travis/.rvm/gems/ruby-2.6.3/gems/bundler-2.1.1/lib/bundler/runtime.rb:26:in `setup'
from /home/travis/.rvm/gems/ruby-2.6.3/gems/bundler-2.1.1/lib/bundler.rb:149:in `setup'
from /home/travis/.rvm/gems/ruby-2.6.3/gems/bundler-2.1.1/lib/bundler/setup.rb:20:in `block in <top (required)>'
from /home/travis/.rvm/gems/ruby-2.6.3/gems/bundler-2.1.1/lib/bundler/ui/shell.rb:136:in `with_level'
from /home/travis/.rvm/gems/ruby-2.6.3/gems/bundler-2.1.1/lib/bundler/ui/shell.rb:88:in `silence'
from /home/travis/.rvm/gems/ruby-2.6.3/gems/bundler-2.1.1/lib/bundler/setup.rb:20:in `<top (required)>'
from /home/travis/.rvm/rubies/ruby-2.6.3/lib/ruby/site_ruby/2.6.0/rubygems/core_ext/kernel_require.rb:92:in `require'
from /home/travis/.rvm/rubies/ruby-2.6.3/lib/ruby/site_ruby/2.6.0/rubygems/core_ext/kernel_require.rb:92:in `require'
from /home/travis/build/rspec/rspec-rails/tmp/aruba/bin/rspec:27:in `<main>'

After reverting aruba update commit, this problem disappears.

@pirj pirj force-pushed the fix-sanity-check-dep branch from d1f8e95 to 18e15b1 Compare December 18, 2019 21:57
@mvz
Copy link
Contributor

mvz commented Dec 18, 2019

That is strange. @pirj any idea how to reproduce this locally?

@mvz mvz mentioned this pull request Dec 18, 2019
@mvz
Copy link
Contributor

mvz commented Dec 18, 2019

I think what happens is that bundler now sets more env vars than aruba knows to unset. I'll be trying out some fixes in #2241.

@pirj
Copy link
Member

pirj commented Dec 18, 2019

Thanks for the quick response!

pirj added 2 commits December 19, 2019 21:45
It was introduced to avoid build failure on 2.4 suggesting to update
json gem. Let's see if it comes up again.
@benoittgt
Copy link
Member Author

benoittgt commented Dec 19, 2019

@mvz Jon asked the question about ENV vars but without clear answer rubygems/bundler#7487 (comment)

I am trying at the moment to look at difference between 2.0 and 2.1 but the diff is big. rubygems/bundler@2-0-stable...2-1-stable

@benoittgt
Copy link
Member Author

benoittgt commented Dec 19, 2019

Congrats @pirj that's much better!

Edit: I am trying to reproduce locally.
Edit 2: Error on jruby seems related to all commands linked to gem. rubygems/rubygems#2984 (comment)

With Rubygems 3.1 we see on JRuby warnings on every gem commands like:

```
NOTE: Gem::Specification#rubyforge_project= is deprecated with no replacement. It will be removed on or after 2019-12-01.
Gem::Specification#rubyforge_project= called from /Users/bti/.rvm/rubies/jruby-head/lib/ruby/gems/shared/specifications/default/json-2.2.0-java.gemspec:18.
```

As a temporary fix we downgrade to 3.0.6, waiting for a json dependency
updated.

Related:
- rubygems/rubygems#2798
- rubygems/rubygems#2984 (comment)
@mvz
Copy link
Contributor

mvz commented Dec 19, 2019

@pirj it seems the latest commit in #2241 (c024004) fixed the bundler version problem. I can make a pull request on master for that or you can cherry pick it here.

I'll probably pull that change into Aruba proper as well to improve its unset_bundler_env_vars implementation.

@duckinator
Copy link

Edit 2: Error on jruby seems related to all commands linked to gem.

If you're able to update the JSON gem to 2.3.0, it should resolve that problem. They stopped using the deprecated rubyforge_project attribute in their gemspec with that version, and that's the source of the warning.

@benoittgt
Copy link
Member Author

@duckinator but even if I update json gem and set JSON gem 2.3.0 as default. I still have the warning.

@benoittgt
Copy link
Member Author

Closing, in favor of #2244

@benoittgt benoittgt closed this Dec 20, 2019
@benoittgt benoittgt deleted the fix-sanity-check-dep branch December 20, 2019 13:08
@JonRowe
Copy link
Member

JonRowe commented Dec 20, 2019

Thanks for all your work here @pirj @benoittgt and @mvz I tried to cherry-pick your commits for #2244 where possible, I just wanted the minimal changes to fix the build.

@benoittgt
Copy link
Member Author

I am happy with the final result. I think we should open a new discussion on how the build is written. I would love to be able to more easily run the build locally, and run each step without looking at shell functions or Rakefile. Like simply copy paste one line from travis logs.

@JonRowe
Copy link
Member

JonRowe commented Dec 20, 2019

@benoittgt more than happy for you to look at that :)

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 this pull request may close these issues.

5 participants