diff --git a/tests/task_queue_stats_test.go b/tests/task_queue_stats_test.go index d4d658ad2f..393587f9ae 100644 --- a/tests/task_queue_stats_test.go +++ b/tests/task_queue_stats_test.go @@ -1573,7 +1573,7 @@ func (s *taskQueueStatsSuite) validateDescribeWorkerDeploymentVersion( req.ReportTaskQueueStats = true resp, err := s.FrontendClient().DescribeWorkerDeploymentVersion(ctx, req) - require.NoError(s.T(), err) + a.NoError(err) a.Len(resp.VersionTaskQueues, 2, "should be 1 task queue for Workflows and 1 for Activities") for _, info := range resp.VersionTaskQueues { diff --git a/tests/xdc/history_replication_signals_and_updates_test.go b/tests/xdc/history_replication_signals_and_updates_test.go index 28f0cfdce2..3a7cde3006 100644 --- a/tests/xdc/history_replication_signals_and_updates_test.go +++ b/tests/xdc/history_replication_signals_and_updates_test.go @@ -1046,7 +1046,7 @@ func (c *hrsuTestCluster) getHistoryForRunId(ctx context.Context, runId string) } func (c *hrsuTestCluster) pollWorkflowResult(ctx context.Context, runId string) *historypb.HistoryEvent { - getHistoryWithLongPoll := func(token []byte) ([]*historypb.HistoryEvent, []byte) { + getHistoryWithLongPoll := func(token []byte) ([]*historypb.HistoryEvent, []byte, error) { responseInner, err := c.testCluster.FrontendClient().GetWorkflowExecutionHistory(ctx, &workflowservice.GetWorkflowExecutionHistoryRequest{ Namespace: c.t.tv.NamespaceName().String(), Execution: &commonpb.WorkflowExecution{ @@ -1058,25 +1058,33 @@ func (c *hrsuTestCluster) pollWorkflowResult(ctx context.Context, runId string) NextPageToken: token, HistoryEventFilterType: enumspb.HISTORY_EVENT_FILTER_TYPE_CLOSE_EVENT, }) - c.t.s.NoError(err) - return responseInner.History.Events, responseInner.NextPageToken + if err != nil { + return nil, nil, err + } + return responseInner.History.Events, responseInner.NextPageToken, nil } var token []byte var allEvents []*historypb.HistoryEvent - multiPoll := false for { - events, nextPageToken := getHistoryWithLongPoll(token) + if ctx.Err() != nil { + c.t.s.NoError(ctx.Err(), "context expired while waiting for workflow result") + return nil + } + events, nextPageToken, err := getHistoryWithLongPoll(token) + if err != nil { + // Transient error (e.g. CurrentBranchChanged after conflict resolution): retry from scratch. + token = nil + continue + } allEvents = append(allEvents, events...) if nextPageToken == nil { break } token = nextPageToken - multiPoll = true } c.t.s.Len(allEvents, 1) - c.t.s.True(multiPoll, "Expected to have multiple polls of history events") return allEvents[0] }