Skip to content

Migrates Foundry live tests to Recorded tests.#1692

Merged
scbedd merged 15 commits intomicrosoft:mainfrom
g2vinay:test/record-foundry-tests
Feb 17, 2026
Merged

Migrates Foundry live tests to Recorded tests.#1692
scbedd merged 15 commits intomicrosoft:mainfrom
g2vinay:test/record-foundry-tests

Conversation

@g2vinay
Copy link
Contributor

@g2vinay g2vinay commented Feb 10, 2026

Migrates Foundry live tests to Recorded tests.

Copy link
Contributor

Copilot AI left a 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 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:

  1. Remove lines 1558-1559 (keep only the conditional add), or
  2. 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);
                    }
                }

@scbedd
Copy link
Contributor

scbedd commented Feb 14, 2026

/azp run mcp - pullrequest - live

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@scbedd
Copy link
Contributor

scbedd commented Feb 14, 2026

/azp run mcp - pullrequest - live

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@scbedd
Copy link
Contributor

scbedd commented Feb 17, 2026

Livetests run succeeded before merge conflict.

Conflict is likely just reference updates due to the Azure.Mcp.Core reworks. Going to resolve.

EDIT after conflict resolution: confirm that it was just a class signature update. Nothing huge.

@scbedd scbedd merged commit 13c4098 into microsoft:main Feb 17, 2026
15 checks passed
@github-project-automation github-project-automation bot moved this from Untriaged to Done in Azure MCP Server Feb 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tools-Foundry Azure AI Foundry

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants

Comments