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

Improve spec boot time and clean up logs #2444

Merged
merged 4 commits into from
Feb 6, 2018
Merged

Improve spec boot time and clean up logs #2444

merged 4 commits into from
Feb 6, 2018

Conversation

voodoorai2000
Copy link
Member

What

  • Regenerate bin stubs
  • Remove circular argument reference warning
  • Run Coveralls only in Travis CI
  • Remove default profiling

Why

  • The new bin stubs bring down spec boot time from 10 seconds to 1
  • Warnings are never pretty
  • Running coveralls locally is not very efficient, build takes too long
  • Profiling when running tests locally mainly clutters the log, we can reactivate it at any time to identify and refactor the longest running specs

Screenshots

  • Before
consul[master]: time bin/rspec spec/models/user_spec.rb:8
[Coveralls] Set up the SimpleCov formatter.
[Coveralls] Using SimpleCov's 'rails' settings.
warning: parser/current is loading parser/ruby23, which recognizes
warning: 2.3.5-compliant syntax, but you are running 2.3.2.
warning: please see https://github.com/whitequark/parser#compatibility-with-ruby-mri.
The PGconn, PGresult, and PGError constants are deprecated, and will be
removed as of version 1.0.

You should use PG::Connection, PG::Result, and PG::Error instead, respectively.

Called from /Users/raimondgarcia/.rvm/gems/ruby-2.3.2/gems/activesupport-4.2.10/lib/active_support/dependencies.rb:240:in `load_dependency'
Run options: include {:focus=>true, :locations=>{"./spec/models/user_spec.rb"=>[8]}}

Randomized with seed 34807

User
  #debate_votes
    returns {} if no debate

Top 1 slowest examples (0.35638 seconds, 30.3% of total time):
  User#debate_votes returns {} if no debate
    0.35638 seconds ./spec/models/user_spec.rb:8

Finished in 1.18 seconds (files took 11.33 seconds to load)
1 example, 0 failures

Randomized with seed 34807

[Coveralls] Outside the CI environment, not sending data.

real	0m14.194s
user	0m8.791s
sys	0m3.288s
  • After
consul[specs]: time bin/rspec spec/models/user_spec.rb:8
Running via Spring preloader in process 63595
Run options: include {:focus=>true, :locations=>{"./spec/models/user_spec.rb"=>[8]}}

Randomized with seed 3015

User
  #debate_votes
    returns {} if no debate

Finished in 1.51 seconds (files took 1.17 seconds to load)
1 example, 0 failures

Randomized with seed 3015


real	0m4.044s
user	0m0.219s
sys	0m0.069s

Deployment

  • As usual

Warnings

  • None

These are the new binstubs available in the our current `spring`
version, which make specs run much faster 😌
We were seeing this warning when running specs
`spec/features/admin/budgets_spec.rb:322: warning: circular argument
reference - phase_kind`

This commit should fix the warning
We were seeing a log message when running specs locally

```
[Coveralls] Set up the SimpleCov formatter.
[Coveralls] Using SimpleCov's 'rails' settings.
```

As Coveralls is mainly used in Travis CI, we do not need to load it in
every spec run
This makes tests run a tiny bit faster and cleans up the logs when
running specs locally

We can still configure rspec to run the profiler when we go into improving spec performance
@voodoorai2000 voodoorai2000 merged commit f5c5293 into master Feb 6, 2018
@voodoorai2000 voodoorai2000 deleted the specs branch February 6, 2018 16:15
clairezed pushed a commit to CDJ11/CDJ that referenced this pull request Jun 26, 2018
Improve spec boot time and clean up logs
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.

None yet

2 participants