Error : operation GetCurrentExecution encounter not found

Implementing integration tests to test SignalWorkflow
so this is what I have inside the workflow

var sgWebhook SgWebhook
signalChan := workflow.GetSignalChannel(ctx, SignalWebhook)
signalChan.Receive(ctx, &sgWebhook)

This is the test:

// mocking activities and other stuff
tk.WorkflowEnv.ExecuteWorkflow(workflows.MyWorkflow, ... )
err := tc.SignalWorkflow(context.Background(), wfId, "", workflows.SignalWebhook, sgWebhook)

And this is what I get:

Failed to signal workflow: *serviceerror.NotFound=operation GetCurrentExecution encounter not found)

Not really sure what else to put, please, feel free to ask for more info.

testEnv.ExecuteWorkflow blocks until the workflow is completed. So you are trying to send a signal to an already closed workflow. Use registerDelayedCallbck before executing workflow to send a signal at some. point of workflow execution:

s.env.RegisterDelayedCallback(func() {
    s.env.SignalWorkflow(context.Background(), wfId, "", workflows.SignalWebhook, sgWebhook)
}, time.Minute)