Skip to content

Commit b67861e

Browse files
Fix flaky test (#1201)
fixing flaky integration test.
1 parent b4107d7 commit b67861e

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

test/integration_test.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -419,9 +419,12 @@ func (ts *IntegrationTestSuite) TestChildWFWithParentClosePolicyTerminate() {
419419
var childWorkflowID string
420420
err := ts.executeWorkflow("test-childwf-parent-close-policy", ts.workflows.ChildWorkflowSuccessWithParentClosePolicyTerminate, &childWorkflowID)
421421
ts.NoError(err)
422+
// Need to wait for child workflow to finish as well otherwise test becomes flaky
423+
ts.waitForWorkflowFinish(childWorkflowID, "")
422424
resp, err := ts.libClient.DescribeWorkflowExecution(context.Background(), childWorkflowID, "")
423425
ts.NoError(err)
424426
ts.True(resp.WorkflowExecutionInfo.GetCloseTime() > 0)
427+
425428
}
426429

427430
func (ts *IntegrationTestSuite) TestChildWFWithParentClosePolicyAbandon() {
@@ -581,6 +584,13 @@ func (ts *IntegrationTestSuite) registerWorkflowsAndActivities(w worker.Worker)
581584
ts.activities.register(w)
582585
}
583586

587+
func (ts *IntegrationTestSuite) waitForWorkflowFinish(wid string, runId string) error {
588+
ctx, cancel := context.WithTimeout(context.Background(), ctxTimeout)
589+
defer cancel()
590+
wfRun := ts.libClient.GetWorkflow(ctx, wid, runId)
591+
return wfRun.Get(ctx, nil)
592+
}
593+
584594
var _ interceptors.WorkflowInterceptorFactory = (*tracingInterceptorFactory)(nil)
585595

586596
type tracingInterceptorFactory struct {

0 commit comments

Comments
 (0)