Skip to content

Commit f052c1a

Browse files
committed
Add test
1 parent 02971b9 commit f052c1a

File tree

3 files changed

+51
-5
lines changed

3 files changed

+51
-5
lines changed

go.mod

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ module github.com/temporalio/cli
22

33
go 1.24.5
44

5-
toolchain go1.24.6
6-
75
require (
86
github.com/BurntSushi/toml v1.4.0
97
github.com/alitto/pond v1.9.2
@@ -21,7 +19,7 @@ require (
2119
go.temporal.io/api v1.52.0
2220
go.temporal.io/sdk v1.35.0
2321
go.temporal.io/sdk/contrib/envconfig v0.1.0
24-
go.temporal.io/server v1.29.0-139.2
22+
go.temporal.io/server v1.29.0-139.3
2523
google.golang.org/grpc v1.72.2
2624
google.golang.org/protobuf v1.36.6
2725
gopkg.in/yaml.v3 v3.0.1

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -408,8 +408,8 @@ go.temporal.io/sdk v1.35.0 h1:lRNAQ5As9rLgYa7HBvnmKyzxLcdElTuoFJ0FXM/AsLQ=
408408
go.temporal.io/sdk v1.35.0/go.mod h1:1q5MuLc2MEJ4lneZTHJzpVebW2oZnyxoIOWX3oFVebw=
409409
go.temporal.io/sdk/contrib/envconfig v0.1.0 h1:s+G/Ujph+Xl2jzLiiIm2T1vuijDkUL4Kse49dgDVGBE=
410410
go.temporal.io/sdk/contrib/envconfig v0.1.0/go.mod h1:FQEO3C56h9C7M6sDgSanB8HnBTmopw9qgVx4F1S6pJk=
411-
go.temporal.io/server v1.29.0-139.2 h1:chcQNcLX9rLj0JyEKG7+iN9+ysHLJ/g0DVJygN4aZFE=
412-
go.temporal.io/server v1.29.0-139.2/go.mod h1:OKFCSB0xxCX1Bmi2rYutWJEKppIrwuqx+c3e5GeY54w=
411+
go.temporal.io/server v1.29.0-139.3 h1:j4u7esLvLqzE67Q6s/ExvaFKOensFhskCWXe1VHyBdU=
412+
go.temporal.io/server v1.29.0-139.3/go.mod h1:OKFCSB0xxCX1Bmi2rYutWJEKppIrwuqx+c3e5GeY54w=
413413
go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ=
414414
go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
415415
go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE=

temporalcli/commands.workflow_exec_test.go

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import (
1717
"github.com/google/uuid"
1818
"go.temporal.io/api/common/v1"
1919
"go.temporal.io/api/enums/v1"
20+
"go.temporal.io/api/history/v1"
2021
"go.temporal.io/api/workflowservice/v1"
2122
"go.temporal.io/sdk/client"
2223
"go.temporal.io/sdk/converter"
@@ -953,3 +954,50 @@ func (s *SharedServerSuite) testStartUpdateWithStartHelper(opts updateWithStartT
953954
s.Equal(opts.expectedWfOutput["workflow"], wfReturn["workflow"])
954955
s.Equal(opts.expectedWfOutput["update"], wfReturn["update"])
955956
}
957+
958+
func (s *SharedServerSuite) TestWorkflow_Start_WithPriorityOptions() {
959+
s.Worker().OnDevWorkflow(func(ctx workflow.Context, input any) (any, error) {
960+
return "success", nil
961+
})
962+
963+
workflowId := "priority-test-" + uuid.New().String()
964+
res := s.Execute(
965+
"workflow", "start",
966+
"--address", s.Address(),
967+
"--task-queue", s.Worker().Options.TaskQueue,
968+
"--type", "DevWorkflow",
969+
"--workflow-id", workflowId,
970+
"--priority-key", "2",
971+
"--fairness-key", "high-priority-tenant",
972+
"--fairness-weight", "5.5",
973+
)
974+
s.NoError(res.Err)
975+
976+
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
977+
defer cancel()
978+
979+
iter := s.Client.GetWorkflowHistory(ctx,
980+
workflowId, "", false, enums.HISTORY_EVENT_FILTER_TYPE_ALL_EVENT)
981+
982+
var startedEvent *history.HistoryEvent
983+
for iter.HasNext() {
984+
event, err := iter.Next()
985+
s.NoError(err)
986+
if event.EventType == enums.EVENT_TYPE_WORKFLOW_EXECUTION_STARTED {
987+
startedEvent = event
988+
break
989+
}
990+
}
991+
992+
s.NotNil(startedEvent, "WorkflowExecutionStarted event not found")
993+
994+
startedAttrs := startedEvent.GetWorkflowExecutionStartedEventAttributes()
995+
s.NotNil(startedAttrs, "WorkflowExecutionStarted attributes not found")
996+
997+
priority := startedAttrs.GetPriority()
998+
s.NotNil(priority, "Priority not found in WorkflowExecutionStarted event")
999+
1000+
s.Equal(int32(2), priority.GetPriorityKey())
1001+
s.Equal("high-priority-tenant", priority.GetFairnessKey())
1002+
s.Equal(float32(5.5), priority.GetFairnessWeight())
1003+
}

0 commit comments

Comments
 (0)