Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ListBatchJobs unit-test for Go 1.23+ #6547

Merged
merged 1 commit into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions tools/cli/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -553,11 +553,11 @@ func timestampPtrToStringPtr(unixNanoPtr *int64, onlyTime bool) *string {
if unixNanoPtr == nil {
return nil
}
return common.StringPtr(convertTime(*unixNanoPtr, onlyTime))
return common.StringPtr(timestampToString(*unixNanoPtr, onlyTime))
}

func convertTime(unixNano int64, onlyTime bool) string {
t := time.Unix(0, unixNano)
func timestampToString(unixNano int64, onlyTime bool) string {
t := time.Unix(0, unixNano).UTC()
var result string
if onlyTime {
result = t.Format(defaultTimeFormat)
Expand Down
4 changes: 2 additions & 2 deletions tools/cli/workflow_batch_commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,14 +165,14 @@ func ListBatchJobs(c *cli.Context) error {
for _, wf := range resp.Executions {
job := map[string]string{
"jobID": wf.Execution.GetWorkflowID(),
"startTime": convertTime(wf.GetStartTime(), false),
"startTime": timestampToString(wf.GetStartTime(), false),
"reason": string(wf.Memo.Fields["Reason"]),
"operator": string(wf.SearchAttributes.IndexedFields["Operator"]),
}

if wf.CloseStatus != nil {
job["status"] = wf.CloseStatus.String()
job["closeTime"] = convertTime(wf.GetCloseTime(), false)
job["closeTime"] = timestampToString(wf.GetCloseTime(), false)
} else {
job["status"] = "RUNNING"
}
Expand Down
10 changes: 5 additions & 5 deletions tools/cli/workflow_commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ func showHistoryHelper(c *cli.Context, wid, rid string) error {
if printRawTime {
columns = append(columns, strconv.FormatInt(e.GetTimestamp(), 10))
} else if printDateTime {
columns = append(columns, convertTime(e.GetTimestamp(), false))
columns = append(columns, timestampToString(e.GetTimestamp(), false))
}
if printVersion {
columns = append(columns, fmt.Sprintf("(Version: %v)", e.Version))
Expand Down Expand Up @@ -604,9 +604,9 @@ func printWorkflowProgress(c *cli.Context, domain, wid, rid string) error {
isTimeElapseExist = false
}
if showDetails {
fmt.Printf(" %d, %s, %s, %s\n", event.ID, convertTime(event.GetTimestamp(), false), ColorEvent(event), HistoryEventToString(event, true, maxFieldLength))
fmt.Printf(" %d, %s, %s, %s\n", event.ID, timestampToString(event.GetTimestamp(), false), ColorEvent(event), HistoryEventToString(event, true, maxFieldLength))
} else {
fmt.Printf(" %d, %s, %s\n", event.ID, convertTime(event.GetTimestamp(), false), ColorEvent(event))
fmt.Printf(" %d, %s, %s\n", event.ID, timestampToString(event.GetTimestamp(), false), ColorEvent(event))
}
lastEvent = event
}
Expand Down Expand Up @@ -1177,8 +1177,8 @@ func convertDescribeWorkflowExecutionResponse(resp *types.DescribeWorkflowExecut
executionInfo := workflowExecutionInfo{
Execution: info.Execution,
Type: info.Type,
StartTime: common.StringPtr(convertTime(info.GetStartTime(), false)),
CloseTime: common.StringPtr(convertTime(info.GetCloseTime(), false)),
StartTime: common.StringPtr(timestampToString(info.GetStartTime(), false)),
CloseTime: common.StringPtr(timestampToString(info.GetCloseTime(), false)),
CloseStatus: info.CloseStatus,
HistoryLength: info.HistoryLength,
ParentDomainID: info.ParentDomainID,
Expand Down
Loading