Skip to content

Commit 1eafb88

Browse files
mastermanuwxing1292
authored andcommitted
Fixes Dynamic Configuration bug where TaskType Constraint match always failed (#898)
1 parent c45ad91 commit 1eafb88

File tree

3 files changed

+35
-1
lines changed

3 files changed

+35
-1
lines changed

common/service/dynamicconfig/config/testConfig.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,16 @@ testGetIntPropertyKey:
3333
- value: 1000.1
3434
constraints:
3535
namespace: global-samples-namespace
36+
- value: 1001
37+
constraints:
38+
namespace: global-samples-namespace
39+
taskQueueName: test-tq
40+
taskType: "Workflow"
41+
- value: 1002
42+
constraints:
43+
namespace: global-samples-namespace
44+
taskQueueName: test-tq
45+
taskType: "Activity"
3646
testGetMapPropertyKey:
3747
- value:
3848
key1: "1"

common/service/dynamicconfig/constants.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -870,7 +870,7 @@ func NamespaceIDFilter(namespaceID string) FilterOption {
870870
// TaskTypeFilter filters by task type
871871
func TaskTypeFilter(taskType enumspb.TaskQueueType) FilterOption {
872872
return func(filterMap map[Filter]interface{}) {
873-
filterMap[TaskType] = taskType
873+
filterMap[TaskType] = enumspb.TaskQueueType_name[int32(taskType)]
874874
}
875875
}
876876

common/service/dynamicconfig/fileBasedClient_test.go

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,30 @@ func (s *fileBasedClientSuite) TestGetIntValue_WrongType() {
136136
s.Equal(defaultValue, v)
137137
}
138138

139+
func (s *fileBasedClientSuite) TestGetIntValue_FilteredByWorkflowTaskQueueInfo() {
140+
expectedValue := 1001
141+
filters := map[Filter]interface{}{
142+
Namespace: "global-samples-namespace",
143+
TaskQueueName: "test-tq",
144+
TaskType: "Workflow",
145+
}
146+
v, err := s.client.GetIntValue(testGetIntPropertyKey, filters, 0)
147+
s.NoError(err)
148+
s.Equal(expectedValue, v)
149+
}
150+
151+
func (s *fileBasedClientSuite) TestGetIntValue_FilteredByActivityTaskQueueInfo() {
152+
expectedValue := 1002
153+
filters := map[Filter]interface{}{
154+
Namespace: "global-samples-namespace",
155+
TaskQueueName: "test-tq",
156+
TaskType: "Activity",
157+
}
158+
v, err := s.client.GetIntValue(testGetIntPropertyKey, filters, 0)
159+
s.NoError(err)
160+
s.Equal(expectedValue, v)
161+
}
162+
139163
func (s *fileBasedClientSuite) TestGetFloatValue() {
140164
v, err := s.client.GetFloatValue(testGetFloat64PropertyKey, nil, 1)
141165
s.NoError(err)

0 commit comments

Comments
 (0)