Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] TaskQueue not forwarded when using Test Environment, breaks ContinueAsNew (hangs) #280

Open
mnichols opened this issue Jun 18, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@mnichols
Copy link

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:

2024-06-18T15:49:38.964086Z  WARN temporal_sdk_core::worker::workflow: Error while completing workflow activation error=status: InvalidArgument, message: "Missing TaskQueue.", details: [], metadata: MetadataMap { headers: {"content-type": "application/grpc"} }

It makes sense the test server hangs but the TaskQueue should really be getting auto-assigned by the Workflow if not provided explicitly.

@mnichols mnichols added the bug Something isn't working label Jun 18, 2024
@cretz
Copy link
Member

cretz commented Jun 18, 2024

This is caused/blocked by temporalio/sdk-java#1424

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants