807
808
// TestUpsertWorkflowExecution test
810
>
temporalChangeVersionPayload, _ := payload.Encode([]string{"dummy"})
811
>
tests := []struct {
812
>
request *manager.UpsertWorkflowExecutionRequest
813
>
expected error
814
>
}{
815
>
{
816
>
request: &manager.UpsertWorkflowExecutionRequest{
817
>
VisibilityRequestBase: &manager.VisibilityRequestBase{
818
>
NamespaceID: "",
819
>
Namespace: "",
820
>
Execution: &commonpb.WorkflowExecution{},
821
>
WorkflowTypeName: "",
822
>
StartTime: time.Time{},
823
>
ExecutionTime: time.Time{},
824
>
TaskID: 0,
825
>
Memo: nil,
826
>
SearchAttributes: &commonpb.SearchAttributes{
827
>
IndexedFields: map[string]*commonpb.Payload{
828
>
sadefs.TemporalChangeVersion: temporalChangeVersionPayload,
829
>
},
830
>
},
831
>
Status: enumspb.WORKFLOW_EXECUTION_STATUS_RUNNING,
832
>
},
833
>
},
834
>
expected: nil,
835
>
},
836
>
{
837
>
request: &manager.UpsertWorkflowExecutionRequest{
838
>
VisibilityRequestBase: &manager.VisibilityRequestBase{
839
>
NamespaceID: "",
840
>
Namespace: "",
841
>
Execution: &commonpb.WorkflowExecution{},
842
>
WorkflowTypeName: "",
843
>
StartTime: time.Time{},
844
>
ExecutionTime: time.Time{},
845
>
TaskID: 0,
846
>
Memo: nil,
847
>
SearchAttributes: nil,
848
>
Status: enumspb.WORKFLOW_EXECUTION_STATUS_RUNNING,
849
>
},
850
>
},
851
>
// To avoid blocking the task queue processors on non-ElasticSearch visibility stores
852
>
// we simply treat any attempts to perform Upserts as "no-ops"
853
>
// Attempts to Scan, Count or List will still fail for non-ES stores.
854
>
expected: nil,
855
>
},
856
>
}
857
>
858
>
for _, test := range tests {
859
>
s.Equal(test.expected, s.VisibilityMgr.UpsertWorkflowExecution(s.ctx, test.request))
860
>
}
861
}
862