-
-
Notifications
You must be signed in to change notification settings - Fork 516
Add Sentry::DebugTransport for testing/debugging #2664
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
Conversation
88ede05
to
6a63405
Compare
a51b834
to
2c4ff7e
Compare
2c4ff7e
to
0735440
Compare
0735440
to
5d4cdb2
Compare
087c021
to
7336f55
Compare
28bb893
to
7992e27
Compare
This is important because that's how actual Transports behave. The specs had to be changed because their expectations were based on behavior specific to DummyTransport. Reasons for changing spec expectations: Log spec creates a transaction and we run profiler for every transaction, but due to sampling decision profile event is being dropped and we end up with a client report. SessionFlush calls capture_envelope which bypasses send_event, but the test actually does send two error events, so now that DummyTransport#send_event calls super, we end up (correctly) with 3 envelopes: 2 from errors, and 1 from session.
7992e27
to
0cec976
Compare
0cec976
to
2b0d49e
Compare
@sl0thentr0py mind taking another look? I made a couple of extra improvements and refactored DebugTransport into a delegator. |
2b0d49e
to
adc27b3
Compare
@@ -390,7 +390,8 @@ | |||
|
|||
Sentry.get_current_client.flush | |||
|
|||
expect(sentry_envelopes.size).to be(2) | |||
# 3 envelopes: log, transaction, and client_report about dropped profile |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we actually shouldn't be sending the dropped profile client report here since we don't have profiles_sample_rate
enabled, we should fix this separately
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sl0thentr0py yeah it seemed suspicious, I reported an issue about this #2669
if Sentry.initialized? | ||
transport = Sentry.get_current_client&.transport | ||
|
||
if transport.is_a?(Sentry::DebugTransport) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we aren't actually using the DebugTransport
anywhere in the tests so why is this needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sl0thentr0py another PR will actually use this in a couple of e2e test
@@ -667,11 +667,15 @@ def will_be_sampled_by_sdk | |||
|
|||
Sentry.session_flusher.flush | |||
|
|||
expect(sentry_envelopes.count).to eq(1) | |||
envelope = sentry_envelopes.first | |||
expect(sentry_envelopes.count).to eq(3) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why did these values change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sl0thentr0py because the test actually sends 2 errors and flushes session which sends another event, so total is 3 envelopes, previously dummy transport wouldn't catch 2 other envelopes
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2664 +/- ##
==========================================
+ Coverage 97.38% 97.41% +0.02%
==========================================
Files 134 135 +1
Lines 5169 5229 +60
==========================================
+ Hits 5034 5094 +60
Misses 135 135
🚀 New features to boost your workflow:
|
Long story short: I think this is something very useful to have. I missed something like this in the past and when I worked on e2e test setup, I figured it will be a good moment to finally add it because it helped with automated e2e testing too.