From bd7ec18c19b8a0bea090392ab6224aa1891b7706 Mon Sep 17 00:00:00 2001 From: Ethan Buchman Date: Fri, 26 May 2017 11:57:41 -0400 Subject: [PATCH] fix tests --- cmd/tendermint/commands/flags/log_level.go | 2 +- config/config.go | 11 ++++++++++- rpc/client/rpc_test.go | 2 +- rpc/test/helpers.go | 12 ++++++------ state/execution.go | 2 +- test/app/test.sh | 2 +- test/persist/test_failure_indices.sh | 2 +- 7 files changed, 21 insertions(+), 12 deletions(-) diff --git a/cmd/tendermint/commands/flags/log_level.go b/cmd/tendermint/commands/flags/log_level.go index acdd24ec2..6821563ad 100644 --- a/cmd/tendermint/commands/flags/log_level.go +++ b/cmd/tendermint/commands/flags/log_level.go @@ -76,7 +76,7 @@ func ParseLogLevel(lvl string, logger log.Logger) (log.Logger, error) { // if "*" is not provided, set default global level if !isDefaultLogLevelSet { - option, err = log.AllowLevel(cfg.DefaultBaseConfig().LogLevel) + option, err = log.AllowLevel(cfg.DefaultLogLevel()) if err != nil { return nil, err } diff --git a/config/config.go b/config/config.go index eafea77e9..42ca60992 100644 --- a/config/config.go +++ b/config/config.go @@ -1,6 +1,7 @@ package config import ( + "fmt" "path/filepath" "time" @@ -108,7 +109,7 @@ func DefaultBaseConfig() BaseConfig { Moniker: "anonymous", ProxyApp: "tcp://127.0.0.1:46658", ABCI: "socket", - LogLevel: "state:info,*:error", + LogLevel: DefaultPackageLogLevels(), ProfListenAddress: "", FastSync: true, FilterPeers: false, @@ -139,6 +140,14 @@ func (b BaseConfig) DBDir() string { return rootify(b.DBPath, b.RootDir) } +func DefaultLogLevel() string { + return "error" +} + +func DefaultPackageLogLevels() string { + return fmt.Sprintf("state:info,*:%s", DefaultLogLevel()) +} + //----------------------------------------------------------------------------- // RPCConfig diff --git a/rpc/client/rpc_test.go b/rpc/client/rpc_test.go index 2586b4687..13b440479 100644 --- a/rpc/client/rpc_test.go +++ b/rpc/client/rpc_test.go @@ -13,7 +13,7 @@ import ( ) func getHTTPClient() *client.HTTP { - rpcAddr := rpctest.GetConfig().RPCListenAddress + rpcAddr := rpctest.GetConfig().RPC.ListenAddress return client.NewHTTP(rpcAddr, "/websocket") } diff --git a/rpc/test/helpers.go b/rpc/test/helpers.go index 130a45956..51bb0b8fe 100644 --- a/rpc/test/helpers.go +++ b/rpc/test/helpers.go @@ -59,31 +59,31 @@ func GetConfig() *cfg.Config { // and we use random ports to run in parallel tm, rpc, grpc := makeAddrs() config.P2P.ListenAddress = tm - config.RPCListenAddress = rpc - config.GRPCListenAddress = grpc + config.RPC.ListenAddress = rpc + config.RPC.GRPCListenAddress = grpc } return config } // GetURIClient gets a uri client pointing to the test tendermint rpc func GetURIClient() *client.URIClient { - rpcAddr := GetConfig().RPCListenAddress + rpcAddr := GetConfig().RPC.ListenAddress return client.NewURIClient(rpcAddr) } // GetJSONClient gets a http/json client pointing to the test tendermint rpc func GetJSONClient() *client.JSONRPCClient { - rpcAddr := GetConfig().RPCListenAddress + rpcAddr := GetConfig().RPC.ListenAddress return client.NewJSONRPCClient(rpcAddr) } func GetGRPCClient() core_grpc.BroadcastAPIClient { - grpcAddr := config.GRPCListenAddress + grpcAddr := config.RPC.GRPCListenAddress return core_grpc.StartGRPCClient(grpcAddr) } func GetWSClient() *client.WSClient { - rpcAddr := GetConfig().RPCListenAddress + rpcAddr := GetConfig().RPC.ListenAddress wsc := client.NewWSClient(rpcAddr, "/websocket") if _, err := wsc.Start(); err != nil { panic(err) diff --git a/state/execution.go b/state/execution.go index c8544c3d1..768a0b1de 100644 --- a/state/execution.go +++ b/state/execution.go @@ -259,7 +259,7 @@ func (s *State) CommitStateUpdateMempool(proxyAppConn proxy.AppConnConsensus, bl s.logger.Debug("Commit.Log: " + res.Log) } - s.logger.Info("Committed state", "height", block.Height, "hash", res.Data) + s.logger.Info("Committed state", "height", block.Height, "txs", block.NumTxs, "hash", res.Data) // Set the state's new AppHash s.AppHash = res.Data diff --git a/test/app/test.sh b/test/app/test.sh index 0b40c43e0..cd312b68a 100644 --- a/test/app/test.sh +++ b/test/app/test.sh @@ -85,7 +85,7 @@ function counter_over_grpc_grpc() { pid_counter=$! sleep 1 GRPC_PORT=36656 - tendermint node --abci grpc --grpc_laddr tcp://localhost:$GRPC_PORT > tendermint.log & + tendermint node --abci grpc --rpc.grpc_laddr tcp://localhost:$GRPC_PORT > tendermint.log & pid_tendermint=$! sleep 5 diff --git a/test/persist/test_failure_indices.sh b/test/persist/test_failure_indices.sh index 9e3c8f19e..41c17a094 100644 --- a/test/persist/test_failure_indices.sh +++ b/test/persist/test_failure_indices.sh @@ -8,7 +8,7 @@ tendermint init # use a unix socket so we can remove it RPC_ADDR="$(pwd)/rpc.sock" -TM_CMD="tendermint node --log_level=debug --rpc_laddr=unix://$RPC_ADDR" # &> tendermint_${name}.log" +TM_CMD="tendermint node --log_level=debug --rpc.laddr=unix://$RPC_ADDR" # &> tendermint_${name}.log" DUMMY_CMD="dummy --persist $TMHOME/dummy" # &> dummy_${name}.log"