@@ -291,7 +291,7 @@ func (s *ElasticSearchIntegrationSuite) TestListWorkflow_SearchAttribute() {
291291 we , err := s .Engine .StartWorkflowExecution (ctx , request )
292292 s .Nil (err )
293293 query := fmt .Sprintf (`WorkflowID = "%s" and %s = "%s"` , id , s .testSearchAttributeKey , s .testSearchAttributeVal )
294- s .testHelperForReadOnce (we .GetRunID (), query , false , false )
294+ s .testHelperForReadOnceWithTestSearchAttributes (we .GetRunID (), query , false , false , true )
295295
296296 // test upsert
297297 dtHandler := func (execution * types.WorkflowExecution , wt * types.WorkflowType ,
@@ -767,10 +767,14 @@ func (s *ElasticSearchIntegrationSuite) testListWorkflowHelper(numOfWorkflows, p
767767}
768768
769769func (s * ElasticSearchIntegrationSuite ) testHelperForReadOnce (runID , query string , isScan bool , isAnyMatchOk bool ) {
770- s .testHelperForReadOnceWithDomain (s .DomainName , runID , query , isScan , isAnyMatchOk )
770+ s .testHelperForReadOnceWithTestSearchAttributes (runID , query , isScan , isAnyMatchOk , false )
771+ }
772+
773+ func (s * ElasticSearchIntegrationSuite ) testHelperForReadOnceWithTestSearchAttributes (runID , query string , isScan bool , isAnyMatchOk bool , checkTestSearchAttr bool ) {
774+ s .testHelperForReadOnceWithDomain (s .DomainName , runID , query , isScan , isAnyMatchOk , checkTestSearchAttr )
771775}
772776
773- func (s * ElasticSearchIntegrationSuite ) testHelperForReadOnceWithDomain (domainName string , runID , query string , isScan bool , isAnyMatchOk bool ) {
777+ func (s * ElasticSearchIntegrationSuite ) testHelperForReadOnceWithDomain (domainName string , runID , query string , isScan bool , isAnyMatchOk bool , checkTestSearchAttr bool ) {
774778 var openExecution * types.WorkflowExecutionInfo
775779 listRequest := & types.ListWorkflowExecutionsRequest {
776780 Domain : domainName ,
@@ -814,8 +818,12 @@ Retry:
814818 s .NotNil (openExecution )
815819 s .Equal (runID , openExecution .GetExecution ().GetRunID ())
816820 s .True (openExecution .GetExecutionTime () >= openExecution .GetStartTime ())
817- if openExecution .SearchAttributes != nil && len (openExecution .SearchAttributes .GetIndexedFields ()) > 0 {
821+ if checkTestSearchAttr {
822+ // Test explicitly expects the test search attribute to be present
823+ s .NotNil (openExecution .SearchAttributes )
824+ s .True (len (openExecution .SearchAttributes .GetIndexedFields ()) > 0 )
818825 searchValBytes := openExecution .SearchAttributes .GetIndexedFields ()[s .testSearchAttributeKey ]
826+ s .NotNil (searchValBytes )
819827 var searchVal string
820828 json .Unmarshal (searchValBytes , & searchVal )
821829 s .Equal (s .testSearchAttributeVal , searchVal )
@@ -873,7 +881,7 @@ func (s *ElasticSearchIntegrationSuite) TestScanWorkflow_SearchAttribute() {
873881 we , err := s .Engine .StartWorkflowExecution (ctx , request )
874882 s .Nil (err )
875883 query := fmt .Sprintf (`WorkflowID = "%s" and %s = "%s"` , id , s .testSearchAttributeKey , s .testSearchAttributeVal )
876- s .testHelperForReadOnce (we .GetRunID (), query , true , false )
884+ s .testHelperForReadOnceWithTestSearchAttributes (we .GetRunID (), query , true , false , true )
877885}
878886
879887func (s * ElasticSearchIntegrationSuite ) TestScanWorkflow_PageToken () {
0 commit comments