Comments (9)
@sshaw @subzero10 I think the issue is that minitest/autorun is using an at_exit
to run the tests, which is running after our own at_exit
cleans up (calls Honeybadger.stop
) and shuts down our agent.
If you require Honeybadger in plain Ruby mode (which skips our at_exit
), the tests pass:
require "minitest/autorun"
- require "honeybadger"
+ require "honeybadger/ruby"
# ...
I also added the following config to get a bit more logging:
Honeybadger.configure do |config|
config.backend = :test
config.api_key = "whatEVER!"
+ config.logger = Logger.new($stdout)
+ config.debug = true
end
from honeybadger-ruby.
Thanks. That works in the above example but in the real case the code being tested does a require "honeybadger"
which will negate the require "honeybadger/ruby"
. Here's the logging output:
** [Honeybadger] Initializing Honeybadger Error Tracker for Ruby. Ship it! version=5.2.1 framework=ruby level=1 pid=55372
I, [2023-08-03T19:52:01.900005 #55372] INFO -- honeybadger: shutting down worker level=0 pid=55372 at="lib/honeybadger/worker.rb:53:in `shutdown'"
I, [2023-08-03T19:52:01.900121 #55372] INFO -- honeybadger: killing worker thread level=0 pid=55372 at="lib/honeybadger/worker.rb:128:in `kill!'"
Run options: --seed 33418
# Running:
I, [2023-08-03T19:52:05.251854 #55372] INFO -- honeybadger: Reporting error id=XXXXX-9259-XXXXX-95e0-842ebf55be85 level=1 pid=55372
I, [2023-08-03T19:52:07.256001 #55372] INFO -- honeybadger: Reporting error id=XXXXX-0fa5-XXXXX-9b45-24e18581e746 level=1 pid=55372
F
Failure:
TestMeme#test_bar [test.rb:31]:
Expected: 2
Actual: 0
rails test test.rb:23
I, [2023-08-03T19:52:07.258525 #55372] INFO -- honeybadger: Reporting error id=XXXXX-a379-XXXXX-bab5-6ad95085f473 level=1 pid=55372
F
Failure:
TestMeme#test_foo [test.rb:20]:
Expected: 1
Actual: 0
rails test test.rb:17
Finished in 2.010293s, 0.9949 runs/s, 0.9949 assertions/s.
2 runs, 2 assertions, 2 failures, 0 errors, 0 skips
from honeybadger-ruby.
rails test test.rb:17
Odd that this shows but after a fresh bundle install
it goes away and I get the same error
from honeybadger-ruby.
Here's something that might work. Add the following to your honeybadger.yml config:
This did not work when the config file was in the project's root directory.
or use the HONEYBADGER_SEND_DATA_AT_EXIT=false environment variable when running tests.
This fixed things. Thanks!
Would def add some docs on how to deal with this! 📝
from honeybadger-ruby.
or use the HONEYBADGER_SEND_DATA_AT_EXIT=false environment variable when running tests.
This fixed things. Thanks!
For future readers: this worked as an env var but not via Honeybadger.configure { |cfg| cfg.send_data_at_exit = false }
from honeybadger-ruby.
Here's something that might work. Add the following to your honeybadger.yml config:
This did not work when the config file was in the project's root directory.
or use the HONEYBADGER_SEND_DATA_AT_EXIT=false environment variable when running tests.
This fixed things. Thanks!
Would def add some docs on how to deal with this! 📝
@subzero10 should we document this somewhere, maybe in the troubleshooting guide?
from honeybadger-ruby.
@subzero10 should we document this somewhere, maybe in the troubleshooting guide?
Yes, I'll take care of that :)
from honeybadger-ruby.
More info:
~/code/ruby/honeybadger-test >cat Gemfile
source "https://rubygems.org"
gem "honeybadger"
gem "minitest"
~/code/ruby/honeybadger-test >cat Gemfile.lock
GEM
remote: https://rubygems.org/
specs:
honeybadger (5.2.1)
minitest (5.19.0)
PLATFORMS
ruby
DEPENDENCIES
honeybadger
minitest
BUNDLED WITH
2.1.0
~/code/ruby/honeybadger-test >bundle exec ruby test.rb
** [Honeybadger] Initializing Honeybadger Error Tracker for Ruby. Ship it! version=5.2.1 framework=ruby level=1 pid=10575
Run options: --seed 30909
# Running:
** [Honeybadger] Reporting error id=XXXXX level=1 pid=10575
** [Honeybadger] Reporting error id=XXXXX level=1 pid=10575
F** [Honeybadger] Reporting error id=XXXXX level=1 pid=10575
F
Finished in 2.005228s, 0.9974 runs/s, 0.9974 assertions/s.
1) Failure:
TestMeme#test_bar [test.rb:28]:
Expected: 2
Actual: 0
2) Failure:
TestMeme#test_foo [test.rb:17]:
Expected: 1
Actual: 0
2 runs, 2 assertions, 2 failures, 0 errors, 0 skips
from honeybadger-ruby.
Here's something that might work. Add the following to your honeybadger.yml config:
test:
send_data_at_exit: false
or use the HONEYBADGER_SEND_DATA_AT_EXIT=false
environment variable when running tests.
That should skip the Honeybadger.stop
call in our at_exit
callback:
honeybadger-ruby/lib/honeybadger/singleton.rb
Lines 69 to 77 in 5ba424b
from honeybadger-ruby.
Related Issues (20)
- `Honeybadger.notify` requires `error_message` to be specified when using a Hash HOT 4
- Documentation and source mismatch with Rails.error.record HOT 1
- `Honeybadger::Config#respond_to?` Always Returns true
- Help suppressing a certain error HOT 4
- Honeybadger CLI errors when the deploy command is called with any option HOT 3
- Invalid class_name param in documentation HOT 1
- Use nested context from objects where available
- Sidekiq 7.1.5 and later changes number of arguments for error handlers
- Add check-in configuration sync HOT 2
- Automate releases with Github Actions
- Flaky test in JRuby test matrix entry
- Allow check-ins to be made by slug as well as id. HOT 8
- Avoid bundling unnecessary dependencies in published gem HOT 3
- Exceptions raised in jobs from Solid Queue are not automatically reported HOT 10
- Sanitizer#filter_key? returns a warning for Numeric hash keys HOT 5
- ActiveJob premature reporting HOT 2
- ActiveJob rescued exceptions should not be reported HOT 2
- Honeybadger.context returns Honeybadger::Agent when passing a block
- good_job related exception at app startup HOT 8
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 honeybadger-ruby.