From aa564e1c9cf6339a67de0237a9ce0e57479a5f24 Mon Sep 17 00:00:00 2001 From: Ktrops Date: Fri, 15 Nov 2024 09:54:33 -0800 Subject: [PATCH] IWF-324: adding keyword array to search attributes (#479) Co-authored-by: Katie Atrops --- docker-compose/init-ci-temporal.sh | 6 +++++- docker-compose/init-compose.sh | 4 +++- integ/set_search_attributes_test.go | 9 +++++++++ integ/workflow/persistence/routers.go | 15 ++++++++------- 4 files changed, 25 insertions(+), 9 deletions(-) diff --git a/docker-compose/init-ci-temporal.sh b/docker-compose/init-ci-temporal.sh index 7ad7eb66..a887f95a 100755 --- a/docker-compose/init-ci-temporal.sh +++ b/docker-compose/init-ci-temporal.sh @@ -30,8 +30,12 @@ for run in {1..120}; do sleep 0.1 temporal operator search-attribute create --name CustomStringField --type Text sleep 0.1 + temporal operator search-attribute create --name CustomKeywordArrayField --type KeywordList + sleep 0.1 + temporal operator search-attribute create --name CustomTextField --type Text + sleep 0.1 - if checkExists "IwfWorkflowType" ] && checkExists "IwfGlobalWorkflowVersion" && checkExists "IwfExecutingStateIds" && checkExists "CustomKeywordField" && checkExists "CustomIntField" && checkExists "CustomBoolField" && checkExists "CustomDoubleField" && checkExists "CustomDatetimeField" && checkExists "CustomStringField" ] ; then + if checkExists "IwfWorkflowType" ] && checkExists "IwfGlobalWorkflowVersion" && checkExists "IwfExecutingStateIds" && checkExists "CustomKeywordField" && checkExists "CustomIntField" && checkExists "CustomBoolField" && checkExists "CustomDoubleField" && checkExists "CustomDatetimeField" && checkExists "CustomStringField" && checkExists "CustomKeywordArrayField" ] ; then echo "All search attributes are registered" break fi diff --git a/docker-compose/init-compose.sh b/docker-compose/init-compose.sh index df454581..a3f45e53 100755 --- a/docker-compose/init-compose.sh +++ b/docker-compose/init-compose.sh @@ -19,7 +19,9 @@ for run in {1..60}; do sleep 0.1 temporal operator search-attribute create --name IwfExecutingStateIds --type KeywordList sleep 0.1 - if checkExists "IwfWorkflowType" ] && checkExists "IwfGlobalWorkflowVersion" && checkExists "IwfExecutingStateIds" ] ; then + temporal operator search-attribute create --name CustomKeywordArrayField --type KeywordList + sleep 0.1 + if checkExists "IwfWorkflowType" ] && checkExists "IwfGlobalWorkflowVersion" && checkExists "IwfExecutingStateIds" && checkExists "CustomKeywordArrayField" ] ; then echo "All search attributes are registered" break fi diff --git a/integ/set_search_attributes_test.go b/integ/set_search_attributes_test.go index 1cc03f10..4ab3782a 100644 --- a/integ/set_search_attributes_test.go +++ b/integ/set_search_attributes_test.go @@ -60,6 +60,11 @@ func TestSetSearchAttributes(t *testing.T) { Key: iwfidl.PtrString(persistence.TestSearchAttributeKeywordKey), ValueType: ptr.Any(iwfidl.KEYWORD), StringValue: iwfidl.PtrString(persistence.TestSearchAttributeKeywordValue1), + }, + iwfidl.SearchAttribute{ + Key: iwfidl.PtrString(persistence.TestSearchAttributeKeywordArrayKey), + ValueType: ptr.Any(iwfidl.KEYWORD_ARRAY), + StringArrayValue: []string{persistence.TestSearchAttributeKeywordValue2, persistence.TestSearchAttributeKeywordValue1}, }) setReq := apiClient.DefaultApi.ApiV1WorkflowSearchattributesSetPost(context.Background()) @@ -84,6 +89,10 @@ func TestSetSearchAttributes(t *testing.T) { Key: iwfidl.PtrString(persistence.TestSearchAttributeKeywordKey), ValueType: ptr.Any(iwfidl.KEYWORD), }, + { + Key: iwfidl.PtrString(persistence.TestSearchAttributeKeywordArrayKey), + ValueType: ptr.Any(iwfidl.KEYWORD_ARRAY), + }, }}).Execute() panicAtHttpError(err, httpRespGet) diff --git a/integ/workflow/persistence/routers.go b/integ/workflow/persistence/routers.go index 1f1331d4..d6134c3b 100644 --- a/integ/workflow/persistence/routers.go +++ b/integ/workflow/persistence/routers.go @@ -23,13 +23,14 @@ const ( TestSearchAttributeKeywordValue1 = "keyword-value1" TestSearchAttributeKeywordValue2 = "keyword-value2" - TestSearchAttributeIntKey = "CustomIntField" - TestSearchAttributeBoolKey = "CustomBoolField" - TestSearchAttributeDoubleKey = "CustomDoubleField" - TestSearchAttributeDatetimeKey = "CustomDatetimeField" - TestSearchAttributeTextKey = "CustomStringField" - TestSearchAttributeIntValue1 = 1 - TestSearchAttributeIntValue2 = 2 + TestSearchAttributeKeywordArrayKey = "CustomKeywordArrayField" + TestSearchAttributeIntKey = "CustomIntField" + TestSearchAttributeBoolKey = "CustomBoolField" + TestSearchAttributeDoubleKey = "CustomDoubleField" + TestSearchAttributeDatetimeKey = "CustomDatetimeField" + TestSearchAttributeTextKey = "CustomStringField" + TestSearchAttributeIntValue1 = 1 + TestSearchAttributeIntValue2 = 2 ) var TestDataObjectVal1 = iwfidl.EncodedObject{