-
Notifications
You must be signed in to change notification settings - Fork 255
Closed
temporalio/api-go
#216Labels
bugSomething isn't workingSomething isn't working
Description
Expected Behavior
Visitor should visit this repeated temporal.api.common.v1.Payload
https://github.com/temporalio/api/blob/9156239c8272003b6f228951602ca2b130a55876/temporal/api/workflowservice/v1/request_response.proto#L938
This test should pass
func TestVisitPayloads_AggregationGroup(t *testing.T) {
// Due to us not visiting protos inside Any, this test used to fail
root := &workflowservice.CountWorkflowExecutionsResponse_AggregationGroup{GroupValues: []*common.Payload{{Data: []byte("orig-val")}}}
var count int
// Visit with any recursion enabled and only change orig-val
err := VisitPayloads(context.Background(), root, VisitPayloadsOptions{
Visitor: func(ctx *VisitPayloadsContext, p []*common.Payload) ([]*common.Payload, error) {
count += 1
// Only mutate if the payloads has orig-val
if len(p) == 1 && string(p[0].Data) == "orig-val" {
return []*common.Payload{{Data: []byte("new-val")}}, nil
}
return p, nil
},
})
require.NoError(t, err)
require.Equal(t, 1, count)
}
Actual Behavior
Test is failing due to Payload not being visited.
Steps to Reproduce the Problem
Specifications
- Version:
- Platform:
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working