Skip to content

Commit

Permalink
Fixes Dynamic Configuration bug where TaskType Constraint match alway…
Browse files Browse the repository at this point in the history
…s failed (#898)
  • Loading branch information
mastermanu authored and wxing1292 committed Oct 26, 2020
1 parent c45ad91 commit 1eafb88
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 1 deletion.
10 changes: 10 additions & 0 deletions common/service/dynamicconfig/config/testConfig.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,16 @@ testGetIntPropertyKey:
- value: 1000.1
constraints:
namespace: global-samples-namespace
- value: 1001
constraints:
namespace: global-samples-namespace
taskQueueName: test-tq
taskType: "Workflow"
- value: 1002
constraints:
namespace: global-samples-namespace
taskQueueName: test-tq
taskType: "Activity"
testGetMapPropertyKey:
- value:
key1: "1"
Expand Down
2 changes: 1 addition & 1 deletion common/service/dynamicconfig/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -870,7 +870,7 @@ func NamespaceIDFilter(namespaceID string) FilterOption {
// TaskTypeFilter filters by task type
func TaskTypeFilter(taskType enumspb.TaskQueueType) FilterOption {
return func(filterMap map[Filter]interface{}) {
filterMap[TaskType] = taskType
filterMap[TaskType] = enumspb.TaskQueueType_name[int32(taskType)]
}
}

Expand Down
24 changes: 24 additions & 0 deletions common/service/dynamicconfig/fileBasedClient_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,30 @@ func (s *fileBasedClientSuite) TestGetIntValue_WrongType() {
s.Equal(defaultValue, v)
}

func (s *fileBasedClientSuite) TestGetIntValue_FilteredByWorkflowTaskQueueInfo() {
expectedValue := 1001
filters := map[Filter]interface{}{
Namespace: "global-samples-namespace",
TaskQueueName: "test-tq",
TaskType: "Workflow",
}
v, err := s.client.GetIntValue(testGetIntPropertyKey, filters, 0)
s.NoError(err)
s.Equal(expectedValue, v)
}

func (s *fileBasedClientSuite) TestGetIntValue_FilteredByActivityTaskQueueInfo() {
expectedValue := 1002
filters := map[Filter]interface{}{
Namespace: "global-samples-namespace",
TaskQueueName: "test-tq",
TaskType: "Activity",
}
v, err := s.client.GetIntValue(testGetIntPropertyKey, filters, 0)
s.NoError(err)
s.Equal(expectedValue, v)
}

func (s *fileBasedClientSuite) TestGetFloatValue() {
v, err := s.client.GetFloatValue(testGetFloat64PropertyKey, nil, 1)
s.NoError(err)
Expand Down

0 comments on commit 1eafb88

Please sign in to comment.