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

Fix inconsistent tenant/activity test #1135

Merged
merged 1 commit into from
Nov 21, 2024

Conversation

richardszalay
Copy link
Contributor

The test relied on accessing IHttpActivityFeature after the request completed in order to extract the Activity to assert against.

However, the runtime (HostingApplication) actually sets the value of HttpActivityFeature.Activity to null after each request so that the HttpActivityFeature can be recycled.

This commit works around this behavior by copying the Activity into a custom feature.

The test relied on accessing IHttpActivityFeature after the request
completed in order to extract the Activity to assert against.

However, the runtime
(https://github.com/dotnet/aspnetcore/blob/main/src/Hosting/Hosting/src/Internal/HostingApplication.cs)
actually sets the value of IHttpActivityFeature.Activity to null after
each request so that the IHttpActivityFeature can be recycled.

This commit works around this behavior by copying the Activity into a
custom feature.
@richardszalay richardszalay force-pushed the fix_tenant_activity_test branch from cc4ab7d to a3bb54e Compare November 19, 2024 10:20
@jeremydmiller
Copy link
Member

Nice!

@jeremydmiller jeremydmiller merged commit 374293d into JasperFx:main Nov 21, 2024
1 check passed
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.

2 participants