.NET: [Feature Branch] Update OpenAI config for integration tests (#2063)

This commit is contained in:
Chris Gillum
2025-11-10 15:56:42 -08:00
committed by GitHub
Unverified
parent 304b809655
commit 916b51fe1a
3 changed files with 18 additions and 11 deletions
@@ -116,10 +116,14 @@ internal sealed class TestHelper : IDisposable
internal static ChatClient GetAzureOpenAIChatClient(IConfiguration configuration)
{
string azureOpenAiEndpoint = configuration["AZURE_OPENAI_ENDPOINT"]
?? throw new InvalidOperationException("The required AZURE_OPENAI_ENDPOINT env variable is not set.");
string azureOpenAiDeploymentName = configuration["AZURE_OPENAI_DEPLOYMENT"]
?? throw new InvalidOperationException("The required AZURE_OPENAI_DEPLOYMENT env variable is not set.");
string azureOpenAiEndpoint =
configuration["AZUREAI:ENDPOINT"] ?? // Defined in dotnet-build-and-test.yml (as AZUREAI__ENDPOINT)
configuration["AZURE_OPENAI_ENDPOINT"] ?? // Legacy
throw new InvalidOperationException("The required AZUREAI__ENDPOINT or AZURE_OPENAI_ENDPOINT env variable is not set.");
string azureOpenAiDeploymentName =
configuration["AZUREAI:DEPLOYMENTNAME"] ?? // Defined in dotnet-build-and-test.yml (as AZUREAI__DEPLOYMENTNAME)
configuration["AZURE_OPENAI_DEPLOYMENT"] ?? // Legacy
throw new InvalidOperationException("The required AZUREAI__DEPLOYMENTNAME or AZURE_OPENAI_DEPLOYMENT env variable is not set.");
// Check if AZURE_OPENAI_KEY is provided for token-based authentication
string? azureOpenAiKey = configuration["AZURE_OPENAI_KEY"];
@@ -635,10 +635,14 @@ public sealed class SamplesValidation(ITestOutputHelper outputHelper) : IAsyncLi
RedirectStandardError = true,
};
string openAiEndpoint = s_configuration["AZURE_OPENAI_ENDPOINT"]
?? throw new InvalidOperationException("AZURE_OPENAI_ENDPOINT is not set in the environment variables or user secrets");
string openAiDeployment = s_configuration["AZURE_OPENAI_DEPLOYMENT"]
?? throw new InvalidOperationException("AZURE_OPENAI_DEPLOYMENT is not set in the environment variables or user secrets");
string openAiEndpoint =
s_configuration["AZUREAI:ENDPOINT"] ?? // Defined in dotnet-build-and-test.yml (as AZUREAI__ENDPOINT)
s_configuration["AZURE_OPENAI_ENDPOINT"] ?? // Legacy
throw new InvalidOperationException("The required AZUREAI__ENDPOINT or AZURE_OPENAI_ENDPOINT env variable is not set.");
string openAiDeployment =
s_configuration["AZUREAI:DEPLOYMENTNAME"] ?? // Defined in dotnet-build-and-test.yml (as AZUREAI__DEPLOYMENTNAME)
s_configuration["AZURE_OPENAI_DEPLOYMENT"] ?? // Legacy
throw new InvalidOperationException("The required AZUREAI__DEPLOYMENTNAME or AZURE_OPENAI_DEPLOYMENT env variable is not set.");
// Set required environment variables for the function app (see local.settings.json for required settings)
startInfo.EnvironmentVariables["AZURE_OPENAI_ENDPOINT"] = openAiEndpoint;
+2 -3
View File
@@ -144,7 +144,7 @@
},
"createdAt": { "type": "string", "format": "date-time", "description": "When this message was created (RFC 3339)." }
},
"required": ["role", "createdAt"]
"required": ["role"]
},
"chatMessages": {
"type": "array",
@@ -157,8 +157,7 @@
"createdAt": { "type": "string", "format": "date-time", "description": "When this exchange was created (RFC 3339)." },
"correlationId": { "type": "string", "description": "An optional correlation ID to group related exchanges." },
"messages": { "$ref": "#/$defs/chatMessages" }
},
"required": ["createdAt"]
}
},
"agentRequest": {
"allOf": [