-
Notifications
You must be signed in to change notification settings - Fork 285
Fix missing MCP test #2925
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
base: main
Are you sure you want to change the base?
Fix missing MCP test #2925
Conversation
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.
Pull Request Overview
This PR fixes a failing test for MCP (Model Context Protocol) endpoint support. The test was extended to cover MCP endpoints alongside existing REST and GraphQL endpoint tests, but failed due to the MCP server not being ready in time.
Key changes:
- Extended test parameters to include MCP endpoint testing alongside REST and GraphQL
- Added a 2-second delay before MCP endpoint testing to allow server initialization
- Created a helper method
GetMcpResponsePostConfigHydrationwith retry logic similar to existing GraphQL helper
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| [DataRow(true, true, true, HttpStatusCode.OK, HttpStatusCode.OK, HttpStatusCode.OK, CONFIGURATION_ENDPOINT, DisplayName = "V1 - Rest, GraphQL, and MCP enabled globally")] | ||
| [DataRow(true, true, false, HttpStatusCode.OK, HttpStatusCode.OK, HttpStatusCode.NotFound, CONFIGURATION_ENDPOINT, DisplayName = "V1 - Rest and GraphQL enabled, MCP disabled globally")] | ||
| [DataRow(true, false, true, HttpStatusCode.OK, HttpStatusCode.NotFound, HttpStatusCode.OK, CONFIGURATION_ENDPOINT, DisplayName = "V1 - Rest enabled, GraphQL disabled, and MCP enabled globally")] | ||
| [DataRow(true, false, false, HttpStatusCode.OK, HttpStatusCode.NotFound, HttpStatusCode.NotFound, CONFIGURATION_ENDPOINT, DisplayName = "V1 - Rest enabled, GraphQL and MCP enabled globally")] |
Copilot
AI
Oct 27, 2025
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.
The display name incorrectly states 'GraphQL and MCP enabled globally' when the test parameters show both are disabled (false, false). Should be 'GraphQL and MCP disabled globally'.
| [DataRow(true, false, false, HttpStatusCode.OK, HttpStatusCode.NotFound, HttpStatusCode.NotFound, CONFIGURATION_ENDPOINT, DisplayName = "V1 - Rest enabled, GraphQL and MCP enabled globally")] | |
| [DataRow(true, false, false, HttpStatusCode.OK, HttpStatusCode.NotFound, HttpStatusCode.NotFound, CONFIGURATION_ENDPOINT, DisplayName = "V1 - Rest enabled, GraphQL and MCP disabled globally")] |
| [DataRow(true, true, true, HttpStatusCode.OK, HttpStatusCode.OK, HttpStatusCode.OK, CONFIGURATION_ENDPOINT_V2, DisplayName = "V2 - Rest, GraphQL, and MCP enabled globally")] | ||
| [DataRow(true, true, false, HttpStatusCode.OK, HttpStatusCode.OK, HttpStatusCode.NotFound, CONFIGURATION_ENDPOINT_V2, DisplayName = "V2 - Rest and GraphQL enabled, MCP disabled globally")] | ||
| [DataRow(true, false, true, HttpStatusCode.OK, HttpStatusCode.NotFound, HttpStatusCode.OK, CONFIGURATION_ENDPOINT_V2, DisplayName = "V2 - Rest enabled, GraphQL disabled, and MCP enabled globally")] | ||
| [DataRow(true, false, false, HttpStatusCode.OK, HttpStatusCode.NotFound, HttpStatusCode.NotFound, CONFIGURATION_ENDPOINT_V2, DisplayName = "V2 - Rest enabled, GraphQL and MCP enabled globally")] |
Copilot
AI
Oct 27, 2025
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.
The display name incorrectly states 'GraphQL and MCP enabled globally' when the test parameters show both are disabled (false, false). Should be 'GraphQL and MCP disabled globally'.
| [DataRow(true, false, false, HttpStatusCode.OK, HttpStatusCode.NotFound, HttpStatusCode.NotFound, CONFIGURATION_ENDPOINT_V2, DisplayName = "V2 - Rest enabled, GraphQL and MCP enabled globally")] | |
| [DataRow(true, false, false, HttpStatusCode.OK, HttpStatusCode.NotFound, HttpStatusCode.NotFound, CONFIGURATION_ENDPOINT_V2, DisplayName = "V2 - Rest enabled, GraphQL and MCP disabled globally")] |
| await Task.Delay(2000); | ||
| object mcpPayload = new | ||
| { | ||
| jsonrpc = "2.0", | ||
| id = 1, | ||
| method = "tools/call" | ||
| }; | ||
| HttpRequestMessage mcpRequest = new(HttpMethod.Post, "/mcp") | ||
| { | ||
| Content = JsonContent.Create(mcpPayload) | ||
| }; | ||
| HttpResponseMessage mcpResponse = await client.SendAsync(mcpRequest); |
Copilot
AI
Oct 27, 2025
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.
The hardcoded 2000ms delay introduces brittleness and slows down test execution. Consider using the existing retry pattern (like GetMcpResponsePostConfigHydration) or defining this delay as a named constant with documentation explaining why it's necessary.
| await Task.Delay(2000); | |
| object mcpPayload = new | |
| { | |
| jsonrpc = "2.0", | |
| id = 1, | |
| method = "tools/call" | |
| }; | |
| HttpRequestMessage mcpRequest = new(HttpMethod.Post, "/mcp") | |
| { | |
| Content = JsonContent.Create(mcpPayload) | |
| }; | |
| HttpResponseMessage mcpResponse = await client.SendAsync(mcpRequest); | |
| object mcpPayload = new | |
| { | |
| jsonrpc = "2.0", | |
| id = 1, | |
| method = "tools/call" | |
| }; | |
| HttpResponseMessage mcpResponse = await GetMcpResponsePostConfigHydration(client, mcpPayload); |
| await Task.Delay(2000); | ||
| object mcpPayload = new | ||
| { | ||
| jsonrpc = "2.0", | ||
| id = 1, | ||
| method = "tools/call" | ||
| }; | ||
| HttpRequestMessage mcpRequest = new(HttpMethod.Post, "/mcp") | ||
| { | ||
| Content = JsonContent.Create(mcpPayload) | ||
| }; | ||
| HttpResponseMessage mcpResponse = await client.SendAsync(mcpRequest); | ||
| Assert.AreEqual(expectedStatusCodeForMcp, mcpResponse.StatusCode); |
Copilot
AI
Oct 27, 2025
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.
This MCP request logic duplicates the payload and request construction found in GetMcpResponsePostConfigHydration. Consider extracting this into a shared helper method to reduce duplication and ensure consistency.
|
/azp run |
|
Azure Pipelines successfully started running 6 pipeline(s). |
|
/azp run |
|
Azure Pipelines successfully started running 6 pipeline(s). |
|
/azp run |
|
Azure Pipelines successfully started running 6 pipeline(s). |
|
/azp run |
|
Azure Pipelines successfully started running 6 pipeline(s). |
|
/azp run |
|
Azure Pipelines successfully started running 6 pipeline(s). |
|
/azp run |
|
Azure Pipelines successfully started running 6 pipeline(s). |
|
/azp run |
|
Azure Pipelines successfully started running 6 pipeline(s). |
| Content = JsonContent.Create(mcpPayload) | ||
| }; | ||
| mcpRequest.Headers.Add("Accept", "*/*"); | ||
| HttpResponseMessage mcpResponse = await client.SendAsync(mcpRequest); |
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 cant we use the same GetMcpResponsePostConfigHydration method here to account for the retry logic?
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.
Looking for retry logic
Why make this change?
There was a test that needed to be fixed in order to comply with the creation of the new MCP endpoint. The test already existed and covered the scenarios for REST and GraphQL endpoints. The reason this test needed to be fixed separately is that it was failing when it was changed to comply with the MCP endpoint.
What is this change?
This change fixes the test that was failing, the reason it was failing is that the MCP server was not able to start in time before the test tried to access the MCP endpoint. In order to fix it we added a delay so the server is available before the test tries to access the endpoint.
How was this tested?