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

Make puma log silence completely #2011

Closed
wants to merge 2 commits into from
Closed

Conversation

ta1kt0me
Copy link
Contributor

Puma log is shown that puma server starts. Using action_dispatch_system_test_case load hook can stop its output

Before

$ bin/rspec spec/system/tasks_spec.rb
Capybara starting Puma...
* Version 3.12.0 , codename: Llamas in Pajamas
* Min threads: 0, max threads: 4
* Listening on tcp://127.0.0.1:51998
.

Finished in 1.39 seconds (files took 0.91103 seconds to load)
1 example, 0 failures

After

$ bin/rspec spec/system/tasks_spec.rb
.

Finished in 1.22 seconds (files took 0.84185 seconds to load)
1 example, 0 failures

@benoittgt
Copy link
Member

Hello @ta1kt0me

Thanks a lot for your patch. By any chance do you think you can provide a test for this?

I will look at the CI (Puma requir Ruby 2.2+ minimum now).

@ta1kt0me
Copy link
Contributor Author

Thanks for your comment, I'll try it.

@JonRowe
Copy link
Member

JonRowe commented Jul 17, 2018

Honestly I'll be happy to merge this when green (depends on #2013)

@benoittgt
Copy link
Member

benoittgt commented Jul 20, 2018

CI is now green. Do you think you can rebase a re-push? I can look at this, this afternoon. 👋

@ta1kt0me
Copy link
Contributor Author

@benoittgt I'm sorry for late. I have rebased it.

@benoittgt
Copy link
Member

Hello

It seems your test is broken. What I did instead is:

The test fails on:

$ bundle exec cucumber features/system_specs/system_specs.feature:38                                                                                      [20:08:02]
/Users/bti/code/bundle/ruby/2.5.0/gems/gherkin-2.12.2/lib/gherkin/formatter/filter_formatter.rb:105: warning: constant ::Fixnum is deprecated
Using the default profile...
..F--

(::) failed steps (::)

Exit status was 1 but expected it to be 0. Output:


Randomized with seed 7465

Widget management
  enables me to create widgets (FAILED - 1)

Failures:

  1) Widget management enables me to create widgets
     Failure/Error: raise ActionController::RoutingError, "No route matches [#{env['REQUEST_METHOD']}] #{env['PATH_INFO'].inspect}"

     ActionController::RoutingError:
       No route matches [GET] "/stylesheets/application.css"



     # /Users/bti/code/bundle/ruby/2.5.0/gems/railties-5.2.0/lib/rails/rack/logger.rb:38:in `call_app'
     # /Users/bti/code/bundle/ruby/2.5.0/gems/railties-5.2.0/lib/rails/rack/logger.rb:26:in `block in call'
     # /Users/bti/code/bundle/ruby/2.5.0/gems/railties-5.2.0/lib/rails/rack/logger.rb:26:in `call'
     # /Users/bti/code/bundle/ruby/2.5.0/gems/rack-2.0.5/lib/rack/method_override.rb:22:in `call'
     # /Users/bti/code/bundle/ruby/2.5.0/gems/rack-2.0.5/lib/rack/runtime.rb:22:in `call'
     # /Users/bti/code/bundle/ruby/2.5.0/gems/rack-2.0.5/lib/rack/sendfile.rb:111:in `call'
     # /Users/bti/code/bundle/ruby/2.5.0/gems/railties-5.2.0/lib/rails/engine.rb:524:in `call'
     # /Users/bti/code/bundle/ruby/2.5.0/gems/rack-2.0.5/lib/rack/urlmap.rb:68:in `block in call'
     # /Users/bti/code/bundle/ruby/2.5.0/gems/rack-2.0.5/lib/rack/urlmap.rb:53:in `each'
     # /Users/bti/code/bundle/ruby/2.5.0/gems/rack-2.0.5/lib/rack/urlmap.rb:53:in `call'
     # /Users/bti/code/bundle/ruby/2.5.0/gems/rack-2.0.5/lib/rack/builder.rb:153:in `call'
     # /Users/bti/code/bundle/ruby/2.5.0/gems/capybara-2.18.0/lib/capybara/server.rb:44:in `call'
     # /Users/bti/code/bundle/ruby/2.5.0/gems/puma-3.12.0/lib/puma/configuration.rb:225:in `call'
     # /Users/bti/code/bundle/ruby/2.5.0/gems/puma-3.12.0/lib/puma/server.rb:658:in `handle_request'
     # /Users/bti/code/bundle/ruby/2.5.0/gems/puma-3.12.0/lib/puma/server.rb:472:in `process_client'
     # /Users/bti/code/bundle/ruby/2.5.0/gems/puma-3.12.0/lib/puma/server.rb:332:in `block in run'
     # /Users/bti/code/bundle/ruby/2.5.0/gems/puma-3.12.0/lib/puma/thread_pool.rb:133:in `block in spawn_thread'
     # ------------------
     # --- Caused by: ---
     # Capybara::CapybaraError:
     #   Your application server raised an error - It has been raised in your test code because Capybara.raise_server_errors == true
     #   /Users/bti/code/bundle/ruby/2.5.0/gems/capybara-2.18.0/lib/capybara/session.rb:145:in `raise_server_error!'

Top 1 slowest examples (1.56 seconds, 99.8% of total time):
  Widget management enables me to create widgets
    1.56 seconds ./spec/system/widget_system_spec.rb:8

Finished in 1.56 seconds (files took 1.22 seconds to load)
1 example, 1 failure

Failed examples:

rspec ./spec/system/widget_system_spec.rb:8 # Widget management enables me to create widgets

Randomized with seed 7465


 (RSpec::Expectations::ExpectationNotMetError)
features/system_specs/system_specs.feature:59:in `Then the exit status should be 0'

Failing Scenarios:
cucumber features/system_specs/system_specs.feature:38 # Scenario: System specs driven by selenium_chrome_headless

1 scenario (1 failed)
5 steps (1 failed, 2 skipped, 2 passed)
0m5.098s

So fix is good for me. I don't know how much we invest to fix the test.

@JonRowe
Copy link
Member

JonRowe commented Jul 22, 2018

chromedriver isn't available on travis without installing it, if theres a driver that works built in that would work, but I can see the puma output in the output...

@benoittgt
Copy link
Member

Are we accepting this patch without the test?

@JonRowe
Copy link
Member

JonRowe commented Aug 22, 2018

I think we need some form of integration or smoke test here really

@benoittgt
Copy link
Member

@ta1kt0me do you think you have a look.

Otherwise I will look at it.

@ta1kt0me
Copy link
Contributor Author

@benoittgt @JonRowe I'm sorry for replying so late and thank you for your advice. I found the way which resolves #2011 (comment) 's error, but I can not be sure it's good solution.

diff --git a/Rakefile b/Rakefile
index 6bb2e0c4..435e361f 100644
--- a/Rakefile
+++ b/Rakefile
@@ -60,7 +60,7 @@ namespace :generate do

       # Rails 4 cannot use a `rails` binstub generated by Bundler
       sh "rm -f #{bindir}/rails"
-      sh "bundle exec rails new ./tmp/example_app --no-rc --skip-javascript --skip-sprockets --skip-git --skip-test-unit --skip-listen --skip-bundle --template=example_app_generator/generate_app.rb"
+      sh "bundle exec rails new ./tmp/example_app --no-rc --skip-javascript --skip-git --skip-test-unit --skip-listen --skip-bundle --template=example_app_generator/generate_app.rb"

       in_example_app do
         sh "./travis_retry_bundle_install.sh 2>&1"

The above makes all spec in green in my local. Or if you have other better solution, it might be good.

@benoittgt
Copy link
Member

I think the intent to skip sprocket was to make the app smaller.

Do you think you can add a commit with this change to check the CI?

@ta1kt0me
Copy link
Contributor Author

ta1kt0me commented Sep 4, 2018

I've added the change.

@benoittgt
Copy link
Member

It seems their is an issue with the webdriver.

             Unable to find chromedriver. Please download the server from http://chromedriver.storage.googleapis.com/index.html and place it somewhere on your PATH. More info at https://github.com/SeleniumHQ/selenium/wiki/ChromeDriver.

@JonRowe
Copy link
Member

JonRowe commented Sep 4, 2018

As per my earlier comment:

chromedriver isn't available on travis without installing it, if theres a driver that works built in that would work, but I can see the puma output in the output...

😂

@@ -75,6 +75,10 @@ def app

attr_reader :driver

if ::Rails.version.to_f == 5.1
Copy link
Member

Choose a reason for hiding this comment

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

Could you explain why?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The first implementation is lack of considering of compatibility. action_dispatch_system_test_case is available from Rails 5.2 . The change is needed to pass System specs driven by selenium_chrome_headless spec in Rails 5.1 .

Copy link
Member

Choose a reason for hiding this comment

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

It was literally checking the method exists, then using it, can you explain the "lack of compatibility" I'm afraid I don't understand how "not calling the method if it doesn't exist" changes anything... Also note this need to work on 5.2 and beyond, so this check seems incorrect.

@benoittgt
Copy link
Member

CI seems to be better.

Copy link
Member

@benoittgt benoittgt left a comment

Choose a reason for hiding this comment

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

CI is breaking because of SASS on Ruby 1.9.3.

Also unanswered question https://github.com/rspec/rspec-rails/pull/2011/files#r232443748 😊

@@ -60,7 +60,7 @@ namespace :generate do

# Rails 4 cannot use a `rails` binstub generated by Bundler
sh "rm -f #{bindir}/rails"
sh "bundle exec rails new ./tmp/example_app --no-rc --skip-javascript --skip-sprockets --skip-git --skip-test-unit --skip-listen --skip-bundle --template=example_app_generator/generate_app.rb"
sh "bundle exec rails new ./tmp/example_app --no-rc --skip-javascript --skip-git --skip-test-unit --skip-listen --skip-bundle --template=example_app_generator/generate_app.rb"
Copy link
Member

@benoittgt benoittgt Dec 8, 2018

Choose a reason for hiding this comment

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

Could you explain why you changed this?

This has a cost. It seems that sprockets adds sass gem. On Ruby 1.9.3 it adds deprecation warning and breaks the CI

     Failure/Error:
       expect(capture_exec(custom_env, exec_script)).to eq(
         "#{::Rails.root}/spec/mailers/previews"
       )
     
       expected: "/home/travis/build/rspec/rspec-rails/tmp/example_app/spec/mailers/previews"
            got: #<struct CaptureExec io="DEPRECATION WARNING:\nSass 3.5 will no longer support Ruby 1.9.3.\nPlease up...ible.\n\n/home/travis/build/rspec/rspec-rails/tmp/example_app/spec/mailers/previews", exit_status=0>

I revert this line and test on Ruby 1.9.3 without issue. I didn't test on all rails version. But maybe it doesn't need to be committed?

Copy link
Member

Choose a reason for hiding this comment

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

Yep I'd like this reverted too

@pirj
Copy link
Member

pirj commented Jan 8, 2020

@ta1kt0me Can you please rebase? CI is more stable lately.

@pirj
Copy link
Member

pirj commented Mar 13, 2020

@ta1kt0me Would you like to wrap this up before we release 4.0?

@benoittgt
Copy link
Member

I can handle it if needed

@pirj
Copy link
Member

pirj commented Mar 15, 2020

This would further confirm your already quite intense comeback!

benoittgt added a commit that referenced this pull request Mar 16, 2020
benoittgt added a commit that referenced this pull request Mar 16, 2020
@benoittgt benoittgt closed this in 8431e7b Mar 17, 2020
benoittgt added a commit that referenced this pull request Mar 17, 2020
JonRowe pushed a commit that referenced this pull request Mar 24, 2020
JonRowe pushed a commit that referenced this pull request Mar 24, 2020
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