Comments (7)
You could not require the gem in your test environment, for example in your gemfile add :require => false
and then manually require it in an initializer.
Another way (which is how i've done it) is to add this to your spec_helper.rb
# Make rack timeout less noisy in our tests.
Rack::Timeout.logger.formatter = ->(*args) { nil }
Maybe this is something that could be added to the readme?
from rack-timeout.
I'll take this into consideration but generally the solution is indeed to change/remove the logger. This will be easier in the next beta, too.
What if I don't log anything for RACK_ENV=test
?
from rack-timeout.
So now that I've pushed all the nice stuff…
How about:
Rack::Timeout.unregister_state_change_observer(:logger) if ENV['RACK_ENV'] == 'test'
Check out the logging section way down in the readme.
from rack-timeout.
@wuputah what's your take here? I kinda don't feel like we should behave differently during tests. What if someone wants to test the log output itself?
The solutions presented above for silencing logs during testing are good enough for me.
from rack-timeout.
I'm a fan of software being very quiet by default and allowing people to opt-into logging. Perhaps the default logging level be FATAL
?
from rack-timeout.
This will also likely be fixed by #37 if your test env sends logs to somewhere other than stderr so I'm closing it, but will take it into account for #37.
from rack-timeout.
So d1aed68 should address this. For example, if you're using Rails, rack-timeout will log to the rails logger, so when running tests, its logs would end up in logs/test.log
.
Otherwise if you wanna remove logging entirely, I refer you back to my comment above.
from rack-timeout.
Related Issues (20)
- Rails 6 ~ middleware isn't inserted out of the box HOT 8
- Conditional Timeouts HOT 1
- Manually Inserting Middleware + Setting Timeout With Rails WITHOUT Gemfile HOT 5
- Release ActiveRecord connections properly on rack timeout HOT 1
- Some requests have an uncontroller timeout time HOT 1
- Improve rack-timeout docs to map raised exceptions to desired status code HOT 11
- Request still running/completing after timeout? HOT 5
- Proposal to deprecate `term_on_timeout: false` HOT 7
- Broken ActiveRecord connections after a timeout HOT 4
- Detect if the middleware is already loaded and prevent it from being loaded twice HOT 9
- Unicorn graceful shutdown seems incompatible with `TERM` usage HOT 4
- Push 0.6.1 to Rubygems HOT 4
- Prefer sending SIGKILL over SIGTERM to a process HOT 2
- is "active" observer turned off for non-debug? HOT 5
- PR needed/wanted: Incompatibility with Ruby on Windows HOT 1
- [Feature Request] Optionally notify observers only HOT 4
- Request: timeout exempt requests HOT 1
- problem with unicorn graceful restart HOT 2
- possibility to timeout only for GET requests ? HOT 1
- Puma and rack-timeout results in a null pointer after running for some time HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rack-timeout.