Migrates Foundry live tests to Recorded tests.#1692
Migrates Foundry live tests to Recorded tests.#1692g2vinay wants to merge 9 commits intomicrosoft:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR migrates the Foundry live tests to use the recorded test framework, enabling tests to run in playback mode without requiring live Azure resources. This follows the recorded test documentation and aligns with the repository's testing patterns.
Changes:
- Converted FoundryCommandTests from CommandTestsBase to RecordedCommandTestsBase to enable test recording/playback
- Integrated IHttpClientFactory in FoundryService to create HTTP clients with test proxy transport support
- Added assets.json configuration for test recording asset management
- Replaced direct SDK helper methods (CreateAgent, CreateThread) with CallToolAsync to ensure proper test proxy recording
- Added URI and body regex sanitizers to anonymize sensitive data in recordings
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 12 comments.
| File | Description |
|---|---|
| tools/Azure.Mcp.Tools.Foundry/tests/Azure.Mcp.Tools.Foundry.LiveTests/assets.json | New assets.json file for test recording configuration with Azure SDK assets repository |
| tools/Azure.Mcp.Tools.Foundry/tests/Azure.Mcp.Tools.Foundry.LiveTests/FoundryCommandTests.cs | Migrated test class to RecordedCommandTestsBase, added sanitizers, registered test variables, and replaced helper methods with CallToolAsync |
| tools/Azure.Mcp.Tools.Foundry/src/Services/FoundryService.cs | Integrated IHttpClientFactory to support test proxy recording, refactored client creation methods to use HttpClientTransport |
Comments suppressed due to low confidence (1)
tools/Azure.Mcp.Tools.Foundry/src/Services/FoundryService.cs:1565
- Duplicate code detected: resources are being added twice in the resource group scope branch. Lines 1558-1559 add the resource, then lines 1560-1564 check the resource group match and add it again. This will result in duplicate entries in the resources list.
The correct implementation should either:
- Remove lines 1558-1559 (keep only the conditional add), or
- Remove the conditional block at lines 1560-1564 (keep only the unconditional add at 1558-1559)
Since the code is already scoped to a specific resource group by calling GetCognitiveServicesAccounts on the resourceGroupResource, the conditional check is redundant and lines 1560-1564 should be removed.
await foreach (var account in resourceGroupResource.Value.GetCognitiveServicesAccounts().GetAllAsync(cancellationToken: cancellationToken))
{
var resourceInfo = await BuildResourceInformation(account, subscriptionResource.Data.DisplayName);
resources.Add(resourceInfo);
if (account.Data.Id.ResourceGroupName?.Equals(resourceGroup, StringComparison.OrdinalIgnoreCase) == true)
{
var resourceInfo = await BuildResourceInformation(account, subscriptionResource.Data.DisplayName, cancellationToken);
resources.Add(resourceInfo);
}
}
tools/Azure.Mcp.Tools.Foundry/tests/Azure.Mcp.Tools.Foundry.LiveTests/FoundryCommandTests.cs
Outdated
Show resolved
Hide resolved
tools/Azure.Mcp.Tools.Foundry/tests/Azure.Mcp.Tools.Foundry.LiveTests/FoundryCommandTests.cs
Outdated
Show resolved
Hide resolved
tools/Azure.Mcp.Tools.Foundry/tests/Azure.Mcp.Tools.Foundry.LiveTests/FoundryCommandTests.cs
Outdated
Show resolved
Hide resolved
tools/Azure.Mcp.Tools.Foundry/tests/Azure.Mcp.Tools.Foundry.LiveTests/FoundryCommandTests.cs
Outdated
Show resolved
Hide resolved
tools/Azure.Mcp.Tools.Foundry/tests/Azure.Mcp.Tools.Foundry.LiveTests/FoundryCommandTests.cs
Outdated
Show resolved
Hide resolved
tools/Azure.Mcp.Tools.Foundry/tests/Azure.Mcp.Tools.Foundry.LiveTests/FoundryCommandTests.cs
Outdated
Show resolved
Hide resolved
tools/Azure.Mcp.Tools.Foundry/tests/Azure.Mcp.Tools.Foundry.LiveTests/FoundryCommandTests.cs
Outdated
Show resolved
Hide resolved
tools/Azure.Mcp.Tools.Foundry/tests/Azure.Mcp.Tools.Foundry.LiveTests/FoundryCommandTests.cs
Show resolved
Hide resolved
tools/Azure.Mcp.Tools.Foundry/tests/Azure.Mcp.Tools.Foundry.LiveTests/FoundryCommandTests.cs
Show resolved
Hide resolved
|
/azp run mcp - pullrequest - live |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run mcp - pullrequest - live |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Migrates Foundry live tests to Recorded tests.