rails: test_restart_rails_server_with_custom_pid_file_path fails

Steps to reproduce

$ cd rails/railties
$ bundle install
$ bundle exec ruby -w -Ilib:lib:test test/application/server_test.rb
or
$ bin/test test/application/server_test.rb

Expected behavior

It should pass.

Actual behavior

$ bundle exec ruby -w -Ilib:lib:test test/application/server_test.rb
Run options: --seed 51648

# Running:

.F

Failure:
ApplicationTests::ServerTest#test_restart_rails_server_with_custom_pid_file_path [test/application/server_test.rb:48]:
"Inherited" expected, but got:

...
/home/yahonda/.rbenv/versions/2.4.2/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:59:in `require': cannot load such file -- rails/all (LoadError)
        from /home/yahonda/.rbenv/versions/2.4.2/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:59:in `require'
        from /tmp/d20171206-22731-w0cvlw/app/config/boot.rb:1:in `<top (required)>'
        from bin/rails:3:in `require_relative'
        from bin/rails:3:in `<main>'
.
Expected "...\r\n/home/yahonda/.rbenv/versions/2.4.2/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:59:in `require': cannot load such file -- rails/all (LoadError)\r\n\tfrom /home/yahonda/.rbenv/versions/2.4.2/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:59:in `require'\r\n\tfrom /tmp/d20171206-22731-w0cvlw/app/config/boot.rb:1:in `<top (required)>'\r\n\tfrom bin/rails:3:in `require_relative'\r\n\tfrom bin/rails:3:in `<main>'\r\n" to include "Inherited".


bin/rails test test/application/server_test.rb:35



Finished in 14.508692s, 0.1378 runs/s, 0.5514 assertions/s.
2 runs, 8 assertions, 1 failures, 0 errors, 0 skips
$

System configuration

Rails version:master branch

Ruby version:ruby 2.4.2p198 (2017-09-14 revision 59899) [x86_64-linux]

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 20 (20 by maintainers)

Commits related to this issue

Most upvoted comments

@yahonda Thanks for your confirmation. I committed. 91a4a820feeb878dd1b388befa56dd469933d17c

I think I have found minimum steps to reproduce and minimum steps NOT to reproduce.

The key thing is test/generators/app_generator_test.rb needs executed before test/application/server_test.rb. It looks like test/generators/app_generator_test.rb install railties to GEM PATH

Minimum steps to reproduce:

git clone https://github.com/rails/rails.git
cd rails/railties
bundle install
bin/test test/application/server_test.rb

Minimum steps NOT to reproduce:

git clone https://github.com/rails/rails.git
cd rails/railties
bundle install
bin/test test/generators/app_generator_test.rb
bin/test test/application/server_test.rb

Actual result

  • Clone rails repository
$ git clone https://github.com/rails/rails.git
Cloning into 'rails'...
remote: Counting objects: 615358, done.
remote: Compressing objects: 100% (74/74), done.
remote: Total 615358 (delta 30), reused 8 (delta 8), pack-reused 615276
Receiving objects: 100% (615358/615358), 153.50 MiB | 3.14 MiB/s, done.
Resolving deltas: 100% (454617/454617), done.
$
  • cd rails/railties and bundle install
$ cd rails/railties/
$ bundle install
Fetching gem metadata from https://rubygems.org/.........
Fetching https://github.com/matthewd/rb-inotify.git
Fetching https://github.com/QueueClassic/queue_classic.git
Fetching https://github.com/resque/resque-scheduler.git
Fetching https://github.com/robin850/sdoc.git
Fetching https://github.com/matthewd/websocket-client-simple.git
Fetching rake 12.2.1
Installing rake 12.2.1
Fetching concurrent-ruby 1.0.5
Installing concurrent-ruby 1.0.5
Fetching i18n 0.9.1
Installing i18n 0.9.1
Fetching minitest 5.10.3
Installing minitest 5.10.3
Fetching thread_safe 0.3.6
Installing thread_safe 0.3.6
Fetching tzinfo 1.2.3
Installing tzinfo 1.2.3
Using activesupport 5.2.0.beta2 from source at `.`
Fetching builder 3.2.3
Installing builder 3.2.3
Fetching erubi 1.7.0
Installing erubi 1.7.0
Fetching mini_portile2 2.2.0
Installing mini_portile2 2.2.0
Fetching nokogiri 1.8.0
Installing nokogiri 1.8.0 with native extensions
Fetching rails-dom-testing 2.0.3
Installing rails-dom-testing 2.0.3
Fetching crass 1.0.3
Installing crass 1.0.3
Fetching loofah 2.1.1
Installing loofah 2.1.1
Fetching rails-html-sanitizer 1.0.3
Installing rails-html-sanitizer 1.0.3
Using actionview 5.2.0.beta2 from source at `.`
Fetching rack 2.0.3
Installing rack 2.0.3
Fetching rack-test 0.8.0
Installing rack-test 0.8.0
Using actionpack 5.2.0.beta2 from source at `.`
Fetching nio4r 2.1.0
Installing nio4r 2.1.0 with native extensions
Fetching websocket-extensions 0.1.2
Installing websocket-extensions 0.1.2
Fetching websocket-driver 0.6.5
Installing websocket-driver 0.6.5 with native extensions
Using actioncable 5.2.0.beta2 from source at `.`
Fetching globalid 0.4.1
Installing globalid 0.4.1
Using activejob 5.2.0.beta2 from source at `.`
Fetching mini_mime 0.1.4
Installing mini_mime 0.1.4
Fetching mail 2.7.0
Installing mail 2.7.0
Using actionmailer 5.2.0.beta2 from source at `.`
Using activemodel 5.2.0.beta2 from source at `.`
Fetching arel 9.0.0
Installing arel 9.0.0
Using activerecord 5.2.0.beta2 from source at `.`
Using activestorage 5.2.0.beta2 from source at `.`
Fetching public_suffix 3.0.1
Installing public_suffix 3.0.1
Fetching addressable 2.5.2
Installing addressable 2.5.2
Fetching amq-protocol 2.2.0
Installing amq-protocol 2.2.0
Fetching io-like 0.3.0
Installing io-like 0.3.0
Fetching archive-zip 0.7.0
Installing archive-zip 0.7.0
Fetching ast 2.3.0
Installing ast 2.3.0
Fetching aws-partitions 1.20.0
Installing aws-partitions 1.20.0
Fetching aws-sigv4 1.0.1
Installing aws-sigv4 1.0.1
Fetching jmespath 1.3.1
Installing jmespath 1.3.1
Fetching aws-sdk-core 3.3.0
Installing aws-sdk-core 3.3.0
Fetching aws-sdk-kms 1.1.0
Installing aws-sdk-kms 1.1.0
Fetching aws-sdk-s3 1.2.0
Installing aws-sdk-s3 1.2.0
Fetching multipart-post 2.0.0
Installing multipart-post 2.0.0
Fetching faraday 0.13.1
Installing faraday 0.13.1
Fetching faraday_middleware 0.12.2
Installing faraday_middleware 0.12.2
Fetching azure-core 0.1.11
Installing azure-core 0.1.11
Fetching azure-storage 0.12.3.preview
Installing azure-storage 0.12.3.preview
Fetching beaneater 1.0.0
Installing beaneater 1.0.0
Fetching dante 0.2.0
Installing dante 0.2.0
Fetching backburner 1.4.1
Installing backburner 1.4.1
Fetching bcrypt 3.1.11
Installing bcrypt 3.1.11 with native extensions
Fetching benchmark-ips 2.7.2
Installing benchmark-ips 2.7.2
Fetching blade-qunit_adapter 2.0.1
Installing blade-qunit_adapter 2.0.1
Fetching coffee-script-source 1.12.2
Installing coffee-script-source 1.12.2
Fetching execjs 2.7.0
Installing execjs 2.7.0
Fetching coffee-script 2.4.1
Installing coffee-script 2.4.1
Fetching curses 1.0.2
Installing curses 1.0.2 with native extensions
Fetching eventmachine 1.2.5
Installing eventmachine 1.2.5 with native extensions
Fetching cookiejar 0.3.3
Installing cookiejar 0.3.3
Fetching em-socksify 0.3.1
Installing em-socksify 0.3.1
Fetching http_parser.rb 0.6.0
Installing http_parser.rb 0.6.0 with native extensions
Fetching em-http-request 1.1.5
Installing em-http-request 1.1.5
Fetching faye-websocket 0.10.7
Installing faye-websocket 0.10.7
Fetching multi_json 1.12.2
Installing multi_json 1.12.2
Fetching faye 1.2.4
Installing faye 1.2.4
Fetching sprockets 3.7.1
Installing sprockets 3.7.1
Fetching daemons 1.2.4
Installing daemons 1.2.4
Fetching thin 1.7.2
Installing thin 1.7.2 with native extensions
Fetching thor 0.20.0
Installing thor 0.20.0
Fetching useragent 0.16.8
Installing useragent 0.16.8
Fetching blade 0.7.1
Installing blade 0.7.1
Fetching ffi 1.9.18
Installing ffi 1.9.18 with native extensions
Fetching childprocess 0.7.1
Installing childprocess 0.7.1
Fetching rubyzip 1.2.1
Installing rubyzip 1.2.1
Fetching selenium-webdriver 3.5.1
Installing selenium-webdriver 3.5.1
Fetching blade-sauce_labs_plugin 0.7.2
Installing blade-sauce_labs_plugin 0.7.2
Fetching msgpack 1.1.0
Installing msgpack 1.1.0 with native extensions
Fetching bootsnap 1.1.2
Installing bootsnap 1.1.2 with native extensions
Using bundler 1.16.0
Fetching bunny 2.6.6
Installing bunny 2.6.6
Fetching byebug 9.0.6
Installing byebug 9.0.6 with native extensions
Fetching xpath 2.1.0
Installing xpath 2.1.0
Fetching capybara 2.15.1
Installing capybara 2.15.1
Fetching chromedriver-helper 1.1.0
Installing chromedriver-helper 1.1.0
Fetching method_source 0.9.0
Installing method_source 0.9.0
Using railties 5.2.0.beta2 from source at `.`
Fetching coffee-rails 4.2.2
Installing coffee-rails 4.2.2
Fetching connection_pool 2.2.1
Installing connection_pool 2.2.1
Fetching dalli 2.7.6
Installing dalli 2.7.6
Fetching declarative 0.0.10
Installing declarative 0.0.10
Fetching declarative-option 0.1.0
Installing declarative-option 0.1.0
Fetching delayed_job 4.1.3
Installing delayed_job 4.1.3
Fetching delayed_job_active_record 4.1.2
Installing delayed_job_active_record 4.1.2
Fetching digest-crc 0.4.1
Installing digest-crc 0.4.1
Fetching et-orbi 1.0.8
Installing et-orbi 1.0.8
Fetching event_emitter 0.2.6
Installing event_emitter 0.2.6
Fetching jwt 2.1.0
Installing jwt 2.1.0
Fetching little-plugger 1.1.4
Installing little-plugger 1.1.4
Fetching logging 2.2.2
Installing logging 2.2.2
Fetching memoist 0.16.0
Installing memoist 0.16.0
Fetching os 0.9.6
Installing os 0.9.6
Fetching signet 0.8.1
Installing signet 0.8.1
Fetching googleauth 0.6.2
Installing googleauth 0.6.2
Fetching httpclient 2.8.3
Installing httpclient 2.8.3
Fetching mime-types-data 3.2016.0521
Installing mime-types-data 3.2016.0521
Fetching mime-types 3.1
Installing mime-types 3.1
Fetching uber 0.1.0
Installing uber 0.1.0
Fetching representable 3.0.4
Installing representable 3.0.4
Fetching retriable 3.1.1
Installing retriable 3.1.1
Fetching google-api-client 0.17.3
Installing google-api-client 0.17.3
Fetching google-cloud-env 1.0.1
Installing google-cloud-env 1.0.1
Fetching google-cloud-core 1.1.0
Installing google-cloud-core 1.1.0
Fetching google-cloud-storage 1.9.0
Installing google-cloud-storage 1.9.0
Fetching hiredis 0.6.1
Installing hiredis 0.6.1 with native extensions
Fetching json 2.1.0
Installing json 2.1.0 with native extensions
Fetching mustache 1.0.5
Installing mustache 1.0.5
Fetching kindlerb 1.2.0
Installing kindlerb 1.2.0
Fetching libxml-ruby 3.0.0
Installing libxml-ruby 3.0.0 with native extensions
Fetching rb-fsevent 0.10.2
Installing rb-fsevent 0.10.2
Using rb-inotify 0.9.9 from https://github.com/matthewd/rb-inotify.git (at close-handling@856730a)
Fetching ruby_dep 1.5.0
Installing ruby_dep 1.5.0
Fetching listen 3.1.5
Installing listen 3.1.5
Fetching metaclass 0.0.4
Installing metaclass 0.0.4
Fetching mini_magick 4.8.0
Installing mini_magick 4.8.0
Fetching minitest-server 1.0.4
Installing minitest-server 1.0.4
Fetching path_expander 1.0.2
Installing path_expander 1.0.2
Fetching minitest-bisect 1.4.0
Installing minitest-bisect 1.4.0
Fetching mocha 1.3.0
Installing mocha 1.3.0
Fetching mono_logger 1.1.0
Installing mono_logger 1.1.0
Fetching mustermann 1.0.0
Installing mustermann 1.0.0
Fetching mysql2 0.4.9
Installing mysql2 0.4.9 with native extensions
Fetching parallel 1.12.0
Installing parallel 1.12.0
Fetching parser 2.4.0.0
Installing parser 2.4.0.0
Fetching pg 0.19.0
Installing pg 0.19.0 with native extensions
Fetching powerpack 0.1.1
Installing powerpack 0.1.1
Fetching puma 3.9.1
Installing puma 3.9.1 with native extensions
Fetching que 0.14.0
Installing que 0.14.0
Using queue_classic 3.2.0.RC1 from https://github.com/QueueClassic/queue_classic.git (at master@cde82d1)
Fetching qunit-selenium 0.0.4
Installing qunit-selenium 0.0.4
Fetching racc 1.4.14
Installing racc 1.4.14 with native extensions
Fetching rack-cache 1.7.0
Installing rack-cache 1.7.0
Fetching rack-protection 2.0.0
Installing rack-protection 2.0.0
Fetching sprockets-rails 3.2.0
Installing sprockets-rails 3.2.0
Using rails 5.2.0.beta2 from source at `.`
Fetching rainbow 2.2.2
Installing rainbow 2.2.2 with native extensions
Fetching rdoc 5.1.0
Installing rdoc 5.1.0
Fetching redcarpet 3.2.3
Installing redcarpet 3.2.3 with native extensions
Fetching redis 4.0.1
Installing redis 4.0.1
Fetching redis-namespace 1.6.0
Installing redis-namespace 1.6.0
Fetching tilt 2.0.8
Installing tilt 2.0.8
Fetching sinatra 2.0.0
Installing sinatra 2.0.0
Fetching vegas 0.1.11
Installing vegas 0.1.11
Fetching resque 1.27.4
Installing resque 1.27.4
Fetching rufus-scheduler 3.4.2
Installing rufus-scheduler 3.4.2
Using resque-scheduler 4.3.0 from https://github.com/resque/resque-scheduler.git (at master@284b862)
Fetching ruby-progressbar 1.9.0
Installing ruby-progressbar 1.9.0
Fetching unicode-display_width 1.3.0
Installing unicode-display_width 1.3.0
Fetching rubocop 0.51.0
Installing rubocop 0.51.0
Fetching sass-listen 4.0.0
Installing sass-listen 4.0.0
Fetching sass 3.5.3
Installing sass 3.5.3
Fetching sass-rails 5.0.7
Installing sass-rails 5.0.7
Using sdoc 1.0.0.rc2 from https://github.com/robin850/sdoc.git (at upgrade@0e34035)
Fetching sequel 4.49.0
Installing sequel 4.49.0
Fetching sigdump 0.2.4
Installing sigdump 0.2.4
Fetching serverengine 1.5.11
Installing serverengine 1.5.11
Fetching sidekiq 5.0.5
Installing sidekiq 5.0.5
Fetching thread 0.1.7
Installing thread 0.1.7
Fetching sneakers 2.5.0
Installing sneakers 2.5.0
Fetching sprockets-export 1.0.0
Installing sprockets-export 1.0.0
Fetching sqlite3 1.3.13
Installing sqlite3 1.3.13 with native extensions
Fetching stackprof 0.2.10
Installing stackprof 0.2.10 with native extensions
Fetching sucker_punch 2.0.2
Installing sucker_punch 2.0.2
Fetching turbolinks-source 5.0.3
Installing turbolinks-source 5.0.3
Fetching turbolinks 5.0.1
Installing turbolinks 5.0.1
Fetching uglifier 3.2.0
Installing uglifier 3.2.0
Fetching w3c_validators 1.3.3
Installing w3c_validators 1.3.3
Fetching websocket 1.2.4
Installing websocket 1.2.4
Using websocket-client-simple 0.3.0 from https://github.com/matthewd/websocket-client-simple.git (at close-race@e161305)
Bundle complete! 61 Gemfile dependencies, 180 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
Post-install message from sucker_punch:
Sucker Punch v2.0 introduces backwards-incompatible changes.
Please see https://github.com/brandonhilkert/sucker_punch/blob/master/CHANGES.md#20 for details.
  • gem environment to show GEM PATHS:
$ gem environment
RubyGems Environment:
  - RUBYGEMS VERSION: 2.7.3
  - RUBY VERSION: 2.4.2 (2017-09-14 patchlevel 198) [x86_64-linux-gnu]
  - INSTALLATION DIRECTORY: /var/lib/gems/2.4.0
  - USER INSTALLATION DIRECTORY: /home/vagrant/.gem/ruby/2.4.0
  - RUBY EXECUTABLE: /usr/bin/ruby2.4
  - EXECUTABLE DIRECTORY: /usr/local/bin
  - SPEC CACHE DIRECTORY: /home/vagrant/.gem/specs
  - SYSTEM CONFIGURATION DIRECTORY: /etc
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86_64-linux
  - GEM PATHS:
     - /var/lib/gems/2.4.0
     - /home/vagrant/.gem/ruby/2.4.0
     - /usr/lib/x86_64-linux-gnu/rubygems-integration/2.4.0
     - /usr/share/rubygems-integration/2.4.0
     - /usr/share/rubygems-integration/all
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - https://rubygems.org/
  - SHELL PATH:
     - /usr/local/sbin
     - /usr/local/bin
     - /usr/sbin
     - /usr/bin
     - /sbin
     - /bin
     - /usr/games
     - /usr/local/games
     - /snap/bin
$
  • No railties in the first GEM PATH yet.
$ ls -l /var/lib/gems/2.4.0/gems/railties*
ls: cannot access '/var/lib/gems/2.4.0/gems/railties*': No such file or directory
  • Execute test/application/server_test.rb and it fails
$ bin/test test/application/server_test.rb
Run options: --seed 57363

# Running:

.F

Failure:
ApplicationTests::ServerTest#test_restart_rails_server_with_custom_pid_file_path [/home/vagrant/rails/railties/test/application/server_test.rb:48]:
"Inherited" expected, but got:

...
/usr/local/lib/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:59:in `require': cannot load such file -- rails/all (LoadError)
        from /usr/local/lib/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:59:in `require'
        from /tmp/d20171208-9633-xl9pb6/app/config/boot.rb:1:in `<top (required)>'
        from bin/rails:3:in `require_relative'
        from bin/rails:3:in `<main>'
.
Expected "...\r\n/usr/local/lib/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:59:in `require': cannot load such file -- rails/all (LoadError)\r\n\tfrom /usr/local/lib/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:59:in `require'\r\n\tfrom /tmp/d20171208-9633-xl9pb6/app/config/boot.rb:1:in `<top (required)>'\r\n\tfrom bin/rails:3:in `require_relative'\r\n\tfrom bin/rails:3:in `<main>'\r\n" to include "Inherited".


bin/test home/vagrant/rails/railties/test/application/server_test.rb:35



Finished in 14.064241s, 0.1422 runs/s, 0.5688 assertions/s.
2 runs, 8 assertions, 1 failures, 0 errors, 0 skips
$
  • Execute test/generators/app_generator_test.rb which installs railties to GEM PATH.
$ bin/test test/generators/app_generator_test.rb
Run options: --seed 50907

# Running:

.........................................................................................................

Finished in 114.283739s, 0.9188 runs/s, 7.5864 assertions/s.
105 runs, 867 assertions, 0 failures, 0 errors, 0 skips
$
  • railties found in the GEM PATH
$ ls -l /var/lib/gems/2.4.0/gems/railties*
total 28
-rw-r--r-- 1 root root 3918 Dec  8 15:51 CHANGELOG.md
drwxr-xr-x 2 root root 4096 Dec  8 15:51 exe
drwxr-xr-x 4 root root 4096 Dec  8 15:51 lib
-rw-r--r-- 1 root root 1073 Dec  8 15:51 MIT-LICENSE
-rw-r--r-- 1 root root 4891 Dec  8 15:51 RDOC_MAIN.rdoc
-rw-r--r-- 1 root root  910 Dec  8 15:51 README.rdoc
  • Execute test/application/server_test.rb and it finishes successfully
$ bin/test test/application/server_test.rb
Run options: --seed 41790

# Running:

..

Finished in 5.646030s, 0.3542 runs/s, 1.4169 assertions/s.
2 runs, 8 assertions, 0 failures, 0 errors, 0 skips
$