From dedfd5bc7c23f19ba0ff2f5815ac493465846113 Mon Sep 17 00:00:00 2001 From: Stephan Behnke Date: Thu, 29 Feb 2024 14:05:21 -0800 Subject: [PATCH] fix `batch terminate` test --- temporalcli/commands.batch_test.go | 34 ++++++++++++++++++------------ 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/temporalcli/commands.batch_test.go b/temporalcli/commands.batch_test.go index eba6b72e..b308e557 100644 --- a/temporalcli/commands.batch_test.go +++ b/temporalcli/commands.batch_test.go @@ -185,12 +185,16 @@ func (s *SharedServerSuite) TestBatchJob_Terminate() { jobId := "TestBatchJob_Terminate_Text" s.startBatchJob(jobId, s.Namespace()) - res := s.Execute( - "batch", "terminate", - "--address", s.Address(), - "--job-id", jobId, - "--reason", "testing") - s.NoError(res.Err) + var res *CommandResult + s.Eventually(func() bool { + res = s.Execute( + "batch", "terminate", + "--address", s.Address(), + "--job-id", jobId, + "--reason", "testing") + return res.Err == nil + }, 5*time.Second, 100*time.Millisecond) + s.Empty(res.Stderr.String()) s.Equal("Terminated Batch Job '"+jobId+"'\n", res.Stdout.String()) }) @@ -199,13 +203,17 @@ func (s *SharedServerSuite) TestBatchJob_Terminate() { jobId := "TestBatchJob_Terminate_JSON" s.startBatchJob(jobId, s.Namespace()) - res := s.Execute( - "batch", "terminate", - "--address", s.Address(), - "--job-id", jobId, - "--reason", "testing", - "-o", "json") - s.NoError(res.Err) + var res *CommandResult + s.Eventually(func() bool { + res = s.Execute( + "batch", "terminate", + "--address", s.Address(), + "--job-id", jobId, + "--reason", "testing", + "-o", "json") + return res.Err == nil + }, 5*time.Second, 100*time.Millisecond) + s.Empty(res.Stderr.String()) s.Empty(res.Stdout.String()) })