Files
Alex ShtinandGitHub 8e8f1b0f7c Remove license header from every file (#7689)
## What changed?
<!-- Describe what has changed in this PR -->
Remove license header from every file. Because it is really hard to
follow in this PR here is the summary:
1. License header is removed from all `.go` and `.proto` files
:fireworks::fireworks:🎆.
2. `LICENSE` file in the root directory has only Temporal and Uber
copyrights.
3. 5 other `LICENSE` files added to the packages which have copyrights
different from Temporal and Uber: Datadog, Xargin, "Mat Ryer, Tyler
Bunnell and contributors".
4. `license_file` flag is removed from all code generation tools.
5. `copyright_file` flag is removed from `go:generate mockgen`
directive.
6. All copyright related targets are removed from `Makefile`.
7. Updated Temporal copyright year to 2025 everywhere.

## Why?
<!-- Tell your future self why have you made these changes -->
I double checked with legal department that it is not needed to have
license header in every file. One file per repo is enough. I put all
copyrights to the root `LICENSE` file and removed header from all other
files. Also updated tools and `Makefile`.
2025-05-01 18:50:21 -07:00

88 lines
2.9 KiB
Go

package main
import (
"reflect"
"testing"
"github.com/stretchr/testify/assert"
"go.temporal.io/api/workflowservice/v1"
"go.temporal.io/server/api/historyservice/v1"
"go.temporal.io/server/api/matchingservice/v1"
)
func TestWorkflowTagGetters(t *testing.T) {
testCases := []struct {
name string
reqT reflect.Type
workflowIDGetter string
runIDGetter string
taskTokenGetter string
}{
{
name: "Request with only workflowID",
reqT: reflect.TypeOf(&workflowservice.StartWorkflowExecutionRequest{}),
workflowIDGetter: "GetWorkflowId()",
},
{
name: "Request with workflowID and runID",
reqT: reflect.TypeOf(&workflowservice.RecordActivityTaskHeartbeatByIdRequest{}),
workflowIDGetter: "GetWorkflowId()",
runIDGetter: "GetRunId()",
},
{
name: "Request with execution",
reqT: reflect.TypeOf(&workflowservice.GetWorkflowExecutionHistoryRequest{}),
workflowIDGetter: "GetExecution().GetWorkflowId()",
runIDGetter: "GetExecution().GetRunId()",
},
{
name: "Request with workflow_execution",
reqT: reflect.TypeOf(&workflowservice.RequestCancelWorkflowExecutionRequest{}),
workflowIDGetter: "GetWorkflowExecution().GetWorkflowId()",
runIDGetter: "GetWorkflowExecution().GetRunId()",
},
{
name: "Request with task_token",
reqT: reflect.TypeOf(&workflowservice.RespondActivityTaskCompletedRequest{}),
taskTokenGetter: "GetTaskToken()",
},
{
name: "Special handling for RespondQueryTaskCompletedRequest",
reqT: reflect.TypeOf(&workflowservice.RespondQueryTaskCompletedRequest{}),
},
{
name: "Matching request",
reqT: reflect.TypeOf(&matchingservice.QueryWorkflowRequest{}),
workflowIDGetter: "GetQueryRequest().GetExecution().GetWorkflowId()",
runIDGetter: "GetQueryRequest().GetExecution().GetRunId()",
},
{
name: "History request",
reqT: reflect.TypeOf(&historyservice.SignalWorkflowExecutionRequest{}),
workflowIDGetter: "GetSignalRequest().GetWorkflowExecution().GetWorkflowId()",
runIDGetter: "GetSignalRequest().GetWorkflowExecution().GetRunId()",
},
{
name: "History request overrides",
reqT: reflect.TypeOf(&historyservice.ReplicateWorkflowStateRequest{}),
workflowIDGetter: "GetWorkflowState().GetExecutionInfo().GetWorkflowId()",
runIDGetter: "GetWorkflowState().GetExecutionState().GetRunId()",
},
}
for _, tt := range testCases {
t.Run(tt.name, func(t *testing.T) {
rd := workflowTagGetters(tt.reqT, 0)
if tt.workflowIDGetter != "" {
assert.Equal(t, tt.workflowIDGetter, rd.WorkflowIdGetter)
}
if tt.runIDGetter != "" {
assert.Equal(t, tt.runIDGetter, rd.RunIdGetter)
}
if tt.taskTokenGetter != "" {
assert.Equal(t, tt.taskTokenGetter, rd.TaskTokenGetter)
}
})
}
}