Skip to content

Add preview Durable Functions testing and real-worker integration - #109

Merged
chullybun merged 17 commits into
mainfrom
feature/durable-functions-testing
Nov 14, 2026
Merged

chullybun merged 17 commits into
mainfrom
feature/durable-functions-testing

Conversation

@chullybun

@chullybun chullybun commented Nov 14, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Add the optional UnitTestEx.Azure.Functions.Durable 6.2.0-preview package: fluent SDK-host orchestration tests, explicit static/instance and typed root/child registration, activity mocks and invocation verification, typed assertions, and managed diagnostics.
  • Exercise orchestration serialization, replay, fan-out/fan-in, events, custom status, failure details, termination, continuation and custom activity/child retries through Microsoft's published in-memory host. Preserve ordinary Functions application startup and existing direct trigger invocation.
  • Provide a separate method-level virtual-time context for timer/event coordination, without pretending it is an orchestration engine.
  • Add real Functions integration using Core Tools, the isolated worker, the Durable extension and disposable Azurite 3.37.0 storage. Cover real batch activities/child/DI/logging, activity-failure recovery, approval against an unchanged 24-hour timer, and buffered-event preservation/discard across continuation.
  • Support .NET 8/9/10/11 libraries and core suites, .NET 10/11 Aspire and Durable suites, and fixed .NET 10 integration infrastructure. Replace sequential CI loops with independent framework jobs. The Durable integration job runs automatically on PRs and remains selectable for manual dispatch.
  • Fix Aspire request-log capture before the first resource buffer exists and retain severity/category across ordinary forced flushes of partial forwarded entries. ResetLogs() discards retained headers without changing error-check configuration. Keep the original HTTP error-log assertion and cover delayed capture, split entries and reset between header and body with focused regressions.
  • Refresh package publishing, contributor guidance, tester selection, quick starts, capability tables and final-state documentation; include the remaining TestSetUp comment indentation correction.

Explicit boundaries

The SDK host pins Microsoft.DurableTask.InProcessTestHost 0.2.3-preview.1. Its orchestration timers/retry delays remain wall-clock; supported host virtual time is requested in microsoft/durabletask-dotnet#843.

Buffered-event preservation across ContinueAsNew is unsupported by this pinned host (microsoft/durabletask-dotnet#844). Preservation requests warn and forward unchanged; no engine emulation or event reinjection hides the defect. Positive preservation belongs to the real-worker integration tier.

The method-level context has no engine history/replay and rejects activity/child calls. SDK execution does not establish Functions binding/serializer parity; local backend integration does not establish deployed Azure authentication, scale or reliability. The package and its upstream host remain preview APIs.

Validation

Remote CI passed across the framework and real-worker integration jobs at revision 1045cfb, including the reset regression. No local builds/tests were run.

chullybun and others added 16 commits November 11, 2026 15:17
Move fixed Aspire test infrastructure to .NET 10, migrate Functions samples to Azure.Functions.Sdk, remove the SDK pin, and update CI and documentation.

Co-authored-by: Copilot App <[email protected]>
Promote matched and ordered activity scripts with indexed response control, safe lifetimes, and completion assertion callbacks.

Co-authored-by: Copilot App <[email protected]>
Document the Durable showcase and preview boundaries, retain application startup and conditional locks, and enable independent framework CI jobs with manual dispatch.

Co-authored-by: Copilot App <[email protected]>
Remove shared .NET 11 preview settings, pass the Aspire framework list with literal MSBuild quotes, and use HTTP/1.1 for the sample named client.

Co-authored-by: Copilot App <[email protected]>
Target the dedicated Durable suite at .NET 10 and 11, run each in an independent matrix job, and update documentation with verified build/runtime boundaries and remaining release checks.

Co-authored-by: Copilot App <[email protected]>
Add fluent typed orchestration registration, continuation and custom retry scenarios, and opt-in Core Tools/Azurite integration. Replace interim documentation with final-state architecture and usage guidance.

Co-authored-by: Copilot App <[email protected]>
Include the remaining TestSetUp comment indentation correction.

Co-authored-by: Copilot App <[email protected]>
Copilot AI balanced review requested due to automatic review settings November 14, 2026 00:44

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

ResetResourceLogs() retains the previous log header, allowing a body received after reset to carry an earlier error into the next test and fail its checkpoint.

1 open issue
What changed in this PR

Adds optional preview Durable Functions testing to UnitTestEx, keeping SDK-host orchestration tests, method-level virtual time, and real-worker integration as distinct testing paths.

Changes:

  • Adds fluent orchestration testing, activity mocks, typed assertions, diagnostics, and SDK-host and real-worker coverage.
  • Improves Aspire capture of delayed resource logs and preserves severity across partial-entry flushes.
  • Extends framework support, updates build and publishing infrastructure, and documents capabilities and limitations.
File Description
UnitTestEx.sln Registers Durable library, sample, and test projects.
tests/​UnitTestEx.Xunit.Test/​UnitTestEx.Xunit.Test.csproj Adds .NET 11 coverage.
tests/​UnitTestEx.NUnit.Test/​UnitTestEx.NUnit.Test.csproj Adds .NET 11 and the Durable sample reference.
tests/​UnitTestEx.NUnit.Test/​DurableActivityTest.cs Tests normal startup and direct activity invocation.
tests/​UnitTestEx.MSTest.Test/​UnitTestEx.MSTest.Test.csproj Adds .NET 11 coverage.
tests/​UnitTestEx.IsolatedFunction/​UnitTestEx.IsolatedFunction.csproj Migrates Functions SDK and adds .NET 11.
tests/​UnitTestEx.DurableFunction/​WorkflowModels.cs Defines workflow inputs, outputs, and failure types.
tests/​UnitTestEx.DurableFunction/​WorkflowJournal.cs Provides an injectable logging journal.
tests/​UnitTestEx.DurableFunction/​WorkflowActivities.cs Implements processing and journal activities.
tests/​UnitTestEx.DurableFunction/​UnitTestEx.DurableFunction.csproj Configures the multi-targeted Durable sample.
tests/​UnitTestEx.DurableFunction/​Program.cs Uses ordinary Functions startup and service registration.
tests/​UnitTestEx.DurableFunction/​host.json Configures the Functions host.
tests/​UnitTestEx.DurableFunction/​FailureOrchestration.cs Demonstrates activity failure and recovery.
tests/​UnitTestEx.DurableFunction/​Directory.Build.targets Adds a host-extension dependency workaround.
tests/​UnitTestEx.DurableFunction/​ContinuationOrchestration.cs Demonstrates continuation and buffered events.
tests/​UnitTestEx.DurableFunction/​BatchOrchestration.cs Demonstrates fan-out, aggregation, and child orchestration.
tests/​UnitTestEx.DurableFunction/​ApprovalOrchestration.cs Races approval events against a timer.
tests/​UnitTestEx.DurableFunction/​ActivityTransforms.cs Supplies normalization, aggregation, and failure activities.
tests/​UnitTestEx.DurableFunction.HostProbe/​UnitTestEx.DurableFunction.HostProbe.csproj Configures standalone host-behavior probes.
tests/​UnitTestEx.DurableFunction.HostProbe/​InvalidAwaitProbe.cs Characterizes invalid-await and nondeterministic-I/O behavior.
tests/​UnitTestEx.Azure.Functions.Durable.Test/​UnitTestEx.Azure.Functions.Durable.Test.csproj Configures .NET 10/11 Durable tests.
tests/​UnitTestEx.Azure.Functions.Durable.Test/​SubOrchestrationRetryTest.cs Covers child retry recovery and exhaustion.
tests/​UnitTestEx.Azure.Functions.Durable.Test/​SerializationProbeModels.cs Supplies serialization test models.
tests/​UnitTestEx.Azure.Functions.Durable.Test/​ReplayDeterminismTest.cs Checks detection of divergent replay history.
tests/​UnitTestEx.Azure.Functions.Durable.Test/​PendingOrchestrationDisposalTest.cs Checks disposal with pending orchestration work.
tests/​UnitTestEx.Azure.Functions.Durable.Test/​OrchestrationTerminationTest.cs Covers termination and independent child lifetime.
tests/​UnitTestEx.Azure.Functions.Durable.Test/​HostTimerDiagnosticTest.cs Checks timer forwarding and replay-safe warnings.
tests/​UnitTestEx.Azure.Functions.Durable.Test/​FluentDurableTaskTest.cs Covers fluent execution, assertions, and diagnostics.
tests/​UnitTestEx.Azure.Functions.Durable.Test/​EarlyExternalEventTest.cs Covers buffering events before waits.
tests/​UnitTestEx.Azure.Functions.Durable.Test/​DurableTaskShowcaseTest.cs Demonstrates controlled fan-out/fan-in testing.
tests/​UnitTestEx.Azure.Functions.Durable.Test/​DurableTaskHostTest.cs Exercises real method bodies through the SDK host.
tests/​UnitTestEx.Azure.Functions.Durable.Test/​DurableSerializationTest.cs Checks serialization across SDK boundaries.
tests/​UnitTestEx.Azure.Functions.Durable.Test/​CustomStatusProgressionTest.cs Covers custom-status updates and clearing.
tests/​UnitTestEx.Azure.Functions.Durable.Test/​ContinueAsNewTest.cs Covers generations and host event-loss limitations.
tests/​UnitTestEx.Azure.Functions.Durable.Test/​ClassBasedOrchestrationTest.cs Covers typed root and child registration.
tests/​UnitTestEx.Azure.Functions.Durable.Test/​ClassBasedFailureOrchestrator.cs Supplies a typed failure-test orchestrator.
tests/​UnitTestEx.Azure.Functions.Durable.Test/​ClassBasedEchoOrchestrator.cs Supplies a typed echo-test orchestrator.
tests/​UnitTestEx.Azure.Functions.Durable.Test/​ApprovalVirtualTimeTest.cs Covers method-level timers, events, and cancellation.
tests/​UnitTestEx.Azure.Functions.Durable.Test/​ApprovalHostEventTest.cs Covers SDK-host approval and timeout paths.
tests/​UnitTestEx.Azure.Functions.Durable.Test/​ActivityTerminationTest.cs Checks activity completion after parent termination.
tests/​UnitTestEx.Azure.Functions.Durable.Integration.Test/​UnitTestEx.Azure.Functions.Durable.Integration.Test.csproj Configures .NET 10 real-worker integration tests.
tests/​UnitTestEx.Azure.Functions.Durable.Integration.Test/​DurableFunctionsIntegrationTest.cs Exercises batch, recovery, approval, and continuation.
tests/​UnitTestEx.Aspire.Xunit.Test/​UnitTestEx.Aspire.Xunit.Test.csproj Targets Aspire tests at .NET 10/11.
tests/​UnitTestEx.Aspire.Xunit.Test/​ResourceLogCaptureTest.cs Adds delayed-log and partial-flush regressions.
tests/​UnitTestEx.Aspire.ServiceBus.Function/​UnitTestEx.Aspire.ServiceBus.Function.csproj Migrates Functions SDK and targets .NET 10.
tests/​UnitTestEx.Aspire.ServiceBus.AppHost/​UnitTestEx.Aspire.ServiceBus.AppHost.csproj Updates Aspire and targets .NET 10.
tests/​UnitTestEx.Aspire.ServiceBus.AppHost/​AppHost.cs Uses the .NET 10 Functions output directory.
tests/​UnitTestEx.Aspire.NUnit.Test/​UnitTestEx.Aspire.NUnit.Test.csproj Targets Aspire tests at .NET 10/11.
tests/​UnitTestEx.Aspire.MSTest.Test/​UnitTestEx.Aspire.MSTest.Test.csproj Targets Aspire tests at .NET 10/11.
tests/​UnitTestEx.Aspire.MockHost/​UnitTestEx.Aspire.MockHost.csproj Moves the mock resource to .NET 10.
tests/​UnitTestEx.Aspire.Functions.AppHost/​UnitTestEx.Aspire.Functions.AppHost.csproj Updates Aspire and pins .NET 10 resources.
tests/​UnitTestEx.Aspire.Functions.AppHost/​AppHost.cs Uses the .NET 10 Functions output directory.
tests/​UnitTestEx.Aspire.Durable.AppHost/​UnitTestEx.Aspire.Durable.AppHost.csproj Configures the dedicated Durable AppHost.
tests/​UnitTestEx.Aspire.Durable.AppHost/​AppHost.cs Hosts Core Tools with disposable Azurite storage.
tests/​UnitTestEx.Aspire.AppHost/​UnitTestEx.Aspire.AppHost.csproj Updates Aspire and pins .NET 10 resources.
tests/​UnitTestEx.Aspire.AppHost/​AppHost.cs Runs the API resource on .NET 10.
tests/​UnitTestEx.Api/​UnitTestEx.Api.csproj Adds .NET 11 and updates JSON dependencies.
tests/​UnitTestEx.Api/​Startup.cs Uses a valid HTTP/1.1 request version.
src/​UnitTestEx/​UnitTestEx.csproj Adds .NET 11 and matching dependencies.
src/​UnitTestEx/​TestSetUp.cs Corrects comment indentation only.
src/​UnitTestEx/​Expectations/​ExpectationsArranger.cs Exposes whether expectations are arranged.
src/​UnitTestEx.Xunit/​UnitTestEx.Xunit.csproj Adds the .NET 11 library target.
src/​UnitTestEx.NUnit/​UnitTestEx.NUnit.csproj Adds the .NET 11 library target.
src/​UnitTestEx.MSTest/​UnitTestEx.MSTest.csproj Adds the .NET 11 library target.
src/​UnitTestEx.Azure.Functions/​UnitTestEx.Azure.Functions.csproj Adds the .NET 11 library target.
src/​UnitTestEx.Azure.Functions.Durable/​UnitTestEx.Azure.Functions.Durable.csproj Defines the optional preview package and dependencies.
src/​UnitTestEx.Azure.Functions.Durable/​TestHost/​DurableTaskTestRun.cs Manages waits, events, expectations, diagnostics, and disposal.
src/​UnitTestEx.Azure.Functions.Durable/​TestHost/​DurableTaskTestHostExtensions.cs Connects FunctionTester to the SDK host.
src/​UnitTestEx.Azure.Functions.Durable/​TestHost/​DurableTaskTestAssertor.cs Adds typed output and failure assertions.
src/​UnitTestEx.Azure.Functions.Durable/​TestHost/​DurableTaskRegistryExtensions.cs Forwards context operations with limitation warnings.
src/​UnitTestEx.Azure.Functions.Durable/​TestHost/​DurableTaskOrchestrationException.cs Represents unsuccessful outcomes for expectations.
src/​UnitTestEx.Azure.Functions.Durable/​TestHost/​DurableTaskActivityVerifier.cs Tracks and verifies per-run activity counts.
src/​UnitTestEx.Azure.Functions.Durable/​TestHost/​DurableTaskActivityOptions.cs Configures expected activity invocation counts.
src/​UnitTestEx.Azure.Functions.Durable/​TestHost/​ActivityResponse.cs Defines immediate, delayed, and gated responses.
src/​UnitTestEx.Azure.Functions.Durable/​TestHost/​ActivityMock.cs Routes invocations to consumable response plans.
src/​UnitTestEx.Aspire/​UnitTestEx.Aspire.csproj Adds .NET 11 and updates dependencies.
src/​UnitTestEx.Aspire/​Aspire/​AspireTesterBase.cs Improves first-log waiting and partial-entry capture.
nuget-publish.ps1 Includes the Durable package in publishing.
global.json Removes the repository SDK pin.
docs/​migration-v6.md Documents .NET 11 support.
docs/​azure-functions.md Documents direct Durable activity testing and SDK migration.
docs/​azure-durable-functions-design.md Describes architecture, ownership, and testing boundaries.
docs/​aspire.md Updates framework, integration, and log-capture guidance.
Directory.Solution.targets Adds solution-restore Functions extension generation.
CONTRIBUTING.md Documents build prerequisites and restore guidance.
Common.targets Advances the shared version to 6.2.0.
CHANGELOG.md Records Durable, logging, framework, and dependency changes.
.github/​workflows/​ci.yml Splits framework jobs and adds opt-in Durable integration.

Review effort: Balanced

Preserve headers for ordinary flushes, discard them during ResetLogs, and cover reset before delayed continuation lines. Enable automatic PR integration coverage and refresh the related documentation.

Co-authored-by: Copilot App <[email protected]>
@chullybun
chullybun merged commit 38efe6d into main Nov 14, 2026
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants