diff --git a/temporalcli/commands.activity.go b/temporalcli/commands.activity.go index c3b1015f..401150bf 100644 --- a/temporalcli/commands.activity.go +++ b/temporalcli/commands.activity.go @@ -271,10 +271,22 @@ func (c *TemporalActivityResetCommand) run(cctx *CommandContext, args []string) ResetHeartbeat: c.ResetHeartbeats, } - _, err = cl.WorkflowService().ResetActivityById(cctx, request) + resp, err := cl.WorkflowService().ResetActivityById(cctx, request) if err != nil { return fmt.Errorf("unable to reset an Activity: %w", err) } + resetResponse := struct { + NoWait bool + ResetHeartbeats bool + ServerResponse bool + }{ + ServerResponse: resp != nil, + NoWait: c.NoWait, + ResetHeartbeats: c.ResetHeartbeats, + } + + _ = cctx.Printer.PrintStructured(resetResponse, printer.StructuredOptions{}) + return nil } diff --git a/temporalcli/commands.activity_test.go b/temporalcli/commands.activity_test.go index 02c28c6e..fc2f3e4e 100644 --- a/temporalcli/commands.activity_test.go +++ b/temporalcli/commands.activity_test.go @@ -6,6 +6,7 @@ import ( "go.temporal.io/api/enums/v1" "go.temporal.io/api/history/v1" + "go.temporal.io/api/serviceerror" "go.temporal.io/sdk/client" ) @@ -247,6 +248,9 @@ func (s *SharedServerSuite) TestActivityReset() { ) s.NoError(res.Err) + // make sure we receive a server response + out := res.Stdout.String() + s.ContainsOnSameLine(out, "ServerResponse", "true") // reset should fail because activity is not found @@ -260,6 +264,9 @@ func (s *SharedServerSuite) TestActivityReset() { ) s.Error(res.Err) + // make sure we receive a NotFound error from the server` + var notFound *serviceerror.NotFound + s.ErrorAs(res.Err, ¬Found) } // Test helpers