From ab30c8a4d3013db79779c7fdb2b5bb1d9098be3c Mon Sep 17 00:00:00 2001 From: Bowei Xu Date: Tue, 19 Jun 2018 17:34:39 -0700 Subject: [PATCH] Fix flaky TestClientDataConverter_Failed (#865) --- host/client_integration_test.go | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/host/client_integration_test.go b/host/client_integration_test.go index 443dab89dbb..c8637e0a757 100644 --- a/host/client_integration_test.go +++ b/host/client_integration_test.go @@ -327,20 +327,21 @@ func (s *clientIntegrationSuite) TestClientDataConverter_Failed() { // Get history to make sure only the 2nd activity is failed because of mismatch of data converter iter := s.wfClient.GetWorkflowHistory(ctx, id, we.GetRunID(), false, 0) - cnt := 0 + completedAct := 0 + failedAct := 0 for iter.HasNext() { - cnt++ event, _ := iter.Next() - if event.GetEventId() == 7 { - s.Equal(shared.EventTypeActivityTaskCompleted, event.GetEventType()) + if event.GetEventType() == shared.EventTypeActivityTaskCompleted { + completedAct++ } - if event.GetEventId() == 13 { - s.Equal(shared.EventTypeActivityTaskFailed, event.GetEventType()) + if event.GetEventType() == shared.EventTypeActivityTaskFailed { + failedAct++ attr := event.ActivityTaskFailedEventAttributes s.True(strings.HasPrefix(string(attr.Details), "unable to decode the activity function input bytes with error")) } } - s.True(cnt >= 13) + s.Equal(1, completedAct) + s.Equal(1, failedAct) } var childTaskList = "client-integration-data-converter-child-tasklist"