Skip to content

Commit

Permalink
Update default event polling interval from 10sec to 1sec
Browse files Browse the repository at this point in the history
Signed-off-by: Jim Zhang <jim.zhang@kaleido.io>
  • Loading branch information
jimthematrix committed Nov 23, 2021
1 parent 83bbf61 commit 4ecbede
Show file tree
Hide file tree
Showing 4 changed files with 130 additions and 45 deletions.
10 changes: 7 additions & 3 deletions cmd/fabconnect_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func TestMain(m *testing.M) {
func setup() {
tmpdir, testConfig = test.Setup()
os.Setenv("FC_HTTP_PORT", "8002")
os.Setenv("FC_EVENTS_POLLINGINTERVAL", "60")
os.Setenv("FC_MAXINFLIGHT", "60")
}

func teardown() {
Expand Down Expand Up @@ -72,7 +72,7 @@ func TestBadConfigFile(t *testing.T) {
}
rootCmd.SetArgs(args)
err := rootCmd.Execute()
assert.Regexp(regexp.MustCompile(`cannot parse 'maxInFlight' as int`), err)
assert.Regexp(regexp.MustCompile(`User credentials store creation failed`), err)
}

func TestStartServerError(t *testing.T) {
Expand Down Expand Up @@ -103,6 +103,7 @@ func TestMaxWaitTimeTooSmallWarns(t *testing.T) {
err := rootCmd.Execute()
assert.NoError(err)
assert.Equal(10, restGatewayConf.MaxTXWaitTime)
assert.Equal(1, restGatewayConf.Events.PollingIntervalSec)

// test that the environment variable FC_HTTP_PORT overrides the port setting in the config file
assert.Equal(8002, restGatewayConf.HTTP.Port)
Expand All @@ -117,20 +118,23 @@ func TestEnvVarOverride(t *testing.T) {
rootCmd.RunE = runNothing
_ = rootCmd.Execute()
assert.Equal(8002, restGatewayConf.HTTP.Port)
assert.Equal(uint64(60), restGatewayConf.Events.PollingIntervalSec)
assert.Equal(60, restGatewayConf.MaxInFlight)
}

func TestCmdArgsOverride(t *testing.T) {
assert := assert.New(t)

restGateway = nil
restGatewayConf.Events.PollingIntervalSec = 0
rootCmd.RunE = runNothing
args := []string{
"-P", "8001",
"--events-polling-int", "10",
}
rootCmd.SetArgs(args)
_ = rootCmd.Execute()
assert.Equal(8001, restGatewayConf.HTTP.Port)
assert.Equal(10, restGatewayConf.Events.PollingIntervalSec)
}

func TestDefaultsInConfigFile(t *testing.T) {
Expand Down
20 changes: 11 additions & 9 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,32 +5,31 @@ go 1.16
require (
github.com/Shopify/sarama v1.29.1
github.com/cpuguy83/go-md2man/v2 v2.0.1 // indirect
github.com/fatih/color v1.12.0 // indirect
github.com/fatih/color v1.13.0 // indirect
github.com/globalsign/mgo v0.0.0-20181015135952-eeefdecb41b8
github.com/golang/protobuf v1.5.2
github.com/google/certificate-transparency-go v1.1.1 // indirect
github.com/google/go-cmp v0.5.6 // indirect
github.com/google/uuid v1.2.0 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/gorilla/websocket v1.4.2
github.com/hyperledger/fabric-config v0.0.7 // indirect
github.com/hyperledger/fabric-protos-go v0.0.0-20201028172056-a3136dde2354
github.com/hyperledger/fabric-sdk-go v1.0.1-0.20210729165856-3be4ed253dcf
github.com/julienschmidt/httprouter v1.3.0
github.com/mattn/go-isatty v0.0.13 // indirect
github.com/klauspost/compress v1.13.5 // indirect
github.com/mattn/go-colorable v0.1.11 // indirect
github.com/mattn/go-runewidth v0.0.13 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect
github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d // indirect
github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d
github.com/oklog/ulid/v2 v2.0.2
github.com/olekukonko/tablewriter v0.0.5 // indirect
github.com/onsi/ginkgo v1.16.4 // indirect
github.com/onsi/gomega v1.13.0 // indirect
github.com/onsi/gomega v1.16.0 // indirect
github.com/otiai10/copy v1.6.0
github.com/pkg/errors v0.9.1
github.com/prometheus/procfs v0.6.0 // indirect
github.com/sirupsen/logrus v1.8.1
github.com/spf13/cobra v1.2.1
github.com/spf13/viper v1.8.1
github.com/spf13/viper v1.9.0
github.com/stretchr/objx v0.2.0 // indirect
github.com/stretchr/testify v1.7.1-0.20210116013205-6990a05d54c2
github.com/syndtr/goleveldb v1.0.1-0.20210305035536-64b5b1c73954
Expand All @@ -39,10 +38,13 @@ require (
github.com/xeipuuv/gojsonschema v1.2.0
go.etcd.io/bbolt v1.3.5 // indirect
go.etcd.io/etcd v0.5.0-alpha.5.0.20200910180754-dd1b699fc489 // indirect
golang.org/x/sys v0.0.0-20210823070655-63515b42dcdf // indirect
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519 // indirect
golang.org/x/mod v0.5.0 // indirect
golang.org/x/sys v0.0.0-20211013075003-97ac67df715c // indirect
golang.org/x/term v0.0.0-20210615171337-6886f2dfbf5b // indirect
golang.org/x/text v0.3.7 // indirect
golang.org/x/time v0.0.0-20200630173020-3af7569d3a1e // indirect
golang.org/x/tools v0.1.5 // indirect
golang.org/x/tools v0.1.7 // indirect
gopkg.in/yaml.v2 v2.4.0
sigs.k8s.io/yaml v1.2.0 // indirect
)
Expand Down
Loading

0 comments on commit 4ecbede

Please sign in to comment.