Migrate test infrastructure from WebHostBuilder to#9468
Open
michaelstaib wants to merge 7 commits intomainfrom
Open
Migrate test infrastructure from WebHostBuilder to#9468michaelstaib wants to merge 7 commits intomainfrom
michaelstaib wants to merge 7 commits intomainfrom
Conversation
WebApplication.CreateBuilder()
Contributor
There was a problem hiding this comment.
Pull request overview
This PR migrates the test hosting infrastructure from WebHostBuilder/IWebHost patterns to WebApplication (minimal hosting) across multiple test projects, and updates several HTTP streaming tests/snapshots to use GraphQLHttpResponse.
Changes:
- Replace
WebHostBuilder/TestServersetup withWebApplication.CreateSlimBuilder()+UseTestServer()/UseUrls()in multiple test helpers/sessions. - Update StrawberryShake integration tests to dispose the new
WebApplicationhosts (await using) and adjust client helper signatures. - Update GraphQL-over-HTTP/defer streaming tests to wrap responses with
GraphQLHttpResponseand enhance snapshot formatting for jsonl/SSE streaming payloads.
Reviewed changes
Copilot reviewed 37 out of 37 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/Integration/UploadScalarTest.cs | Switch server lifetime handling to WebApplication and async disposal. |
| src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/Integration/UnsignedTypesTest.cs | Use async disposal for server created via updated helper. |
| src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/Integration/StarWarsUnionListTest.cs | Use async disposal for server created via updated helper. |
| src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/Integration/StarWarsTypeNameOnUnionsTest.cs | Use async disposal for server created via updated helper. |
| src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/Integration/StarWarsTypeNameOnInterfacesTest.cs | Use async disposal for server created via updated helper. |
| src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/Integration/StarWarsOnReviewSubNoStoreTest.cs | Use async disposal for server created via updated helper. |
| src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/Integration/StarWarsOnReviewSubGraphQLSSETest.cs | Use async disposal for server created via updated helper. |
| src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/Integration/StarWarsOnReviewSubCompletionTest.cs | Use async disposal for server created via updated helper. |
| src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/Integration/StarWarsIntrospectionTest.cs | Use async disposal for server created via updated helper. |
| src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/Integration/StarWarsGetHeroWithFragmentIncludeAndSkipDirectiveTest.cs | Use async disposal for server created via updated helper. |
| src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/Integration/StarWarsGetHeroTraitsTest.cs | Use async disposal for server created via updated helper. |
| src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/Integration/StarWarsGetHeroTest.cs | Use async disposal for server created via updated helper. |
| src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/Integration/StarWarsGetFriendsTest.cs | Use async disposal for server created via updated helper. |
| src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/Integration/StarWarsGetFriendsNoStoreTest.cs | Use async disposal for server created via updated helper. |
| src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/Integration/StarWarsGetFriendsDeferredTest.cs | Update commented template snippet to new server creation style. |
| src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/Integration/StarWarsGetFriendsDeferInListTest.cs | Update commented template snippet to new server creation style. |
| src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/Integration/LocalTypesTest.cs | Use async disposal for server created via updated helper. |
| src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/Integration/AnyScalarDefaultSerializationTest.cs | Use async disposal for server created via updated helper. |
| src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/resources/TestTemplate.txt | Update generated test template to new hosting pattern. |
| src/StrawberryShake/Client/test/Transport.WebSocket.Tests/TestHelper/TestServerHelper.cs | Re-implement server creation using WebApplication + Kestrel/URLs. |
| src/StrawberryShake/Client/test/Transport.WebSocket.Tests/IntegrationTests.cs | Dispose updated WebApplication server via await using. |
| src/HotChocolate/Fusion/test/Fusion.Execution.Tests/TestServerSession.cs | Replace WebHostBuilder/TestServer lifecycle with WebApplication-based lifecycle. |
| src/HotChocolate/Fusion/test/Fusion.Diagnostics.Tests/ActivityTestHelper.cs | Improve activity parent correlation using span-id lookup. |
| src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/TestServerSession.cs | Replace WebHostBuilder/TestServer lifecycle with WebApplication-based lifecycle. |
| src/HotChocolate/Diagnostics/test/Diagnostics.Tests/ActivityTestHelper.cs | Improve activity parent correlation using span-id lookup. |
| src/HotChocolate/Data/test/Data.Sorting.InMemory.Tests/QueryableSortVisitorVariablesTests.cs | Switch to WebApplication+UseTestServer() for in-memory sorting test server. |
| src/HotChocolate/Caching/test/Caching.Tests/TestServerFactory.cs | Switch test server factory to WebApplication instances and GetTestServer(). |
| src/HotChocolate/AspNetCore/test/AspNetCore.Tests/GraphQLOverHttpSpecTests.cs | Use GraphQLHttpResponse to read SSE result streams; adjust timeouts/assertions. |
| src/HotChocolate/AspNetCore/test/AspNetCore.Tests/DeferOverHttpTests.cs | Wrap streaming responses in GraphQLHttpResponse and snapshot the patched result. |
| src/HotChocolate/AspNetCore/test/AspNetCore.Tests.Utilities/TestServerFactory.cs | Switch shared test server factory to WebApplication instances and GetTestServer(). |
| src/HotChocolate/AspNetCore/test/AspNetCore.Tests.Utilities/Subscriptions/GraphQLOverWebSocket/SubscriptionTestBase.cs | Increase retry/timeout window for flaky subscription tests. |
| src/HotChocolate/AspNetCore/test/AspNetCore.Authorization.Tests/AuthorizationPolicyProviderTests.cs | Implement fallback policy method to return null instead of throwing. |
| src/HotChocolate/Adapters/test/Adapters.OpenApi.Tests/TestServerSession.cs | Replace WebHostBuilder/TestServer lifecycle with WebApplication-based lifecycle. |
| src/HotChocolate/Adapters/test/Adapters.Mcp.Tests/FusionIntegrationTests.cs | Switch gateway/subgraph test servers to WebApplication + UseTestServer(). |
| src/HotChocolate/Adapters/test/Adapters.Mcp.Tests/CoreIntegrationTests.cs | Switch MCP test servers to WebApplication + UseTestServer(). |
| src/CookieCrumble/src/CookieCrumble.HotChocolate/Formatters/GraphQLHttpResponseFormatter.cs | Add formatting support for SSE/jsonl result streams by patching incremental payloads. |
| src/CookieCrumble/src/CookieCrumble.HotChocolate/Formatters/ExecutionResultSnapshotValueFormatter.cs | Add legacy incremental patch handling when path is present without id. |
Comments suppressed due to low confidence (1)
src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/Integration/UploadScalarTest.cs:219
CreateClienttakes aWebApplication hostparameter but never uses it. Since callers already keephostalive in the test scope, consider removing this parameter (and updating call sites) to avoid confusion and keep the helper focused on what it actually needs (the port/base address).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
...rawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__resources__/TestTemplate.txt
Show resolved
Hide resolved
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.