Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
typescript_latest: '1.9.3'
java_latest: '1.23.0'
python_latest: '1.6.0'
csharp_latest: '0.1.1'
csharp_latest: '1.1.2'
steps:
- run: 'echo noop'

Expand Down
2 changes: 1 addition & 1 deletion dotnet.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<PackageReference Include="Microsoft.Extensions.Logging" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="7.0.0" />
<PackageReference Include="System.CommandLine" Version="2.0.0-beta4.22272.1" />
<PackageReference Include="Temporalio" Version="1.1.1">
<PackageReference Include="Temporalio" Version="1.1.2">
<!--
We have to make sure this isn't included transitively so it can be
overridden.
Expand Down
9 changes: 6 additions & 3 deletions features/update/async_accepted/feature.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ public void ConfigureWorker(Runner runner, TemporalWorkerOptions options) =>
runner.NewWorkflowOptions());

// Start update
var updateHandle1 = await handle.StartUpdateAsync(wf => wf.SuccessfulUpdateAsync());
var updateHandle1 = await handle.StartUpdateAsync(
wf => wf.SuccessfulUpdateAsync(), new(WorkflowUpdateStage.Accepted));
// Send signal to finish the update
await handle.SignalAsync(wf => wf.FinishUpdateAsync());
// Confirm result
Expand All @@ -70,7 +71,8 @@ public void ConfigureWorker(Runner runner, TemporalWorkerOptions options) =>
Assert.Equal(123, await handle.GetUpdateHandle<int>(updateHandle1.Id).GetResultAsync());

// Start a failed update
var updateHandle2 = await handle.StartUpdateAsync(wf => wf.FailureUpdateAsync());
var updateHandle2 = await handle.StartUpdateAsync(
wf => wf.FailureUpdateAsync(), new(WorkflowUpdateStage.Accepted));
// Send signal to finish the update
await handle.SignalAsync(wf => wf.FinishUpdateAsync());
// Confirm failure
Expand All @@ -79,7 +81,8 @@ public void ConfigureWorker(Runner runner, TemporalWorkerOptions options) =>
Assert.Equal("Intentional failure", exc.InnerException?.Message);

// Start an update but cancel/timeout waiting on its result
var updateHandle3 = await handle.StartUpdateAsync(wf => wf.SuccessfulUpdateAsync());
var updateHandle3 = await handle.StartUpdateAsync(
wf => wf.SuccessfulUpdateAsync(), new(WorkflowUpdateStage.Accepted));
// Wait for result only for 100ms
using var tokenSource = new CancellationTokenSource();
tokenSource.CancelAfter(TimeSpan.FromMilliseconds(100));
Expand Down
8 changes: 6 additions & 2 deletions features/update/basic_async/feature.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ public void ConfigureWorker(Runner runner, TemporalWorkerOptions options) =>
(MyWorkflow wf) => wf.RunAsync(),
runner.NewWorkflowOptions());

var badUpdateHandle = await handle.StartUpdateAsync(wf => wf.MyUpdate("invalid"));
var badUpdateHandle = await handle.StartUpdateAsync(
wf => wf.MyUpdate("invalid"),
new(WorkflowUpdateStage.Accepted));

try
{
Expand All @@ -56,7 +58,9 @@ public void ConfigureWorker(Runner runner, TemporalWorkerOptions options) =>
// Expected
}

var goodUpdateHandle = await handle.StartUpdateAsync(wf => wf.MyUpdate("valid"));
var goodUpdateHandle = await handle.StartUpdateAsync(
wf => wf.MyUpdate("valid"),
new(WorkflowUpdateStage.Accepted));
Assert.Equal("hi", await goodUpdateHandle.GetResultAsync());

return handle;
Expand Down
4 changes: 2 additions & 2 deletions features/update/deduplication/feature.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ public void ConfigureWorker(Runner runner, TemporalWorkerOptions options)
runner.NewWorkflowOptions());

var updateId = "myid";
await handle.ExecuteUpdateAsync(wf => wf.MyUpdate(false), new() {UpdateID = updateId});
await handle.ExecuteUpdateAsync(wf => wf.MyUpdate(false), new() { Id = updateId });
Assert.Equal(1, await handle.QueryAsync(wf => wf.Count));
await handle.ExecuteUpdateAsync(wf => wf.MyUpdate(false), new() {UpdateID = updateId});
await handle.ExecuteUpdateAsync(wf => wf.MyUpdate(false), new() { Id = updateId });
Assert.Equal(1, await handle.QueryAsync(wf => wf.Count));
await handle.ExecuteUpdateAsync(wf => wf.MyUpdate(true));

Expand Down
9 changes: 5 additions & 4 deletions harness/dotnet/Temporalio.Features.Harness/App.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ private static async Task RunCommandAsync(InvocationContext ctx)
};

// Go over each feature, calling the runner for it
var failureCount = 0;
var failures = new List<string>();
foreach (var (dir, taskQueue) in ctx.ParseResult.GetValueForArgument(featuresArgument))
{
var feature =
Expand All @@ -109,13 +109,14 @@ private static async Task RunCommandAsync(InvocationContext ctx)
catch (Exception e)
{
logger.LogError(e, "Feature {Feature} failed", feature.Dir);
failureCount++;
failures.Add(feature.Dir);
}
}

if (failureCount > 0)
if (failures.Count > 0)
{
throw new InvalidOperationException($"{failureCount} feature(s) failed");
throw new InvalidOperationException(
$"{failures.Count} feature(s) failed: {string.Join(", ", failures)}");
}

logger.LogInformation("All features passed");
Expand Down
8 changes: 5 additions & 3 deletions harness/dotnet/Temporalio.Features.Harness/Runner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ internal Runner(
Logger = loggerFactory.CreateLogger(PreparedFeature.FeatureType);
Feature = (IFeature)Activator.CreateInstance(PreparedFeature.FeatureType, true)!;

ClientOptions = clientConnectOptions;
Feature.ConfigureClient(this, clientConnectOptions);
ClientOptions = (TemporalClientConnectOptions)clientConnectOptions.Clone();
Feature.ConfigureClient(this, ClientOptions);
WorkerOptions = new(taskQueue) { LoggerFactory = loggerFactory };
}

Expand Down Expand Up @@ -196,7 +196,9 @@ public async Task SkipIfAsyncUpdateNotSupportedAsync()
public Task<bool> CheckAsyncUpdateSupportedAsync() =>
CheckUpdateSupportCallAsync(() =>
Client.GetWorkflowHandle("does-not-exist").StartUpdateAsync(
"does-not-exist", Array.Empty<object?>()));
"does-not-exist",
Array.Empty<object?>(),
new(WorkflowUpdateStage.Accepted)));

/// <summary>
/// Start the worker.
Expand Down