Skip to content
Open
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
34 changes: 34 additions & 0 deletions internal/temporalcli/commands.activity_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1335,3 +1335,37 @@ func (s *SharedServerSuite) TestActivity_List_Pagination() {
s.NoError(res.Err)
s.Equal(3, strings.Count(res.Stdout.String(), "page-test-"))
}

func (s *SharedServerSuite) TestActivity_Terminate_DefaultReason_NoUnknownUser() {
activityStarted := make(chan struct{})
s.Worker().OnDevActivity(func(ctx context.Context, a any) (any, error) {
close(activityStarted)
<-ctx.Done()
return nil, ctx.Err()
})

started := s.startActivity("terminate-default-reason-test")
runID := started["runId"].(string)
<-activityStarted

res := s.Execute(
"activity", "terminate",
"--activity-id", "terminate-default-reason-test",
"--run-id", runID,
"--address", s.Address(),
)
s.NoError(res.Err)

res = s.Execute(
"activity", "result", "-o", "json",
"--activity-id", "terminate-default-reason-test",
"--run-id", runID,
"--address", s.Address(),
)
s.Error(res.Err)
var outcome map[string]any
s.NoError(json.Unmarshal(res.Stdout.Bytes(), &outcome))
failureMsg, _ := outcome["failure"].(map[string]any)["message"].(string)
s.Contains(failureMsg, "Requested from CLI by")
s.NotContains(failureMsg, "<unknown-user>")
}
2 changes: 1 addition & 1 deletion internal/temporalcli/commands.workflow.go
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@ func workflowUpdateHelper(cctx *CommandContext,

func username() string {
username := "<unknown-user>"
if u, err := user.Current(); err != nil && u.Username != "" {
if u, err := user.Current(); err == nil && u.Username != "" {
username = u.Username
}
return username
Expand Down
Loading