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 !isDefaultLogLevelSet {
option, err = log.AllowLevel(cfg.DefaultBaseConfig().LogLevel)
option, err = log.AllowLevel(cfg.DefaultLogLevel())
if err != nil {
return nil, err
}

View File

@ -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

View File

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

View File

@ -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)

View File

@ -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

View File

@ -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

View File

@ -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"