From 4dfd72e58d9acf0d6c0ce24dee89c75b45288752 Mon Sep 17 00:00:00 2001 From: Shijie Sheng Date: Mon, 24 Jun 2024 10:49:23 -0700 Subject: [PATCH] [CLI] add new valid search attribute key cases for context header indexing in visibility --- tools/cli/admin_cluster_commands.go | 2 +- tools/cli/admin_cluster_commands_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/cli/admin_cluster_commands.go b/tools/cli/admin_cluster_commands.go index 31ee52b53c1..0f5c1fb106e 100644 --- a/tools/cli/admin_cluster_commands.go +++ b/tools/cli/admin_cluster_commands.go @@ -36,7 +36,7 @@ import ( // An indirection for the prompt function so that it can be mocked in the unit tests var promptFn = prompt -var validSearchAttributeKey = regexp.MustCompile(`^[a-zA-Z][a-zA-Z_0-9]*$`) +var validSearchAttributeKey = regexp.MustCompile(`^[a-zA-Z][a-zA-Z_.-0-9]*$`) // AdminAddSearchAttribute to whitelist search attribute func AdminAddSearchAttribute(c *cli.Context) { diff --git a/tools/cli/admin_cluster_commands_test.go b/tools/cli/admin_cluster_commands_test.go index 8e6cdd67b58..c0ece6f8437 100644 --- a/tools/cli/admin_cluster_commands_test.go +++ b/tools/cli/admin_cluster_commands_test.go @@ -126,8 +126,8 @@ func TestValidSearchAttributeKey(t *testing.T) { assert.NoError(t, validateSearchAttributeKey("cityId")) assert.NoError(t, validateSearchAttributeKey("paymentProfileUUID")) assert.NoError(t, validateSearchAttributeKey("job_type")) + assert.NoError(t, validateSearchAttributeKey("Header.ctx-tenancy")) - assert.Error(t, validateSearchAttributeKey("payments-biling-invoices-TransactionUUID")) assert.Error(t, validateSearchAttributeKey("9lives")) assert.Error(t, validateSearchAttributeKey("tax%")) }