Skip to content

test: add ASP.NET Core blocking detection integration tests - #5578

Open
z0rimo wants to merge 1 commit into
getsentry:mainfrom
z0rimo:test/aspnetcore-blocking-detection-5394
Open

z0rimo wants to merge 1 commit into
getsentry:mainfrom
z0rimo:test/aspnetcore-blocking-detection-5394

Conversation

@z0rimo

@z0rimo z0rimo commented Sep 14, 2026

Copy link
Copy Markdown

Summary

Adds ASP.NET Core integration coverage for CaptureBlockingCalls.

The tests verify that:

  • multiple requests create transient SentryMiddleware instances while reusing the same IBlockingMonitor and TaskBlockingListener
  • a synchronous blocking call is captured as a Sentry event with the BlockingCallDetector mechanism
  • disabling CaptureBlockingCalls avoids creating the blocking detector services and does not capture a blocking-call event

This uses the existing TestServer integration test infrastructure and does not change production code.

Fixes #5394

Testing

NO_MOBILE=true dotnet test test/Sentry.AspNetCore.Tests/Sentry.AspNetCore.Tests.csproj -f net10.0

Passed: 289
Failed: 0
Skipped: 0

The three new tests were also run 10 consecutive times with no failures.

@github-actions github-actions Bot added the risk: medium PR risk score: medium label Sep 14, 2026
@codecov

codecov Bot commented Sep 15, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 77.22%. Comparing base (3985304) to head (2693b92).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5578      +/-   ##
==========================================
+ Coverage   74.75%   77.22%   +2.47%     
==========================================
  Files         515      467      -48     
  Lines       18963    17229    -1734     
  Branches     3694     3385     -309     
==========================================
- Hits        14175    13305     -870     
+ Misses       3909     3157     -752     
+ Partials      879      767     -112     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jamescrosswell jamescrosswell left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks @z0rimo - overall, looks good. I made a few comments/suggestions.

Comment thread test/Sentry.AspNetCore.Tests/IntegrationsTests.BlockingDetection.cs Outdated
Comment thread test/Sentry.AspNetCore.Tests/IntegrationsTests.BlockingDetection.cs
Comment thread test/Sentry.AspNetCore.Tests/IntegrationsTests.BlockingDetection.cs Outdated
@z0rimo
z0rimo force-pushed the test/aspnetcore-blocking-detection-5394 branch from 4a62a14 to 2693b92 Compare September 17, 2026 03:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: medium PR risk score: medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add integration tests for CaptureBlockingCalls blocking detection

2 participants