Skip to content

Commit 193697e

Browse files
giles17Copilot
andcommitted
Fix AzureFunctions integration tests — set FUNCTIONS_WORKER_RUNTIME
Azure Functions Core Tools v4 can no longer auto-detect the worker runtime when local.settings.json is absent. Add the required FUNCTIONS_WORKER_RUNTIME=dotnet-isolated environment variable to both StartFunctionApp helpers and re-enable the skipped tests. Fixes: #6402 Co-authored-by: Copilot <[email protected]>
1 parent 5e09727 commit 193697e

2 files changed

Lines changed: 15 additions & 13 deletions

File tree

‎dotnet/tests/Microsoft.Agents.AI.Hosting.AzureFunctions.IntegrationTests/SamplesValidation.cs‎

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public sealed class SamplesValidation(ITestOutputHelper outputHelper) : IAsyncLi
2727
#else
2828
private const string BuildConfiguration = "Release";
2929
#endif
30-
private static readonly HttpClient s_sharedHttpClient = new();
30+
private static readonly HttpClient s_sharedHttpClient = new() { Timeout = TimeSpan.FromMinutes(3) };
3131
private static readonly IConfiguration s_configuration =
3232
new ConfigurationBuilder()
3333
.AddEnvironmentVariables()
@@ -60,7 +60,7 @@ async ValueTask IAsyncDisposable.DisposeAsync()
6060
await Task.CompletedTask;
6161
}
6262

63-
[RetryFact(2, 5000, Skip = "Azure Functions Core Tools v4 cannot auto-detect worker runtime in CI. See https://github.com/microsoft/agent-framework/issues/6402")]
63+
[RetryFact(2, 5000)]
6464
public async Task SingleAgentSampleValidationAsync()
6565
{
6666
string samplePath = Path.Combine(s_samplesPath, "01_SingleAgent");
@@ -148,7 +148,7 @@ await this.RunSampleTestAsync(samplePath, async (logs) =>
148148
});
149149
}
150150

151-
[RetryFact(2, 5000, Skip = "Azure Functions Core Tools v4 cannot auto-detect worker runtime in CI. See https://github.com/microsoft/agent-framework/issues/6402")]
151+
[RetryFact(2, 5000)]
152152
public async Task MultiAgentOrchestrationConcurrentSampleValidationAsync()
153153
{
154154
string samplePath = Path.Combine(s_samplesPath, "03_AgentOrchestration_Concurrency");
@@ -198,7 +198,7 @@ await this.RunSampleTestAsync(samplePath, async (logs) =>
198198
});
199199
}
200200

201-
[RetryFact(2, 5000, Skip = "Azure Functions Core Tools v4 cannot auto-detect worker runtime in CI. See https://github.com/microsoft/agent-framework/issues/6402")]
201+
[RetryFact(2, 5000)]
202202
public async Task MultiAgentOrchestrationConditionalsSampleValidationAsync()
203203
{
204204
string samplePath = Path.Combine(s_samplesPath, "04_AgentOrchestration_Conditionals");
@@ -216,7 +216,7 @@ await this.TestSpamDetectionAsync("email-002",
216216
});
217217
}
218218

219-
[RetryFact(2, 5000, Skip = "Azure Functions Core Tools v4 cannot auto-detect worker runtime in CI. See https://github.com/microsoft/agent-framework/issues/6402")]
219+
[RetryFact(2, 5000)]
220220
public async Task SingleAgentOrchestrationHITLSampleValidationAsync()
221221
{
222222
string samplePath = Path.Combine(s_samplesPath, "05_AgentOrchestration_HITL");
@@ -272,7 +272,7 @@ await this.RunSampleTestAsync(samplePath, async (logs) =>
272272
});
273273
}
274274

275-
[RetryFact(2, 5000, Skip = "Azure Functions Core Tools v4 cannot auto-detect worker runtime in CI. See https://github.com/microsoft/agent-framework/issues/6402")]
275+
[RetryFact(2, 5000)]
276276
public async Task LongRunningToolsSampleValidationAsync()
277277
{
278278
string samplePath = Path.Combine(s_samplesPath, "06_LongRunningTools");
@@ -362,7 +362,7 @@ await this.WaitForConditionAsync(
362362
});
363363
}
364364

365-
[RetryFact(2, 5000, Skip = "Azure Functions Core Tools v4 cannot auto-detect worker runtime in CI. See https://github.com/microsoft/agent-framework/issues/6402")]
365+
[RetryFact(2, 5000)]
366366
public async Task AgentAsMcpToolAsync()
367367
{
368368
string samplePath = Path.Combine(s_samplesPath, "07_AgentAsMcpTool");
@@ -402,7 +402,7 @@ await this.WaitForConditionAsync(
402402
});
403403
}
404404

405-
[RetryFact(2, 5000, Skip = "Azure Functions Core Tools v4 cannot auto-detect worker runtime in CI. See https://github.com/microsoft/agent-framework/issues/6402")]
405+
[RetryFact(2, 5000)]
406406
public async Task ReliableStreamingSampleValidationAsync()
407407
{
408408
string samplePath = Path.Combine(s_samplesPath, "08_ReliableStreaming");
@@ -844,6 +844,7 @@ private Process StartFunctionApp(string samplePath, List<OutputLog> logs)
844844
throw new InvalidOperationException("The required AZURE_OPENAI_DEPLOYMENT_NAME env variable is not set.");
845845

846846
// Set required environment variables for the function app (see local.settings.json for required settings)
847+
startInfo.EnvironmentVariables["FUNCTIONS_WORKER_RUNTIME"] = "dotnet-isolated";
847848
startInfo.EnvironmentVariables["AZURE_OPENAI_ENDPOINT"] = openAiEndpoint;
848849
startInfo.EnvironmentVariables["AZURE_OPENAI_DEPLOYMENT_NAME"] = openAiDeployment;
849850
startInfo.EnvironmentVariables["DURABLE_TASK_SCHEDULER_CONNECTION_STRING"] =

‎dotnet/tests/Microsoft.Agents.AI.Hosting.AzureFunctions.IntegrationTests/WorkflowSamplesValidation.cs‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public ValueTask DisposeAsync()
6262
return default;
6363
}
6464

65-
[Fact(Skip = "Azure Functions Core Tools v4 cannot auto-detect worker runtime in CI. See https://github.com/microsoft/agent-framework/issues/6402")]
65+
[Fact]
6666
public async Task SequentialWorkflowSampleValidationAsync()
6767
{
6868
string samplePath = Path.Combine(s_samplesPath, "01_SequentialWorkflow");
@@ -168,7 +168,7 @@ await this.WaitForConditionAsync(
168168
});
169169
}
170170

171-
[Fact(Skip = "Azure Functions Core Tools v4 cannot auto-detect worker runtime in CI. See https://github.com/microsoft/agent-framework/issues/6402")]
171+
[Fact]
172172
public async Task HITLWorkflowSampleValidationAsync()
173173
{
174174
string samplePath = Path.Combine(s_samplesPath, "03_WorkflowHITL");
@@ -277,7 +277,7 @@ await this.WaitForConditionAsync(
277277
});
278278
}
279279

280-
[Fact(Skip = "Azure Functions Core Tools v4 cannot auto-detect worker runtime in CI. See https://github.com/microsoft/agent-framework/issues/6402")]
280+
[Fact]
281281
public async Task WorkflowMcpToolSampleValidationAsync()
282282
{
283283
string samplePath = Path.Combine(s_samplesPath, "04_WorkflowMcpTool");
@@ -333,7 +333,7 @@ await this.RunSampleTestAsync(samplePath, requiresOpenAI: false, async (logs) =>
333333
});
334334
}
335335

336-
[Fact(Skip = "Azure Functions Core Tools v4 cannot auto-detect worker runtime in CI. See https://github.com/microsoft/agent-framework/issues/6402")]
336+
[Fact]
337337
public async Task WorkflowAndAgentsSampleValidationAsync()
338338
{
339339
string samplePath = Path.Combine(s_samplesPath, "05_WorkflowAndAgents");
@@ -385,7 +385,7 @@ await this.RunSampleTestAsync(samplePath, requiresOpenAI: true, async (logs) =>
385385
});
386386
}
387387

388-
[Fact(Skip = "Azure Functions Core Tools v4 cannot auto-detect worker runtime in CI. See https://github.com/microsoft/agent-framework/issues/6402")]
388+
[Fact]
389389
public async Task ConcurrentWorkflowSampleValidationAsync()
390390
{
391391
string samplePath = Path.Combine(s_samplesPath, "02_ConcurrentWorkflow");
@@ -619,6 +619,7 @@ private Process StartFunctionApp(string samplePath, List<OutputLog> logs, bool r
619619
startInfo.EnvironmentVariables["AZURE_OPENAI_DEPLOYMENT"] = openAiDeployment;
620620
}
621621

622+
startInfo.EnvironmentVariables["FUNCTIONS_WORKER_RUNTIME"] = "dotnet-isolated";
622623
startInfo.EnvironmentVariables["DURABLE_TASK_SCHEDULER_CONNECTION_STRING"] =
623624
$"Endpoint=http://localhost:{DtsPort};TaskHub=default;Authentication=None";
624625
startInfo.EnvironmentVariables["AzureWebJobsStorage"] = "UseDevelopmentStorage=true";

0 commit comments

Comments
 (0)