Skip to content

Commit

Permalink
Merge Branch dev to Branch main #2837 from Azure/dev
Browse files Browse the repository at this point in the history
Merge Branch dev to Branch main
  • Loading branch information
nytian authored May 29, 2024
2 parents 0596909 + fe9a128 commit c3f5504
Show file tree
Hide file tree
Showing 9 changed files with 108 additions and 13 deletions.
7 changes: 7 additions & 0 deletions WebJobs.Extensions.DurableTask.sln
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "PerfTests", "PerfTests", "{
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DFPerfScenariosV4", "test\DFPerfScenarios\DFPerfScenariosV4.csproj", "{FC8AD123-F949-4D21-B817-E5A4BBF7F69B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Worker.Extensions.DurableTask.Tests", "test\Worker.Extensions.DurableTask.Tests\Worker.Extensions.DurableTask.Tests.csproj", "{76DEC17C-BF6A-498A-8E8A-7D6CB2E03284}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -178,6 +180,10 @@ Global
{FC8AD123-F949-4D21-B817-E5A4BBF7F69B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FC8AD123-F949-4D21-B817-E5A4BBF7F69B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FC8AD123-F949-4D21-B817-E5A4BBF7F69B}.Release|Any CPU.Build.0 = Release|Any CPU
{76DEC17C-BF6A-498A-8E8A-7D6CB2E03284}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{76DEC17C-BF6A-498A-8E8A-7D6CB2E03284}.Debug|Any CPU.Build.0 = Debug|Any CPU
{76DEC17C-BF6A-498A-8E8A-7D6CB2E03284}.Release|Any CPU.ActiveCfg = Release|Any CPU
{76DEC17C-BF6A-498A-8E8A-7D6CB2E03284}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -211,6 +217,7 @@ Global
{65F904AA-0F6F-48CB-BE19-593B7D68152A} = {7387E723-E153-4B7A-B105-8C67BFBD48CF}
{7387E723-E153-4B7A-B105-8C67BFBD48CF} = {78BCF152-C22C-408F-9FB1-0F8C99B154B5}
{FC8AD123-F949-4D21-B817-E5A4BBF7F69B} = {7387E723-E153-4B7A-B105-8C67BFBD48CF}
{76DEC17C-BF6A-498A-8E8A-7D6CB2E03284} = {78BCF152-C22C-408F-9FB1-0F8C99B154B5}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {5E9AC327-DE18-41A5-A55D-E44CB4281943}
Expand Down
5 changes: 2 additions & 3 deletions release_notes.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
# Release Notes

## Microsoft.Azure.Functions.Worker.Extensions.DurableTask 1.2.0
## Microsoft.Azure.Functions.Worker.Extensions.DurableTask 1.2.1

### New Features

- Add `suspendPostUri` and `resumePostUri` to the list of returned URIs in `CreateCheckStatusResponseAsync`. (https://github.com/Azure/azure-functions-durable-extension/pull/2785)
- Fix `NotSupportedException` when calling `PurgeAllInstancesAsync` and `PurgeInstanceAsync`
- Fix regression on `TerminateInstanceAsync` API causing invocations to fail with "unimplemented" exceptions (https://github.com/Azure/azure-functions-durable-extension/pull/2829).

### Bug Fixes

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<RootNamespace>Microsoft.Azure.WebJobs.Extensions.DurableTask</RootNamespace>
<MajorVersion>2</MajorVersion>
<MinorVersion>13</MinorVersion>
<PatchVersion>3</PatchVersion>
<PatchVersion>4</PatchVersion>
<VersionSuffix>$(PackageSuffix)</VersionSuffix>
<FileVersion>$(MajorVersion).$(MinorVersion).$(PatchVersion)</FileVersion>
<AssemblyVersion>$(MajorVersion).0.0.0</AssemblyVersion>
Expand Down Expand Up @@ -113,8 +113,8 @@

<!-- Common dependencies across all targets -->
<ItemGroup>
<PackageReference Include="Microsoft.Azure.DurableTask.Core" Version="2.17.0" />
<PackageReference Include="Microsoft.Azure.DurableTask.AzureStorage" Version="1.17.2" />
<PackageReference Include="Microsoft.Azure.DurableTask.Core" Version="2.17.1" />
<PackageReference Include="Microsoft.Azure.DurableTask.AzureStorage" Version="1.17.3" />
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.DurableTask.Analyzers" Version="0.5.*" />
<!-- Build-time dependencies -->
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.*" PrivateAssets="All" />
Expand Down
4 changes: 3 additions & 1 deletion src/Worker.Extensions.DurableTask/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.

using System.Runtime.CompilerServices;
using Microsoft.Azure.Functions.Worker.Extensions.Abstractions;

// TODO: Find a way to generate this dynamically at build-time
[assembly: ExtensionInformation("Microsoft.Azure.WebJobs.Extensions.DurableTask", "2.13.3")]
[assembly: ExtensionInformation("Microsoft.Azure.WebJobs.Extensions.DurableTask", "2.13.4")]
[assembly: InternalsVisibleTo("Worker.Extensions.DurableTask.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100cd1dabd5a893b40e75dc901fe7293db4a3caf9cd4d3e3ed6178d49cd476969abe74a9e0b7f4a0bb15edca48758155d35a4f05e6e852fff1b319d103b39ba04acbadd278c2753627c95e1f6f6582425374b92f51cca3deb0d2aab9de3ecda7753900a31f70a236f163006beefffe282888f85e3c76d1205ec7dfef7fa472a17b1")]
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@ public override Task SuspendInstanceAsync(
}

public override Task TerminateInstanceAsync(
string instanceId, object? output = null, CancellationToken cancellation = default)
string instanceId, TerminateInstanceOptions? options = null, CancellationToken cancellation = default)
{
return this.inner.TerminateInstanceAsync(instanceId, output, cancellation);
return this.inner.TerminateInstanceAsync(instanceId, options, cancellation);
}

public override Task<OrchestrationMetadata> WaitForInstanceCompletionAsync(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ public override HttpMethod Read(
Type objectType,
JsonSerializerOptions options)
{
return new HttpMethod(reader.GetString());
string readerString = reader.GetString() ?? string.Empty;
return new HttpMethod(readerString);
}

public override void Write(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<AssemblyOriginatorKeyFile>..\..\sign.snk</AssemblyOriginatorKeyFile>

<!-- Version information -->
<VersionPrefix>1.1.3</VersionPrefix>
<VersionPrefix>1.1.4</VersionPrefix>
<VersionSuffix></VersionSuffix>
<AssemblyVersion>$(VersionPrefix).0</AssemblyVersion>
<!-- FileVersionRevision is expected to be set by the CI. -->
Expand All @@ -39,8 +39,8 @@
<ItemGroup>
<PackageReference Include="Microsoft.Azure.Functions.Worker.Core" Version="1.16.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Abstractions" Version="1.3.0" />
<PackageReference Include="Microsoft.DurableTask.Client.Grpc" Version="1.2.3" />
<PackageReference Include="Microsoft.DurableTask.Worker.Grpc" Version="1.2.3" />
<PackageReference Include="Microsoft.DurableTask.Client.Grpc" Version="1.2.4" />
<PackageReference Include="Microsoft.DurableTask.Worker.Grpc" Version="1.2.4" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
using Microsoft.DurableTask.Client;
using Microsoft.DurableTask.Client.Grpc;
using Moq;

namespace Microsoft.Azure.Functions.Worker.Tests
{
/// <summary>
/// Unit tests for <see cref="FunctionsDurableTaskClient />.
/// </summary>
public class FunctionsDurableTaskClientTests
{
private FunctionsDurableTaskClient GetTestFunctionsDurableTaskClient()
{
// construct mock client

// The DurableTaskClient demands a string parameter in it's constructor, so we pass it in
string clientName = string.Empty;
Mock<DurableTaskClient> durableClientMock = new(clientName);

Task completedTask = Task.CompletedTask;
durableClientMock.Setup(x => x.TerminateInstanceAsync(
It.IsAny<string>(), It.IsAny<TerminateInstanceOptions>(), It.IsAny<CancellationToken>())).Returns(completedTask);

DurableTaskClient durableClient = durableClientMock.Object;
FunctionsDurableTaskClient client = new FunctionsDurableTaskClient(durableClient, queryString: null);
return client;
}

/// <summary>
/// Test that the `TerminateInstnaceAsync` can be invoked without exceptions.
/// Exceptions are a risk since we inherit from an abstract class where default implementations are not provided.
/// </summary>
[Fact]
public async void TerminateDoesNotThrow()
{
FunctionsDurableTaskClient client = GetTestFunctionsDurableTaskClient();

string instanceId = string.Empty;
object output = string.Empty;
TerminateInstanceOptions options = new TerminateInstanceOptions();
CancellationToken token = CancellationToken.None;

// call terminate API with every possible parameter combination
// if we don't encounter any unimplemented exceptions from the abstract class,
// then the test passes

await client.TerminateInstanceAsync(instanceId, token);

await client.TerminateInstanceAsync(instanceId, output);
await client.TerminateInstanceAsync(instanceId, output, token);

await client.TerminateInstanceAsync(instanceId);
await client.TerminateInstanceAsync(instanceId, options);
await client.TerminateInstanceAsync(instanceId, options, token);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>

<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>

<!-- Sign assembly so it can reference internal components of the Worker Extension package -->
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>..\..\sign.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="coverlet.collector" Version="6.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="xunit" Version="2.5.3" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.3" />
<PackageReference Include="Moq" Version="4.7.145" />
<ProjectReference Include="..\..\src\Worker.Extensions.DurableTask\Worker.Extensions.DurableTask.csproj" />
</ItemGroup>

<ItemGroup>
<Using Include="Xunit" />
</ItemGroup>

</Project>

0 comments on commit c3f5504

Please sign in to comment.