-
Notifications
You must be signed in to change notification settings - Fork 5
V9.0.4/package maintenance #114
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
…yThatAssetIsBeingDisposedOnFinalize ONLY fails in GHA/W2022
WalkthroughThis pull request updates dependency versions and standardizes test host configurations. The Directory.Packages.props file now references Codebelt.Extensions.Xunit packages at version 9.1.3 instead of 9.0.1. Across many test projects—covering authentication, MVC, Razor TagHelpers, HTTP middleware, and Extensions—the calls to the WebHostTestFactory methods have been updated to explicitly include the parameter Changes
Sequence Diagram(s)sequenceDiagram
participant Test as Test Method
participant Factory as WebHostTestFactory
participant Host as Test Host
Test->>Factory: Call Create/RunAsync(..., hostFixture: null)
Factory->>Host: Initialize host with null fixture
Host-->>Factory: Return configured host
Factory-->>Test: Return test host instance
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 8000 Files selected for processing (88)
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 0
🧹 Nitpick comments (1)
test/Cuemon.Core.Tests/DisposableTest.cs (1)
173-175
: Improved garbage collection reliability, but consider a more deterministic approach.The changes made to the garbage collection process will increase test reliability by:
- Using
GC.MaxGeneration
instead of generation 0, ensuring a more thorough collection that includes objects in all generations- Adding a 500ms delay to give finalizers additional time to complete
While this approach will likely make the test more stable, fixed delays can sometimes be problematic in test environments:
Consider a more deterministic approach such as:
GC.Collect(GC.MaxGeneration, GCCollectionMode.Forced); GC.WaitForPendingFinalizers(); -Task.Delay(500).Wait(); // Add a small delay +// Perform a second collection to ensure finalized objects are collected +GC.Collect(GC.MaxGeneration, GCCollectionMode.Forced); +GC.WaitForPendingFinalizers();This double collection pattern is a common practice for finalizer tests and avoids timing-dependent behavior. Alternatively, if the delay is necessary, consider making the delay duration configurable to accommodate different test environments.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (45)
Directory.Packages.props
(1 hunks)test/Cuemon.AspNetCore.Authentication.Tests/Basic/BasicAuthenticationHandlerTest.cs
(3 hunks)test/Cuemon.AspNetCore.Authentication.Tests/Basic/BasicAuthenticationMiddlewareTest.cs
(3 hunks)test/Cuemon.AspNetCore.Authentication.Tests/Digest/DigestAccessAuthenticationHandlerTest.cs
(5 hunks)test/Cuemon.AspNetCore.Authentication.Tests/Digest/DigestAccessAuthenticationMiddlewareTest.cs
(4 hunks)test/Cuemon.AspNetCore.Authentication.Tests/Hmac/HmacAuthenticationHandlerTest.cs
(3 hunks)test/Cuemon.AspNetCore.Authentication.Te 8000 sts/Hmac/HmacAuthenticationMiddlewareTest.cs
(1 hunks)test/Cuemon.AspNetCore.Authentication.Tests/Hmac/HmacAuthorizationHeaderBuilderTest.cs
(1 hunks)test/Cuemon.AspNetCore.FunctionalTests/Diagnostics/ApplicationBuilderExtensionsTest.cs
(4 hunks)test/Cuemon.AspNetCore.Mvc.FunctionalTests/Filters/Diagnostics/FaultDescriptorFilterTest.cs
(4 hunks)test/Cuemon.AspNetCore.Mvc.Tests/Filters/Cacheable/HttpCacheableFilterTest.cs
(2 hunks)test/Cuemon.AspNetCore.Mvc.Tests/Filters/Diagnostics/FaultDescriptorFilterTest.cs
(17 hunks)test/Cuemon.AspNetCore.Mvc.Tests/Filters/Diagnostics/ServerTimingFilterTest.cs
(8 hunks)test/Cuemon.AspNetCore.Mvc.Tests/Filters/Headers/ApiKeySentinelFilterTest.cs
(6 hunks)test/Cuemon.AspNetCore.Mvc.Tests/Filters/Headers/UserAgentSentinelFilterTest.cs
(7 hunks)test/Cuemon.AspNetCore.Mvc.Tests/Filters/Throttling/ThrottlingSentinelAttributeTest.cs
(1 hunks)test/Cuemon.AspNetCore.Mvc.Tests/Filters/Throttling/ThrottlingSentinelFilterTest.cs
(2 hunks)test/Cuemon.AspNetCore.Mvc.Tests/GoneResultTest.cs
(1 hunks)test/Cuemon.AspNetCore.Razor.TagHelpers.Tests/AppImageTagHelperTest.cs
(2 hunks)test/Cuemon.AspNetCore.Razor.TagHelpers.Tests/AppLinkTagHelperTest.cs
(2 hunks)test/Cuemon.AspNetCore.Razor.TagHelpers.Tests/AppScriptTagHelperTest.cs
(2 hunks)test/Cuemon.AspNetCore.Razor.TagHelpers.Tests/CdnImageTagHelperTest.cs
(2 hunks)test/Cuemon.AspNetCore.Razor.TagHelpers.Tests/CdnLinkTagHelperTest.cs
(2 hunks)test/Cuemon.AspNetCore.Razor.TagHelpers.Tests/CdnScriptTagHelperTest.cs
(2 hunks)test/Cuemon.AspNetCore.Razor.TagHelpers.Tests/GenericRazorTest.cs
(1 hunks)test/Cuemon.AspNetCore.Tests/Diagnostics/ServerTimingMiddlewareTest.cs
(4 hunks)test/Cuemon.AspNetCore.Tests/Http/Headers/ApiKeySentinelMiddlewareTest.cs
(7 hunks)test/Cuemon.AspNetCore.Tests/Http/Headers/CacheableMiddlewareTest.cs
(5 hunks)test/Cuemon.AspNetCore.Tests/Http/Headers/UserAgentSentinelMiddlewareTest.cs
(7 hunks)test/Cuemon.AspNetCore.Tests/Http/Throttling/ThrottlingSentinelMiddlewareTest.cs
(3 hunks)test/Cuemon.Core.Tests/DisposableTest.cs
(1 hunks)test/Cuemon.Extensions.AspNetCore.Authentication.Tests/ApplicationBuilderExtensionsTest.cs
(3 hunks)test/Cuemon.Extensions.AspNetCore.Authentication.Tests/AuthenticationBuilderExtensionsTest.cs
(3 hunks)test/Cuemon.Extensions.AspNetCore.Authentication.Tests/AuthorizationResponseHandlerTest.cs
(12 hunks)test/Cuemon.Extensions.AspNetCore.Mvc.Formatters.Text.Json.Tests/Converters/JsonConverterCollectionExtensionsTest.cs
(1 hunks)test/Cuemon.Extensions.AspNetCore.Mvc.Formatters.Text.Json.Tests/JsonSerializationInputFormatterTest.cs
(1 hunks)test/Cuemon.Extensions.AspNetCore.Mvc.Formatters.Text.Json.Tests/JsonSerializationOutputFormatterTest.cs
(1 hunks)test/Cuemon.Extensions.AspNetCore.Mvc.Formatters.Xml.Tests/XmlSerializationInputFormatterTest.cs
(1 hunks)test/Cuemon.Extensions.AspNetCore.Mvc.Formatters.Xml.Tests/XmlSerializationOutputFormatterTest.cs
(1 hunks)test/Cuemon.Extensions.AspNetCore.Mvc.RazorPages.Tests/PageBaseExtensionsTest.cs
(4 hunks)test/Cuemon.Extensions.AspNetCore.Mvc.Tests/HttpDependencyTest.cs
(3 hunks)test/Cuemon.Extensions.AspNetCore.Mvc.Tests/Rendering/HtmlHelperExtensionsTest.cs
(5 hunks)test/Cuemon.Extensions.AspNetCore.Tests/Hosting/ApplicationBuilderExtensionsTest.cs
(1 hunks)test/Cuemon.Extensions.AspNetCore.Tests/Http/HttpRequestExtensionsTest.cs
(3 hunks)testenvironments.json
(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (2)
- GitHub Check: 🪟 Prepare Windows
- GitHub Check: 🐧 Prepare Linux
🔇 Additional comments (99)
test/Cuemon.AspNetCore.Authentication.Tests/Hmac/HmacAuthorizationHeaderBuilderTest.cs (1)
23-23
: LGTM: Consistent test configuration updateThe change to explicitly provide
hostFixture: null
parameter aligns with the PR objectives to standardize test setup across all test classes.test/Cuemon.Extensions.AspNetCore.Mvc.Formatters.Text.Json.Tests/JsonSerializationInputFormatterTest.cs (1)
62-62
: LGTM: Consistent parameter additionThe addition of the explicit
hostFixture: null
parameter maintains consistency with other test configurations in this PR.test/Cuemon.AspNetCore.Razor.TagHelpers.Tests/AppScriptTagHelperTest.cs (2)
40-40
: LGTM: Standardized test configurationThe explicit
hostFixture: null
parameter matches the test configuration standardization pattern in this PR.
73-73
: LGTM: Consistent test configuration updateThe explicit
hostFixture: null
parameter ensures consistency with other test method configurations.test/Cuemon.AspNetCore.Mvc.Tests/GoneResultTest.cs (1)
23-23
: LGTM: Standardized WebHostTestFactory configurationThe addition of
hostFixture: null
parameter maintains consistency with other test configurations in this PR.test/Cuemon.AspNetCore.Tests/Http/Headers/ApiKeySentinelMiddlewareTest.cs (2)
32-32
: Standardized test host configuration parameter added.The explicit
hostFixture: null
parameter adds clarity and ensures consistency with the updated WebHostTestFactory usage pattern.
58-58
: Consistent application of hostFixture parameter across test methods.All test methods in this class have been consistently updated to include the explicit
hostFixture: null
parameter, standardizing the test fixture configuration approach.Also applies to: 89-89, 115-115, 143-143, 174-174, 204-204
test/Cuemon.Extensions.AspNetCore.Authentication.Tests/AuthorizationResponseHandlerTest.cs (1)
70-70
: Standardized test host configuration across authentication test methods.All WebHostTestFactory.Create calls have been updated to explicitly include the
hostFixture: null
parameter, maintaining consistency with the project-wide pattern of explicitly declaring this parameter. This change aligns with the updated Codebelt.Extensions.Xunit packages (v9.1.2) mentioned in the PR objectives.Also applies to: 149-149, 226-226, 296-296, 388-388, 480-480, 538-538, 618-618, 731-731, 801-801, 907-907, 970-970
test/Cuemon.Extensions.AspNetCore.Mvc.Formatters.Xml.Tests/XmlSerializationInputFormatterTest.cs (1)
62-62
: Standardized test host configuration parameter added.The explicit
hostFixture: null
parameter ensures consistency with other test classes and aligns with the updated Codebelt.Extensions.Xunit packages (v9.1.2).test/Cuemon.AspNetCore.Mvc.FunctionalTests/Filters/Diagnostics/FaultDescriptorFilterTest.cs (4)
50-54
: Method signature standardized with hostFixture parameter.The
hostFixture: null
parameter has been added to theWebHostTestFactory.RunAsync
method call, which aligns with the PR objective of standardizing test host configurations across the codebase.
310-314
: Method signature standardized with hostFixture parameter.The
hostFixture: null
parameter has been added to theWebHostTestFactory.RunAsync
method call, consistent with the pattern being applied throughout the test files.
583-587
: Method signature standardized with hostFixture parameter.The
hostFixture: null
parameter has been added to theWebHostTestFactory.RunAsync
method call, maintaining consistency with other test methods in this file and across the project.
830-834
: Method signature standardized with hostFixture parameter.The
hostFixture: null
parameter has been added to theWebHostTestFactory.RunAsync
method call, completing the consistent updates to all test methods in this file.test/Cuemon.Extensions.AspNetCore.Mvc.Formatters.Text.Json.Tests/Converters/JsonConverterCollectionExtensionsTest.cs (1)
40-40
: Method signature standardized with hostFixture parameter.The
hostFixture: null
parameter has been added to theWebHostTestFactory.Create
method call, aligning with the PR objective of standardizing test host configurations.test/Cuemon.AspNetCore.Razor.TagHelpers.Tests/CdnImageTagHelperTest.cs (2)
37-40
: Method signature standardized with hostFixture parameter.The
hostFixture: null
parameter has been added to theWebHostTestFactory.Create
method call in thePage_RenderImageTagForCdnRole
test method, consistent with the standardization being applied across the test suite.
70-73
: Method signature standardized with hostFixture parameter.The
hostFixture: null
parameter has been added to theWebHostTestFactory.Create
method call in thePage_RenderImageTagForCdnRole_WithCacheBusting
test method, maintaining consistency with other test methods.test/Cuemon.AspNetCore.Razor.TagHelpers.Tests/CdnLinkTagHelperTest.cs (2)
37-40
: Method signature standardized with hostFixture parameter.The
hostFixture: null
parameter has been added to theWebHostTestFactory.Create
method call in thePage_RenderLinkTagForCdnRole
test method, following the same pattern as other test files.
70-73
: Method signature standardized with hostFixture parameter.The
hostFixture: null
parameter has been added to theWebHostTestFactory.Create
method call in thePage_RenderLinkTagForCdnRole_WithCacheBusting
test method, completing the consistent updates across this test file.test/Cuemon.AspNetCore.Razor.TagHelpers.Tests/AppImageTagHelperTest.cs (2)
40-40
: Parameter addition looks goodThe addition of
hostFixture: null
explicitly initializes this parameter, which aligns with the standardization effort across test files mentioned in the PR description.
73-73
: Parameter addition looks goodThe addition of
hostFixture: null
is consistent with the change in the first test method and completes the standardization pattern.test/Cuemon.AspNetCore.Razor.TagHelpers.Tests/AppLinkTagHelperTest.cs (2)
40-40
: Parameter addition looks goodThe addition of
hostFixture: null
matches the pattern established in other test files and ensures consistent test host configuration.
73-73
: Parameter addition looks goodThe addition of
hostFixture: null
is consistent with the first test method and other test files in this PR.test/Cuemon.AspNetCore.Tests/Http/Headers/CacheableMiddlewareTest.cs (5)
57-57
: Parameter addition looks goodThe addition of
hostFixture: null
to this WebHostTestFactory.RunAsync call aligns with the project-wide standardization of test host configuration.
93-93
: Parameter addition looks goodThe addition of
hostFixture: null
maintains consistency with other test methods in this file and across the project.
133-133
: Parameter addition looks goodThe addition of
hostFixture: null
follows the established pattern for test host configuration in this PR.
156-156
: Parameter addition looks goodThe addition of
hostFixture: null
to this WebHostTestFactory.Create call maintains consistency with other test methods.
198-198
: Parameter addition looks goodThe addition of
hostFixture: null
completes the standardization of test host configuration across all test methods in this file.test/Cuemon.Extensions.AspNetCore.Tests/Hosting/ApplicationBuilderExtensionsTest.cs (1)
38-38
: Parameter addition looks goodThe addition of
hostFixture: null
completes the pattern of explicitly initializing this parameter across all test files, ensuring consistent test host configuration.test/Cuemon.Extensions.AspNetCore.Mvc.RazorPages.Tests/PageBaseExtensionsTest.cs (1)
41-41
: Parameter standardization looks goodAll four test methods have been consistently updated to use the explicit
hostFixture: null
parameter in the WebHostTestFactory.Create calls. This aligns with the PR's objective to standardize host fixture usage across tests.Also applies to: 74-74, 106-106, 139-139
test/Cuemon.AspNetCore.Razor.TagHelpers.Tests/CdnScriptTagHelperTest.cs (1)
40-40
: Host fixture parameter addition looks correctThe explicit
hostFixture: null
parameter has been added consistently to both test methods, matching the pattern applied throughout the PR.Also applies to: 73-73
test/Cuemon.AspNetCore.Razor.TagHelpers.Tests/GenericRazorTest.cs (1)
46-46
: Host fixture parameter addition is consistentThe WebHostTestFactory.Create call has been properly updated to include the
hostFixture: null
parameter, maintaining consistency with other test files in this PR.test/Cuemon.Extensions.AspNetCore.Mvc.Formatters.Xml.Tests/XmlSerializationOutputFormatterTest.cs (1)
59-59
: Standardized parameter usage looks goodThe explicit
hostFixture: null
parameter has been added correctly to the WebHostTestFactory.Create call, consistent with all other changes in this PR.test/Cuemon.AspNetCore.FunctionalTests/Diagnostics/ApplicationBuilderExtensionsTest.cs (4)
65-69
: Parameter standardization for WebHostTestFactory.RunAsyncThe addition of
hostFixture: null
parameter aligns with the PR objective of standardizing test fixture configuration across all test methods that use WebHostTestFactory.
341-345
: Parameter standardization for WebHostTestFactory.RunAsyncThe explicit inclusion of
hostFixture: null
parameter standardizes the test configuration pattern, which is consistent with the package updates mentioned in the PR objectives.
599-603
: Parameter standardization for WebHostTestFactory.RunAsyncThe addition of
hostFixture: null
parameter maintains consistency with other test method configurations in this PR.
689-693
: Parameter standardization for WebHostTestFactory.RunAsyncThe explicit
hostFixture: null
parameter is part of the standardization effort across all test methods using WebHostTestFactory.test/Cuemon.Extensions.AspNetCore.Mvc.Tests/HttpDependencyTest.cs (3)
29-41
: Parameter standardization for WebHostTestFactory.CreateThe addition of
hostFixture: null
parameter explicitly defines the test host configuration, aligning with the package updates mentioned in the PR objectives.
85-97
: Parameter standardization for WebHostTestFactory.CreateThe explicit inclusion of
hostFixture: null
parameter is part of the standardization effort across all test methods using WebHostTestFactory.
142-154
: Parameter standardization for WebHostTestFactory.CreateThe addition of
hostFixture: null
parameter maintains consistency with other test method configurations in this PR.test/Cuemon.AspNetCore.Tests/Http/Throttling/ThrottlingSentinelMiddlewareTest.cs (3)
26-38
: Parameter standardization for WebHostTestFactory.CreateThe addition of
hostFixture: null
parameter aligns with the consistent pattern adopted throughout this PR.
66-79
: Parameter standardization for WebHostTestFactory.CreateThe explicit inclusion of
hostFixture: null
parameter standardizes the test configuration pattern across all tests.
109-126
: Parameter standardization for WebHostTestFactory.CreateThe addition of
hostFixture: null
parameter maintains consistency with other test methods and aligns with the PR's standardization goals.test/Cuemon.Extensions.AspNetCore.Mvc.Formatters.Text.Json.Tests/JsonSerializationOutputFormatterTest.cs (1)
50-59
: Parameter standardization for WebHostTestFactory.CreateThe addition of
hostFixture: null
parameter completes the standardization effort across all test methods that use WebHostTestFactory throughout the codebase, as outlined in the PR objectives.test/Cuemon.Extensions.AspNetCore.Tests/Http/HttpRequestExtensionsTest.cs (3)
40-40
: Consistent test configuration with hostFixture parameter added.This change adds the explicit
hostFixture: null
parameter to theWebHostTestFactory.RunAsync
method, which aligns with the PR objective of standardizing test configurations across the codebase.
65-65
: Standardized WebHostTestFactory configuration.Adding the explicit
hostFixture: null
parameter ensures consistent test setup methodology throughout the test suite.
119-119
: Added explicit hostFixture parameter for standardization.The addition of
hostFixture: null
brings this test implementation in line with the rest of the test suite, matching the pattern applied to other WebHostTestFactory method calls.test/Cuemon.Extensions.AspNetCore.Authentication.Tests/AuthenticationBuilderExtensionsTest.cs (3)
31-31
: Standardized test host configuration.The explicit
hostFixture: null
parameter has been added to theWebHostTestFactory.Create
call for consistent test initialization across the test suite, matching the PR's standardization effort.
58-58
: Updated test configuration with explicit hostFixture parameter.The addition of
hostFixture: null
aligns with the standardization pattern being implemented across all test classes, ensuring consistent test host initialization.
84-84
: Consistent test host configuration.The change adds the explicit
hostFixture: null
parameter to standardize test setup methodology across the codebase, which is in line with the broader pattern established in this PR.test/Cuemon.Extensions.AspNetCore.Authentication.Tests/ApplicationBuilderExtensionsTest.cs (3)
32-32
: Standardized WebHostTestFactory call with explicit hostFixture parameter.Adding the
hostFixture: null
parameter ensures consistent test host configuration across all test classes, matching the changes made in other test files in this PR.
58-58
: Updated test host configuration for standardization.The addition of
hostFixture: null
follows the consistent pattern being implemented across the test suite, ensuring uniform test behavior.
84-84
: Consistent test setup methodology with hostFixture parameter.This change maintains consistency with other test classes by explicitly specifying the
hostFixture: null
parameter, which is part of the standardization effort in this PR.test/Cuemon.AspNetCore.Tests/Diagnostics/ServerTimingMiddlewareTest.cs (4)
53-53
: Standardized test host configuration with explicit hostFixture parameter.The addition of
hostFixture: null
ensures consistency in how test hosts are configured across the test suite, aligning with the PR's objective of standardizing test setup methodology.
77-77
: Updated WebHostTestFactory call with consistent parameters.This change adds the explicit
hostFixture: null
parameter to maintain consistency with other test methods, standardizing the test configuration approach.
106-106
: Standardized test host initialization.The addition of
hostFixture: null
to theWebHostTestFactory.Create
call ensures a consistent configuration pattern across all test classes, matching the PR's standardization effort.
142-142
: Consistent test configuration with explicit hostFixture parameter.Adding the
hostFixture: null
parameter completes the standardization of test host initialization across the test suite, ensuring uniform test behavior.test/Cuemon.Extensions.AspNetCore.Mvc.Tests/Rendering/HtmlHelperExtensionsTest.cs (1)
41-41
: Adding the new 'hostFixture' parameter is consistent with package updateThe addition of
hostFixture: null
parameter across allWebHostTestFactory.Create
method calls correctly aligns with the upgraded Codebelt.Extensions.Xunit packages (v9.1.2). This parameter is now required in the updated API.Also applies to: 69-69, 100-100, 133-133, 167-167
test/Cuemon.AspNetCore.Tests/Http/Headers/UserAgentSentinelMiddlewareTest.cs (1)
35-35
: All WebHostTestFactory.Create calls consistently updated with hostFixture parameterThe addition of
hostFixture: null
parameter across all test methods properly reflects the API changes introduced in the updated Codebelt.Extensions.Xunit packages (v9.1.2). Good job maintaining consistency across all test methods.Also applies to: 65-65, 99-99, 131-131, 162-162, 193-193, 225-225
testenvironments.json (1)
12-12
:✅ Verification successful
Updated to Mono-based Docker image for test environment
The Docker image has been updated to use a Mono-based version (
mono-net8.0.407-9.0.202
). This change will likely improve cross-platform test compatibility or address specific runtime requirements.
🌐 Web query:
What are the benefits of using a Mono-based Docker image for .NET testing?
💡 Result:
Using Mono-based Docker images for .NET testing provides several key advantages, particularly when working with legacy systems or multi-targeting scenarios:
Cross-Platform Compatibility
Mono enables .NET Framework applications to run on Linux containers, allowing test environments to match cross-platform deployment targets[8][10]. This is particularly valuable for projects migrating from Windows to Linux-based infrastructure.Multi-Targeting Support
Developers can:
- Test both .NET Framework and .NET Core components in unified container environments[5][8]
- Validate compatibility with legacy NuGet packages and libraries not yet available in modern .NET[8]
- Use tools like Cake build automation that require Mono runtime[8]
Simplified CI/CD Pipelines
Mono images enable:
- Single-container test environments for mixed .NET Framework/Core projects[5]
- Reduced infrastructure complexity compared to maintaining separate Windows/Linux test runners[5][9]
- Preconfigured development containers with Mono and .NET Core SDKs[8]
Consistent Test Environments
As with all Dockerized workflows, Mono images provide:
- Isolated testing environments that prevent dependency conflicts[1][9]
- Reproducible builds across development machines and CI servers[3][9]
- Version-pinned Mono runtime configurations[10]
For teams maintaining legacy .NET Framework applications while adopting modern .NET, Mono-based Docker images offer a practical transition path without requiring full rewrites[5][8]. However, for new projects targeting .NET 8+, Microsoft's official ASP.NET images (mcr.microsoft.com/dotnet/aspnet) are generally preferred for their smaller size and security optimizations[3][6].
Citations:
- 1: https://www.docker.com/blog/9-tips-for-containerizing-your-net-application/
- 2: https://gitlab.com/pommalabs/docker/dotnet-mono
- 3: https://learn.microsoft.com/en-us/dotnet/architecture/microservices/net-core-net-framework-containers/official-net-docker-images
- 4: https://www.einfochips.com/blog/docker-decisions-choosing-between-net-and-net-framework-for-docker-containers/
- 5: Multi-Targeting .NET Framework & .NET Core mono/docker#63
- 6: https://semaphoreci.com/blog/reduce-docker-image-size
- 7: https://www.ifourtechnolab.com.au/blog/reasons-to-use-docker-for-dot-net-core-development
- 8: https://github.com/andrewlock/docker-dotnet-mono
- 9: https://blog.nashtechglobal.com/containerize-specflow-selenium-c-with-docker/
- 10: https://snyk.io/advisor/docker/mono
Docker image update verified—Mono-based image offers enhanced test environment benefits
The Docker image in
testenvironments.json
at lines 12 has been updated to use a Mono-based image (gimlichael/ubuntu-testrunner:mono-net8.0.407-9.0.202
). This update not only addresses specific runtime needs but also offers several advantages:
- Cross-Platform Compatibility: Leverages Mono to run .NET Framework applications on Linux containers, which is ideal if you're transitioning legacy systems from Windows to Linux.
- Multi-Targeting Support: Facilitates testing for both .NET Framework and .NET Core components within a unified container, ensuring compatibility with legacy NuGet packages and libraries.
- Simplified CI/CD Pipelines: Consolidates test environments, reduces infrastructure complexity, and maintains reproducible builds across development and CI environments.
These enhancements should improve overall test reliability, especially in mixed framework or legacy scenarios.
test/Cuemon.AspNetCore.Authentication.Tests/Hmac/HmacAuthenticationMiddlewareTest.cs (1)
53-53
: Added hostFixture parameter for WebHostTestFactory.CreateThe addition of the
hostFixture: null
parameter aligns with the updated Codebelt.Extensions.Xunit packages (v9.1.2) API requirements and maintains consistency with the pattern used across other test files in this PR.test/Cuemon.AspNetCore.Authentication.Tests/Digest/DigestAccessAuthenticationMiddlewareTest.cs (1)
55-55
: ThehostFixture: null
parameter addition looks goodThe addition of the
hostFixture: null
parameter to all WebHostTestFactory.Create calls correctly aligns with the package updates in this PR. This standardizes the test configuration across the codebase and ensures compatibility with the updated Codebelt.Extensions.Xunit packages.Also applies to: 104-104, 181-181, 256-256
test/Cuemon.AspNetCore.Mvc.Tests/Filters/Throttling/ThrottlingSentinelAttributeTest.cs (1)
103-103
: ThehostFixture: null
parameter addition looks goodThe addition of the
hostFixture: null
parameter to the WebHostTestFactory.Create call properly aligns with the package updates in this PR. This change maintains consistency with similar modifications across the test codebase.test/Cuemon.AspNetCore.Mvc.Tests/Filters/Headers/UserAgentSentinelFilterTest.cs (1)
44-44
: ThehostFixture: null
parameter additions look goodAll WebHostTestFactory.Create calls in this test class have been consistently updated to include the
hostFixture: null
parameter. This standardization matches the package updates in this PR and maintains consistency across the test codebase.Also applies to: 81-81, 110-110, 143-143, 180-180, 208-208, 235-235
Directory.Packages.props (1)
8-10
: Package version updates look goodThe update of the Codebelt.Extensions.Xunit packages from 9.0.1 to 9.1.2 is appropriate and aligns with the PR objectives. This version bump seems to necessitate the addition of the
hostFixture: null
parameter in test files, which has been consistently applied across the codebase.test/Cuemon.AspNetCore.Mvc.Tests/Filters/Headers/ApiKeySentinelFilterTest.cs (1)
41-41
: LGTM: Consistently added explicit hostFixture parameter across test methods.The explicit
hostFixture: null
parameter has been added to all WebHostTestFactory.Create calls in this file, which aligns with the PR objective of standardizing test setup across multiple test classes after updating the Codebelt.Extensions.Xunit packages to version 9.1.2.Also applies to: 71-71, 104-104, 138-138, 170-170, 197-197
test/Cuemon.AspNetCore.Authentication.Tests/Hmac/HmacAuthenticationHandlerTest.cs (1)
63-63
: LGTM: Consistently added explicit hostFixture parameter across test methods.The explicit
hostFixture: null
parameter has been added to all WebHostTestFactory.Create calls in this file, which aligns with the PR objective of standardizing test setup across multiple test classes after updating the Codebelt.Extensions.Xunit packages to version 9.1.2.Also applies to: 129-129, 186-186
test/Cuemon.AspNetCore.Mvc.Tests/Filters/Throttling/ThrottlingSentinelFilterTest.cs (1)
51-51
: LGTM: Consistently added explicit hostFixture parameter across test methods.The explicit
hostFixture: null
parameter has been added to all WebHostTestFactory.Create calls in this file, which aligns with the PR objective of standardizing test setup across multiple test classes after updating the Codebelt.Extensions.Xunit packages to version 9.1.2.Also applies to: 102-102
test/Cuemon.AspNetCore.Mvc.Tests/Filters/Diagnostics/ServerTimingFilterTest.cs (2)
54-54
: LGTM: Consistently added explicit hostFixture parameter across test methods.The explicit
hostFixture: null
parameter has been added to most WebHostTestFactory.Create calls in this file, which aligns with the PR objective of standardizing test setup across multiple test classes after updating the Codebelt.Extensions.Xunit packages to version 9.1.2.Also applies to: 81-81, 105-105, 130-130, 151-151, 176-176, 210-210, 268-268
237-240
:✅ Verification successful
Verify if this test method requires the hostFixture parameter.
This test uses a different pattern with
host => { ... }
configuration instead of thehostFixture: null
parameter that was added to other test methods. Confirm that this test will continue to work with the updated package version.
🏁 Script executed:
#!/bin/bash # Description: Check WebHostTestFactory interfaces to see if the method with host action parameter is still supported # Search for the WebHostTestFactory class definition echo "Searching for WebHostTestFactory class definition..." ast-grep --pattern $'class WebHostTestFactory { $$$ }' # Look for Create methods in WebHostTestFactory echo "Searching for Create methods in WebHostTestFactory..." ast-grep --pattern $'static $$ Create($$) { $$$ }' # Check for usage patterns in other test files echo "Checking usage patterns in other test files..." rg "WebHostTestFactory.Create" -A 3 -B 1 --type cs | grep -v "hostFixture: null" | grep -B 3 -A 3 "host =>"Length of output: 554
I'll run an additional verification step to search for any occurrences of the
hostFixture:
parameter usage in our test files. This will help us determine if there's a consistent pattern elsewhere (i.e. usage ofhostFixture: null
) that we might need to align with, or if the lambda configuration pattern is now the norm.Once we have the results from this script, we can better decide whether any action is necessary or if this test's usage of the lambda (
host => { ... }
) is correct given the current package version.
🏁 Script executed:
#!/bin/bash echo "Searching for 'hostFixture:' usage in test files for consistency checking..." rg "hostFixture:" -A 2 -B 2 --type csLength of output: 80004
Lambda-based configuration is valid – no hostFixture parameter required
After reviewing the codebase, it’s clear that while many tests use the
hostFixture: null
pattern, the test method in question intentionally uses a lambda (host => { host.ConfigureWebHost(builder => builder.UseEnvironment("Production")); }
) for configuration. There’s no indication that this approach is incompatible with the updated package version, and similar tests continue to operate correctly using their respective patterns.test/Cuemon.AspNetCore.Authentication.Tests/Digest/DigestAccessAuthenticationHandlerTest.cs (5)
62-62
: LGTM: Added hostFixture parameter to WebHostTestFactory.CreateThe addition of the
hostFixture: null
parameter aligns with the PR objectives to modify test files by incorporating this parameter for proper test setup.
138-138
: LGTM: Added hostFixture parameter to WebHostTestFactory.CreateThis change is consistent with the standardization of test setup across test classes as outlined in the PR objectives.
217-217
: LGTM: Added hostFixture parameter to WebHostTestFactory.CreateThe addition of the
hostFixture: null
parameter consistently applies the required changes for proper test configuration.
292-292
: LGTM: Added hostFixture parameter to WebHostTestFactory.CreateThis change follows the pattern of updates being made throughout the test suite to standardize test setup.
334-334
: LGTM: Added hostFixture parameter to WebHostTestFactory.CreateThis completes the standardization of the
WebHostTestFactory.Create
method calls in this test class with thehostFixture
parameter.test/Cuemon.AspNetCore.Mvc.Tests/Filters/Diagnostics/FaultDescriptorFilterTest.cs (17)
44-44
: LGTM: Added hostFixture parameter to WebHostTestFactory.CreateWithHostBuilderContextThe addition of
hostFixture: null
parameter to the method call aligns with the PR's objective to standardize test host configurations.
112-112
: LGTM: Added hostFixture parameter to WebHostTestFactory.CreateWithHostBuilderContextConsistent with other changes in this PR, adding the
hostFixture: null
parameter ensures proper test setup.
155-155
: LGTM: Added hostFixture parameter to WebHostTestFactory.CreateWithHostBuilderContextThis modification correctly implements the standardized test configuration pattern being applied across the codebase.
188-188
: LGTM: Added hostFixture parameter to WebHostTestFactory.CreateWithHostBuilderContextThis change maintains consistency with the standardized test setup approach being implemented.
221-221
: LGTM: Added hostFixture parameter to WebHostTestFactory.CreateWithHostBuilderContextThe addition of the
hostFixture: null
parameter continues the consistent pattern of updates.
254-254
: LGTM: Added hostFixture parameter to WebHostTestFactory.CreateWithHostBuilderContextThis change aligns with the standardization of test setup across the test suite.
287-287
: LGTM: Added hostFixture parameter to WebHostTestFactory.CreateWithHostBuilderContextConsistent implementation of the
hostFixture: null
parameter maintains uniformity in test configuration.
320-320
: LGTM: Added hostFixture parameter to WebHostTestFactory.CreateWithHostBuilderContextThis change follows the pattern of updates being made throughout the test suite.
353-353
: LGTM: Added hostFixture parameter to WebHostTestFactory.CreateWithHostBuilderContextThe addition of the
hostFixture: null
parameter is consistent with the PR objectives.
386-386
: LGTM: Added hostFixture parameter to WebHostTestFactory.CreateWithHostBuilderContextThis modification maintains consistency in how test hosts are configured.
419-419
: LGTM: Added hostFixture parameter to WebHostTestFactory.CreateWithHostBuilderContextThe addition of the
hostFixture: null
parameter follows the consistent pattern throughout the PR.
452-452
: LGTM: Added hostFixture parameter to WebHostTestFactory.CreateWithHostBuilderContextThis change maintains the standardized approach to test host configuration being implemented.
485-485
: LGTM: Added hostFixture parameter to WebHostTestFactory.CreateWithHostBuilderContextThe addition of the
hostFixture: null
parameter is consistent with the PR objectives.
518-518
: LGTM: Added hostFixture parameter to WebHostTestFactory.CreateWithHostBuilderContextThis change follows the pattern established throughout the PR for standardizing test configurations.
551-551
: LGTM: Added hostFixture parameter to WebHostTestFactory.CreateWithHostBuilderContextThe addition of the
hostFixture: null
parameter maintains consistency across test files.
584-584
: LGTM: Added hostFixture parameter to WebHostTestFactory.CreateWithHostBuilderContextConsistent application of the
hostFixture: null
parameter aligns with the PR objectives.
614-614
: LGTM: Added hostFixture parameter to WebHostTestFactory.CreateWithHostBuilderContextThis completes the standardization of test host configuration in this file, consistent with the PR's focus.
test/Cuemon.AspNetCore.Authentication.Tests/Basic/BasicAuthenticationHandlerTest.cs (3)
57-58
: LGTM: Added hostFixture parameter to WebHostTestFactory.CreateThe addition of the
hostFixture: null
parameter aligns with the PR objectives to standardize test configurations. Note that this change spans two lines, with the parameter on its own line for better readability.
96-96
: LGTM: Added hostFixture parameter to WebHostTestFactory.CreateThis change maintains consistency with the standardized test setup approach being implemented across test files.
144-144
: LGTM: Added hostFixture parameter to WebHostTestFactory.CreateThe addition of the
hostFixture: null
parameter completes the standardization for this test class, aligning with the PR objectives.test/Cuemon.AspNetCore.Mvc.Tests/Filters/Cacheable/HttpCacheableFilterTest.cs (2)
38-38
: LGTM: Added hostFixture parameter to WebHostTestFactory.CreateThe addition of the
hostFixture: null
parameter aligns with the PR objectives to standardize test configurations across the test suite.
67-67
: LGTM: Added hostFixture parameter to WebHostTestFactory.CreateThis change is consistent with other modifications in the PR, ensuring standardized test host setup across all test files.
test/Cuemon.AspNetCore.Authentication.Tests/Basic/BasicAuthenticationMiddlewareTest.cs (3)
29-40
: Explicitly SettinghostFixture: null
for Consistent Test Initialization
The update to includehostFixture: null
in theWebHostTestFactory.Create
call within the first test method clearly standardizes the test environment setup according to the updated testing requirements. This explicit parameter improves clarity and ensures that the fixture behavior is unambiguous across the test suite.
77-82
: StandardizinghostFixture
in Fault Handling Test
AddinghostFixture: null
in the second test method further enforces a uniform test configuration. This change, applied alongside the configuration of exception handlers, assures that all parts of the test harness are provided with an explicit (even if null) host fixture, thereby reducing potential ambiguity in test setups.
125-134
: UniformhostFixture
Usage in Authentication Flow Test
In the third test method, the inclusion ofhostFixture: null
maintains consistency with the other test methods. This explicit parameter declaration helps ensure that downstream components dealing with authentication operate with a clearly defined test context, aiding in maintaining reliable and predictable test outcomes.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #114 +/- ##
=======================================
Coverage 80.12% 80.12%
=======================================
Files 593 593
Lines 18312 18312
Branches 1883 1883
=======================================
Hits 14672 14672
Misses 3572 3572
Partials 68 68 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
This pull request includes several updates to package versions and modifications to test files to include the
hostFixture
parameter. The most important changes include updating theCodebelt.Extensions.Xunit
package versions and adding thehostFixture
parameter to various test methods.Package Version Updates:
Directory.Packages.props
: UpdatedCodebelt.Extensions.Xunit
,Codebelt.Extensions.Xunit.Hosting
, andCodebelt.Extensions.Xunit.Hosting.AspNetCore
package versions from9.0.1
to9.1.2
.Test Method Modifications:
BasicAuthenticationHandlerTest.cs
: AddedhostFixture: null
parameter to various test methods to ensure proper test setup. [1] [2] [3]DigestAccessAuthenticationHandlerTest.cs
: AddedhostFixture: null
parameter to various test methods to ensure proper test setup. [1] [2] [3] [4] [5]HmacAuthenticationHandlerTest.cs
: AddedhostFixture: null
parameter to various test methods to ensure proper test setup. [1] [2] [3]ApplicationBuilderExtensionsTest.cs
: AddedhostFixture: null
parameter to various test methods to ensure proper test setup. [1] [2] [3] [4]FaultDescriptorFilterTest.cs
: AddedhostFixture: null
parameter to various test methods to ensure proper test setup. [1] [2] [3]Summary by CodeRabbit
Chores
dockerImage
property in the test environments for improved compatibility.Tests
hostFixture: null
parameter for improved clarity in test configurations.These maintenance updates improve the project’s internal robustness and testing reliability without altering any user-facing functionality.