Skip to content

Commit

Permalink
WithTimeout to cap time spent asking to describe
Browse files Browse the repository at this point in the history
  • Loading branch information
serprex committed Feb 29, 2024
1 parent ddcdfb1 commit 4dca5c0
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions flow/e2e/test_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ func EnvWaitForEqualTablesWithNames(

func RequireEnvCanceled(t *testing.T, env WorkflowRun) {
t.Helper()
EnvWaitFor(t, env, time.Minute, "canceling", env.Finished)
EnvWaitForFinished(t, env, time.Minute)
err := env.Error()
var panicErr *temporal.PanicError
var canceledErr *temporal.CanceledError
Expand Down Expand Up @@ -637,7 +637,9 @@ func EnvWaitForFinished(t *testing.T, env WorkflowRun, timeout time.Duration) {
t.Helper()

EnvWaitFor(t, env, timeout, "finish", func() bool {
desc, err := env.c.DescribeWorkflowExecution(context.Background(), env.GetID(), "")
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()
desc, err := env.c.DescribeWorkflowExecution(ctx, env.GetID(), "")
if err != nil {
t.Log("Not finished", err)
return false
Expand Down

0 comments on commit 4dca5c0

Please sign in to comment.