// Copyright (c) Microsoft. All rights reserved. using System.Collections.Generic; using AgentConformance.IntegrationTests.Support; using Shared.IntegrationTests; namespace Foundry.Hosting.IntegrationTests.Fixtures; /// /// Provisions a hosted agent that runs the test container in IT_SCENARIO=azure-search-rag mode. /// Wires the container up with an Azure AI Search backed /// adapter that retrieves Contoso Outdoors documents from a pre-provisioned search index before each /// model invocation. /// /// /// Prerequisites managed out of band: /// /// The it-azure-search-rag agent's managed identity must hold /// Search Index Data Reader on the search service scope. Granted manually after /// the first scripts/it-bootstrap-agents.ps1 run; see the IT README. /// The search index referenced by AZURE_SEARCH_INDEX_NAME must /// already exist with the documented schema and Contoso Outdoors content. The search /// service is shared with python-sample-validation.yml; no .NET-side provisioning /// script ships with this repository. /// /// public sealed class AzureSearchRagHostedAgentFixture : HostedAgentFixture { protected override string ScenarioName => "azure-search-rag"; /// /// Inject the AZURE_SEARCH_* env vars onto the hosted agent definition so the test container /// scenario branch can construct its SearchClient. These names are NOT in the platform /// reserved FOUNDRY_* / AGENT_* namespace so they are safe to set. /// protected override void ConfigureEnvironment(IDictionary environment) { environment[TestSettings.AzureSearchEndpoint] = TestConfiguration.GetRequiredValue(TestSettings.AzureSearchEndpoint); environment[TestSettings.AzureSearchIndexName] = TestConfiguration.GetRequiredValue(TestSettings.AzureSearchIndexName); } }