This test hangs because of a grpc reported missing TaskQueue (see below for error message):
using Temporalio.Client;
using Temporalio.Exceptions;
using Temporalio.Testing;
using Temporalio.Worker;
using Temporalio.Worker.Interceptors;
using Temporalio.Workflows;
using Xunit.Abstractions;
namespace Temporal.Curriculum.Timers.Tests.Orchestrations;
[Workflow]
public class Continued
{
[WorkflowRun]
public async Task RunAsync(string arg)
{
if (string.Equals("can", arg))
{
return;
}
await Workflow.DelayAsync(2000);
var canOpts = new ContinueAsNewOptions();
throw Workflow.CreateContinueAsNewException<Continued>(wf => wf.RunAsync("can"), canOpts);
}
}
public class ContinueAsNewTests : TestBase
{
[Fact]
public async Task CAN_WorksWithNoTaskQueue()
{
await using var env = await WorkflowEnvironment.StartTimeSkippingAsync();
var workerOptions = new TemporalWorkerOptions("test") { LoggerFactory = LoggerFactory };
workerOptions.AddWorkflow<Continued>();
using var worker = new TemporalWorker(
env.Client,
workerOptions
);
await worker.ExecuteAsync(async () =>
{
var handle = await env.Client.StartWorkflowAsync<Continued>(wf => wf.RunAsync("first"),
new WorkflowOptions("can1", worker.Options.TaskQueue!));
var e = await Assert.ThrowsAsync<ContinueAsNewException>(async () =>
{
await handle.GetResultAsync();
});
});
}
public ContinueAsNewTests(ITestOutputHelper output) : base(output)
{
}
}
The error that prints before the test server hangs is:
This test hangs because of a grpc reported missing TaskQueue (see below for error message):
The error that prints before the test server hangs is:
It makes sense the test server hangs but the TaskQueue should really be getting auto-assigned by the Workflow if not provided explicitly.