diff --git a/common/service/dynamicconfig/config_test.go b/common/service/dynamicconfig/config_test.go index 30445983017..5c324f892bc 100644 --- a/common/service/dynamicconfig/config_test.go +++ b/common/service/dynamicconfig/config_test.go @@ -27,6 +27,7 @@ import ( "time" "github.com/sirupsen/logrus" + "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" "github.com/uber-common/bark" ) @@ -219,3 +220,18 @@ func (s *configSuite) TestGetDurationPropertyFilteredByTaskListInfo() { s.client.SetValue(key, time.Minute) s.Equal(time.Minute, value(domain, taskList, taskType)) } + +func TestDynamicConfigKeyIsMapped(t *testing.T) { + for i := unknownKey; i < lastKeyForTest; i++ { + key, ok := keys[i] + require.True(t, ok) + require.NotEmpty(t, key) + } +} + +func TestDynamicConfigFilterTypeIsMapped(t *testing.T) { + require.Equal(t, int(lastFilterTypeForTest), len(filters)) + for i := unknownFilter; i < lastFilterTypeForTest; i++ { + require.NotEmpty(t, filters[i]) + } +} diff --git a/common/service/dynamicconfig/constants.go b/common/service/dynamicconfig/constants.go index df515327e22..6d0b83cd300 100644 --- a/common/service/dynamicconfig/constants.go +++ b/common/service/dynamicconfig/constants.go @@ -36,13 +36,16 @@ var keys = map[Key]string{ unknownKey: "unknownKey", // tests keys - testGetPropertyKey: "testGetPropertyKey", - testGetIntPropertyKey: "testGetIntPropertyKey", - testGetFloat64PropertyKey: "testGetFloat64PropertyKey", - testGetDurationPropertyKey: "testGetDurationPropertyKey", - testGetBoolPropertyKey: "testGetBoolPropertyKey", - testGetIntPropertyFilteredByDomainKey: "testGetIntPropertyFilteredByDomainKey", - testGetDurationPropertyFilteredByDomainKey: "testGetDurationPropertyFilteredByDomainKey", + testGetPropertyKey: "testGetPropertyKey", + testGetIntPropertyKey: "testGetIntPropertyKey", + testGetFloat64PropertyKey: "testGetFloat64PropertyKey", + testGetDurationPropertyKey: "testGetDurationPropertyKey", + testGetBoolPropertyKey: "testGetBoolPropertyKey", + testGetIntPropertyFilteredByDomainKey: "testGetIntPropertyFilteredByDomainKey", + testGetDurationPropertyFilteredByDomainKey: "testGetDurationPropertyFilteredByDomainKey", + testGetIntPropertyFilteredByTaskListInfoKey: "testGetIntPropertyFilteredByTaskListInfoKey", + testGetDurationPropertyFilteredByTaskListInfoKey: "testGetDurationPropertyFilteredByTaskListInfoKey", + testGetBoolPropertyFilteredByTaskListInfoKey: "testGetBoolPropertyFilteredByTaskListInfoKey", // system settings EnableGlobalDomain: "system.enableGlobalDomain", @@ -239,6 +242,9 @@ const ( MaximumBufferedEventsBatch // ShardUpdateMinInterval is the minimal time interval which the shard info can be updated ShardUpdateMinInterval + + // lastKeyForTest must be the last one in this const group for testing purpose + lastKeyForTest ) // Filter represents a filter on the dynamic config key @@ -266,6 +272,9 @@ const ( TaskListName // TaskType is the task type (0:Decision, 1:Activity) TaskType + + // lastFilterTypeForTest must be the last one in this const group for testing purpose + lastFilterTypeForTest ) // FilterOption is used to provide filters for dynamic config keys