diff --git a/example/block_aware/block_aware_test.go b/example/block_aware/block_aware_test.go index 38acdd513..05a5c05c3 100644 --- a/example/block_aware/block_aware_test.go +++ b/example/block_aware/block_aware_test.go @@ -27,11 +27,10 @@ func TestChainAware(t *testing.T) { // Connect to the socket client := abcicli.NewSocketClient("unix://test.sock", false) + client.SetLogger(log.TestingLogger().With("module", "abci-client")) if _, err := client.Start(); err != nil { t.Fatalf("Error starting socket client: %v", err.Error()) } - client.SetLogger(log.TestingLogger().With("module", "abci-client")) - client.Start() defer client.Stop() n := uint64(5) diff --git a/example/example_test.go b/example/example_test.go index 7e116c59b..e9505f223 100644 --- a/example/example_test.go +++ b/example/example_test.go @@ -39,19 +39,18 @@ func testStream(t *testing.T, app types.Application) { // Start the listener server := server.NewSocketServer("unix://test.sock", app) + server.SetLogger(log.TestingLogger().With("module", "abci-server")) if _, err := server.Start(); err != nil { t.Fatalf("Error starting socket server: %v", err.Error()) } - server.SetLogger(log.TestingLogger().With("module", "abci-server")) defer server.Stop() // Connect to the socket client := abcicli.NewSocketClient("unix://test.sock", false) + client.SetLogger(log.TestingLogger().With("module", "abci-client")) if _, err := client.Start(); err != nil { t.Fatalf("Error starting socket client: %v", err.Error()) } - client.SetLogger(log.TestingLogger().With("module", "abci-client")) - client.Start() defer client.Stop() done := make(chan struct{}) @@ -113,10 +112,10 @@ func testGRPCSync(t *testing.T, app *types.GRPCApplication) { // Start the listener server := server.NewGRPCServer("unix://test.sock", app) + server.SetLogger(log.TestingLogger().With("module", "abci-server")) if _, err := server.Start(); err != nil { t.Fatalf("Error starting GRPC server: %v", err.Error()) } - server.SetLogger(log.TestingLogger().With("module", "abci-server")) defer server.Stop() // Connect to the socket diff --git a/tests/test_app/app.go b/tests/test_app/app.go index 3930957d7..281c9dcb1 100644 --- a/tests/test_app/app.go +++ b/tests/test_app/app.go @@ -38,12 +38,12 @@ func startClient(abciType string) abcicli.Client { if err != nil { panic(err.Error()) } + logger := log.NewTMLogger(log.NewSyncWriter(os.Stdout)) + client.SetLogger(logger.With("module", "abcicli")) if _, err := client.Start(); err != nil { panic("connecting to abci_app: " + err.Error()) } - logger := log.NewTMLogger(log.NewSyncWriter(os.Stdout)) - client.SetLogger(logger.With("module", "abcicli")) return client } diff --git a/types/validators.go b/types/validators.go index a83c6d40a..95258aa23 100644 --- a/types/validators.go +++ b/types/validators.go @@ -5,6 +5,7 @@ import ( "encoding/json" "github.com/tendermint/go-wire/data" + cmn "github.com/tendermint/tmlibs/common" ) // validators implements sort @@ -38,6 +39,9 @@ func ValidatorsString(vs Validators) string { for i, v := range vs { s[i] = validatorPretty{v.PubKey, v.Power} } - b, _ := json.Marshal(s) + b, err := json.Marshal(s) + if err != nil { + cmn.PanicSanity(err.Error()) + } return string(b) }