Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix flaky test #1201

Merged
merged 4 commits into from
Dec 5, 2022
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 13 additions & 0 deletions test/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,12 @@ func (ts *IntegrationTestSuite) TestChildWFWithParentClosePolicyTerminate() {
ts.NoError(err)
resp, err := ts.libClient.DescribeWorkflowExecution(context.Background(), childWorkflowID, "")
ts.NoError(err)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably not necessary any more? I don't think GetWorkflow needs a runid anyway...

// Need to wait for child workflow to finish as well otherwise test becomes flaky
ts.waitForWorkflowFinish(resp.WorkflowExecutionInfo.Execution.GetWorkflowId(), resp.WorkflowExecutionInfo.Execution.GetRunId())
resp, err = ts.libClient.DescribeWorkflowExecution(context.Background(), childWorkflowID, "")
ts.NoError(err)
ts.True(resp.WorkflowExecutionInfo.GetCloseTime() > 0)

}

func (ts *IntegrationTestSuite) TestChildWFWithParentClosePolicyAbandon() {
Expand Down Expand Up @@ -581,6 +586,14 @@ func (ts *IntegrationTestSuite) registerWorkflowsAndActivities(w worker.Worker)
ts.activities.register(w)
}

func (ts *IntegrationTestSuite) waitForWorkflowFinish(wid string, runId string) error {
ctx, cancel := context.WithTimeout(context.Background(), ctxTimeout)
defer cancel()
wfRun := ts.libClient.GetWorkflow(ctx, wid, runId)
var val interface{}
return wfRun.Get(ctx, &val)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
var val interface{}
return wfRun.Get(ctx, &val)
return wfRun.Get(ctx, nil)

}

var _ interceptors.WorkflowInterceptorFactory = (*tracingInterceptorFactory)(nil)

type tracingInterceptorFactory struct {
Expand Down