mirror of
https://github.com/hanzoai/tasks.git
synced 2026-11-03 03:56:04 +00:00
Full module path rebrand from Temporal to Hanzo Tasks: - go.mod module: github.com/hanzoai/tasks - All internal Go imports updated (1906 files) - cmd/server renamed to cmd/tasksd - Binary name: tasksd (was temporal-server) - Docker images: hanzoai/tasks (was temporalio/server) - README rewritten with Hanzo Tasks branding - LLM.md created with integration notes - Makefile, goreleaser, CI workflows updated - go.temporal.io/sdk and go.temporal.io/api imports preserved (separate repos) Fork of Temporal.io (MIT license).
122 lines
2.6 KiB
Go
122 lines
2.6 KiB
Go
package protoassert_test
|
|
|
|
import (
|
|
"testing"
|
|
|
|
commonpb "go.temporal.io/api/common/v1"
|
|
workflowpb "go.temporal.io/api/workflow/v1"
|
|
"github.com/hanzoai/tasks/common/testing/protoassert"
|
|
)
|
|
|
|
const myUUID = "deb7b204-b384-4fde-85c6-e5a56c42336a"
|
|
|
|
type noProtoNoCry struct {
|
|
A float64
|
|
B string
|
|
C []bool
|
|
}
|
|
|
|
type canHazProto struct {
|
|
A float64
|
|
B *commonpb.WorkflowExecution
|
|
}
|
|
|
|
func TestProtoElementsMatch(t *testing.T) {
|
|
assert := protoassert.New(t)
|
|
for _, tc := range []struct {
|
|
Name string
|
|
A any
|
|
B any
|
|
}{{
|
|
Name: "Shallow proto object - in order",
|
|
A: []*commonpb.WorkflowExecution{{
|
|
WorkflowId: "some random workflow ID",
|
|
RunId: myUUID,
|
|
}, {
|
|
WorkflowId: "second workflow",
|
|
RunId: myUUID,
|
|
}},
|
|
B: []*commonpb.WorkflowExecution{{
|
|
WorkflowId: "some random workflow ID",
|
|
RunId: myUUID,
|
|
}, {
|
|
WorkflowId: "second workflow",
|
|
RunId: myUUID,
|
|
}},
|
|
}, {
|
|
Name: "Shallow proto object - out of order",
|
|
A: []*commonpb.WorkflowExecution{{
|
|
WorkflowId: "some random workflow ID",
|
|
RunId: myUUID,
|
|
}, {
|
|
WorkflowId: "second workflow",
|
|
RunId: myUUID,
|
|
}},
|
|
B: []*commonpb.WorkflowExecution{{
|
|
WorkflowId: "second workflow",
|
|
RunId: myUUID,
|
|
}, {
|
|
WorkflowId: "some random workflow ID",
|
|
RunId: myUUID,
|
|
}},
|
|
}, {
|
|
Name: "Structs containing proto",
|
|
A: []canHazProto{{
|
|
A: 13,
|
|
B: &commonpb.WorkflowExecution{
|
|
WorkflowId: "some random workflow ID",
|
|
RunId: myUUID,
|
|
},
|
|
}, {
|
|
A: 12,
|
|
B: &commonpb.WorkflowExecution{
|
|
WorkflowId: "second random workflow ID",
|
|
RunId: myUUID,
|
|
},
|
|
}},
|
|
B: []canHazProto{{
|
|
A: 12,
|
|
B: &commonpb.WorkflowExecution{
|
|
WorkflowId: "second random workflow ID",
|
|
RunId: myUUID,
|
|
},
|
|
}, {
|
|
A: 13,
|
|
B: &commonpb.WorkflowExecution{
|
|
WorkflowId: "some random workflow ID",
|
|
RunId: myUUID,
|
|
},
|
|
}},
|
|
}, {
|
|
Name: "Nested proto struct",
|
|
A: []*workflowpb.WorkflowExecutionInfo{
|
|
{
|
|
Execution: &commonpb.WorkflowExecution{
|
|
WorkflowId: "some random workflow ID",
|
|
RunId: myUUID,
|
|
},
|
|
}, {
|
|
Execution: &commonpb.WorkflowExecution{
|
|
WorkflowId: "second random workflow ID",
|
|
RunId: myUUID,
|
|
},
|
|
}},
|
|
B: []*workflowpb.WorkflowExecutionInfo{
|
|
{
|
|
Execution: &commonpb.WorkflowExecution{
|
|
WorkflowId: "second random workflow ID",
|
|
RunId: myUUID,
|
|
},
|
|
}, {
|
|
Execution: &commonpb.WorkflowExecution{
|
|
WorkflowId: "some random workflow ID",
|
|
RunId: myUUID,
|
|
},
|
|
}},
|
|
}} {
|
|
if !assert.ProtoElementsMatch(tc.A, tc.B) {
|
|
t.Errorf("%s: expected equality", tc.Name)
|
|
}
|
|
}
|
|
}
|