Hi,
I am working on refining the error parsing/handling logic in my workflow code.
If I remember correctly the demo I saw, it is possible to:
- download the history of a workflow (done)
- replay this history against the workflow/decision logic.
- put break points and tweak the error parsing until it does what I want.
For 2), it seems like I should use worker.ReplayWorkflowHistoryFromJSONFile. So I have written a test case like this what’s at the end of this message. It does not work and I tracked the issue down to the following:
{“error”: “json: cannot unmarshal array into Go value of type map[string]json.RawMessage”}
I must be missing something obvious at this point. The history was downloaded from the console, and I am using temporal 0.26. How do I get past this?
For 3), I am using Goland. I don’t think that should matter, but could you share pointers if there are gotchas?
Thank you,
Jacques
----------------------------------------- Test case below to trigger replay:
package workflow
import (
“github.com/stretchr/testify/suite”
“go.temporal.io/temporal/testsuite”
“go.temporal.io/temporal/worker”
“go.uber.org/zap”
“testing”
)
// This file is a helper to replay workflow execution code (downloaded from the service or the console)
type UnitTestSuite struct {
suite.Suite
testsuite.WorkflowTestSuite
}
func TestUnitTestSuite(t *testing.T) {
suite.Run(t, new(UnitTestSuite))
}
func (s *UnitTestSuite) Test_Workflow() {
filename := “my_history_file.json”
logger, err := zap.NewDevelopment()
if err != nil {
panic(err)
}
w := worker.NewWorkflowReplayer()
w.RegisterWorkflow(PatchClusterWorkflow)
w.ReplayWorkflowHistoryFromJSONFile(logger, filename)
}