Skip to content

Commit

Permalink
Fix config deserilization error (cadence-workflow#2927)
Browse files Browse the repository at this point in the history
  • Loading branch information
vancexu authored Dec 20, 2019
1 parent eb47ac6 commit bb55504
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 10 deletions.
20 changes: 10 additions & 10 deletions common/service/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,9 @@ type (
// DataStores contains the configuration for all datastores
DataStores map[string]DataStore `yaml:"datastores"`
// VisibilityConfig is config for visibility sampling
VisibilityConfig *VisibilityConfig
VisibilityConfig *VisibilityConfig `yaml:"-" json:"-"`
// TransactionSizeLimit is the largest allowed transaction size
TransactionSizeLimit dynamicconfig.IntPropertyFn
TransactionSizeLimit dynamicconfig.IntPropertyFn `yaml:"-" json:"-"`
}

// DataStore is the configuration for a single datastore
Expand All @@ -153,21 +153,21 @@ type (
// VisibilityConfig is config for visibility sampling
VisibilityConfig struct {
// EnableSampling for visibility
EnableSampling dynamicconfig.BoolPropertyFn
EnableSampling dynamicconfig.BoolPropertyFn `yaml:"-" json:"-"`
// EnableReadFromClosedExecutionV2 read closed from v2 table
EnableReadFromClosedExecutionV2 dynamicconfig.BoolPropertyFn
EnableReadFromClosedExecutionV2 dynamicconfig.BoolPropertyFn `yaml:"-" json:"-"`
// VisibilityOpenMaxQPS max QPS for record open workflows
VisibilityOpenMaxQPS dynamicconfig.IntPropertyFnWithDomainFilter
VisibilityOpenMaxQPS dynamicconfig.IntPropertyFnWithDomainFilter `yaml:"-" json:"-"`
// VisibilityClosedMaxQPS max QPS for record closed workflows
VisibilityClosedMaxQPS dynamicconfig.IntPropertyFnWithDomainFilter
VisibilityClosedMaxQPS dynamicconfig.IntPropertyFnWithDomainFilter `yaml:"-" json:"-"`
// VisibilityListMaxQPS max QPS for list workflow
VisibilityListMaxQPS dynamicconfig.IntPropertyFnWithDomainFilter
VisibilityListMaxQPS dynamicconfig.IntPropertyFnWithDomainFilter `yaml:"-" json:"-"`
// ESIndexMaxResultWindow ElasticSearch index setting max_result_window
ESIndexMaxResultWindow dynamicconfig.IntPropertyFn
ESIndexMaxResultWindow dynamicconfig.IntPropertyFn `yaml:"-" json:"-"`
// MaxQPS is overall max QPS
MaxQPS dynamicconfig.IntPropertyFn
MaxQPS dynamicconfig.IntPropertyFn `yaml:"-" json:"-"`
// ValidSearchAttributes is legal indexed keys that can be used in list APIs
ValidSearchAttributes dynamicconfig.MapPropertyFn
ValidSearchAttributes dynamicconfig.MapPropertyFn `yaml:"-" json:"-"`
}

// Cassandra contains configuration to connect to Cassandra cluster
Expand Down
34 changes: 34 additions & 0 deletions common/service/config/config_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// Copyright (c) 2019 Uber Technologies, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

package config

import (
"testing"

"github.com/stretchr/testify/assert"
)

func TestToString(t *testing.T) {
var cfg Config
err := Load("", "../../../config", "", &cfg)
assert.NoError(t, err)
assert.NotEmpty(t, cfg.String())
}

0 comments on commit bb55504

Please sign in to comment.