fix tests

This commit is contained in:
Ethan Buchman
2017-05-26 11:57:41 -04:00
parent 42626d9e16
commit bd7ec18c19
7 changed files with 21 additions and 12 deletions

View File

@ -76,7 +76,7 @@ func ParseLogLevel(lvl string, logger log.Logger) (log.Logger, error) {
// if "*" is not provided, set default global level // if "*" is not provided, set default global level
if !isDefaultLogLevelSet { if !isDefaultLogLevelSet {
option, err = log.AllowLevel(cfg.DefaultBaseConfig().LogLevel) option, err = log.AllowLevel(cfg.DefaultLogLevel())
if err != nil { if err != nil {
return nil, err return nil, err
} }

View File

@ -1,6 +1,7 @@
package config package config
import ( import (
"fmt"
"path/filepath" "path/filepath"
"time" "time"
@ -108,7 +109,7 @@ func DefaultBaseConfig() BaseConfig {
Moniker: "anonymous", Moniker: "anonymous",
ProxyApp: "tcp://127.0.0.1:46658", ProxyApp: "tcp://127.0.0.1:46658",
ABCI: "socket", ABCI: "socket",
LogLevel: "state:info,*:error", LogLevel: DefaultPackageLogLevels(),
ProfListenAddress: "", ProfListenAddress: "",
FastSync: true, FastSync: true,
FilterPeers: false, FilterPeers: false,
@ -139,6 +140,14 @@ func (b BaseConfig) DBDir() string {
return rootify(b.DBPath, b.RootDir) return rootify(b.DBPath, b.RootDir)
} }
func DefaultLogLevel() string {
return "error"
}
func DefaultPackageLogLevels() string {
return fmt.Sprintf("state:info,*:%s", DefaultLogLevel())
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// RPCConfig // RPCConfig

View File

@ -13,7 +13,7 @@ import (
) )
func getHTTPClient() *client.HTTP { func getHTTPClient() *client.HTTP {
rpcAddr := rpctest.GetConfig().RPCListenAddress rpcAddr := rpctest.GetConfig().RPC.ListenAddress
return client.NewHTTP(rpcAddr, "/websocket") return client.NewHTTP(rpcAddr, "/websocket")
} }

View File

@ -59,31 +59,31 @@ func GetConfig() *cfg.Config {
// and we use random ports to run in parallel // and we use random ports to run in parallel
tm, rpc, grpc := makeAddrs() tm, rpc, grpc := makeAddrs()
config.P2P.ListenAddress = tm config.P2P.ListenAddress = tm
config.RPCListenAddress = rpc config.RPC.ListenAddress = rpc
config.GRPCListenAddress = grpc config.RPC.GRPCListenAddress = grpc
} }
return config return config
} }
// GetURIClient gets a uri client pointing to the test tendermint rpc // GetURIClient gets a uri client pointing to the test tendermint rpc
func GetURIClient() *client.URIClient { func GetURIClient() *client.URIClient {
rpcAddr := GetConfig().RPCListenAddress rpcAddr := GetConfig().RPC.ListenAddress
return client.NewURIClient(rpcAddr) return client.NewURIClient(rpcAddr)
} }
// GetJSONClient gets a http/json client pointing to the test tendermint rpc // GetJSONClient gets a http/json client pointing to the test tendermint rpc
func GetJSONClient() *client.JSONRPCClient { func GetJSONClient() *client.JSONRPCClient {
rpcAddr := GetConfig().RPCListenAddress rpcAddr := GetConfig().RPC.ListenAddress
return client.NewJSONRPCClient(rpcAddr) return client.NewJSONRPCClient(rpcAddr)
} }
func GetGRPCClient() core_grpc.BroadcastAPIClient { func GetGRPCClient() core_grpc.BroadcastAPIClient {
grpcAddr := config.GRPCListenAddress grpcAddr := config.RPC.GRPCListenAddress
return core_grpc.StartGRPCClient(grpcAddr) return core_grpc.StartGRPCClient(grpcAddr)
} }
func GetWSClient() *client.WSClient { func GetWSClient() *client.WSClient {
rpcAddr := GetConfig().RPCListenAddress rpcAddr := GetConfig().RPC.ListenAddress
wsc := client.NewWSClient(rpcAddr, "/websocket") wsc := client.NewWSClient(rpcAddr, "/websocket")
if _, err := wsc.Start(); err != nil { if _, err := wsc.Start(); err != nil {
panic(err) panic(err)

View File

@ -259,7 +259,7 @@ func (s *State) CommitStateUpdateMempool(proxyAppConn proxy.AppConnConsensus, bl
s.logger.Debug("Commit.Log: " + res.Log) 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 // Set the state's new AppHash
s.AppHash = res.Data s.AppHash = res.Data

View File

@ -85,7 +85,7 @@ function counter_over_grpc_grpc() {
pid_counter=$! pid_counter=$!
sleep 1 sleep 1
GRPC_PORT=36656 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=$! pid_tendermint=$!
sleep 5 sleep 5

View File

@ -8,7 +8,7 @@ tendermint init
# use a unix socket so we can remove it # use a unix socket so we can remove it
RPC_ADDR="$(pwd)/rpc.sock" 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" DUMMY_CMD="dummy --persist $TMHOME/dummy" # &> dummy_${name}.log"