Browse Source

introduce testing logger

pull/1780/head
Anton Kaliaev 8 years ago
parent
commit
d2a4b16b28
No known key found for this signature in database GPG Key ID: 7B6881D965918214
10 changed files with 21 additions and 28 deletions
  1. +1
    -1
      cmd/abci-cli/abci-cli.go
  2. +1
    -1
      cmd/counter/main.go
  3. +1
    -1
      cmd/dummy/main.go
  4. +1
    -1
      example/block_aware/block_aware_app.go
  5. +2
    -4
      example/block_aware/block_aware_test.go
  6. +2
    -2
      example/dummy/dummy_test.go
  7. +3
    -8
      example/example_test.go
  8. +8
    -8
      glide.lock
  9. +1
    -1
      glide.yaml
  10. +1
    -1
      tests/test_app/app.go

+ 1
- 1
cmd/abci-cli/abci-cli.go View File

@ -139,7 +139,7 @@ func main() {
func before(c *cli.Context) error {
if logger == nil {
logger = log.NewTmLogger(os.Stdout)
logger = log.NewTMLogger(os.Stdout)
}
if client == nil {
var err error


+ 1
- 1
cmd/counter/main.go View File

@ -18,7 +18,7 @@ func main() {
flag.Parse()
app := counter.NewCounterApplication(*serialPtr)
logger := log.NewTmLogger(os.Stdout)
logger := log.NewTMLogger(os.Stdout)
// Start the listener
srv, err := server.NewServer(*addrPtr, *abciPtr, app)


+ 1
- 1
cmd/dummy/main.go View File

@ -18,7 +18,7 @@ func main() {
persistencePtr := flag.String("persist", "", "directory to use for a database")
flag.Parse()
logger := log.NewTmLogger(os.Stdout)
logger := log.NewTMLogger(os.Stdout)
// Create the application - in memory or persisted to disk
var app types.Application


+ 1
- 1
example/block_aware/block_aware_app.go View File

@ -16,7 +16,7 @@ func main() {
abciPtr := flag.String("abci", "socket", "socket | grpc")
flag.Parse()
logger := log.NewTmLogger(os.Stdout)
logger := log.NewTMLogger(os.Stdout)
// Start the listener
srv, err := server.NewServer(*addrPtr, *abciPtr, NewChainAwareApplication())


+ 2
- 4
example/block_aware/block_aware_test.go View File

@ -1,7 +1,6 @@
package main
import (
"os"
"strconv"
"strings"
"testing"
@ -14,14 +13,13 @@ import (
func TestChainAware(t *testing.T) {
app := NewChainAwareApplication()
logger := log.NewTmLogger(os.Stdout)
// Start the listener
srv, err := server.NewServer("unix://test.sock", "socket", app)
if err != nil {
t.Fatal(err)
}
srv.SetLogger(log.With(logger, "module", "abci-server"))
srv.SetLogger(log.With(log.TestingLogger(), "module", "abci-server"))
defer srv.Stop()
// Connect to the socket
@ -29,7 +27,7 @@ func TestChainAware(t *testing.T) {
if err != nil {
t.Fatalf("Error starting socket client: %v", err.Error())
}
client.SetLogger(log.With(logger, "module", "abci-client"))
client.SetLogger(log.With(log.TestingLogger(), "module", "abci-client"))
client.Start()
defer client.Stop()


+ 2
- 2
example/dummy/dummy_test.go View File

@ -213,7 +213,7 @@ func valsEqual(t *testing.T, vals1, vals2 []*types.Validator) {
func makeSocketClientServer(app types.Application, name string) (abcicli.Client, cmn.Service, error) {
// Start the listener
socket := cmn.Fmt("unix://%s.sock", name)
logger := log.NewTmLogger(os.Stdout)
logger := log.NewTMLogger(os.Stdout)
server, err := server.NewSocketServer(socket, app)
if err != nil {
@ -236,7 +236,7 @@ func makeSocketClientServer(app types.Application, name string) (abcicli.Client,
func makeGRPCClientServer(app types.Application, name string) (abcicli.Client, cmn.Service, error) {
// Start the listener
socket := cmn.Fmt("unix://%s.sock", name)
logger := log.NewTmLogger(os.Stdout)
logger := log.NewTMLogger(os.Stdout)
gapp := types.NewGRPCApplication(app)
server, err := server.NewGRPCServer(socket, gapp)


+ 3
- 8
example/example_test.go View File

@ -3,7 +3,6 @@ package example
import (
"fmt"
"net"
"os"
"reflect"
"testing"
"time"
@ -36,16 +35,14 @@ func TestGRPC(t *testing.T) {
}
func testStream(t *testing.T, app types.Application) {
numDeliverTxs := 200000
logger := log.NewTmLogger(os.Stdout)
// Start the listener
server, err := server.NewSocketServer("unix://test.sock", app)
if err != nil {
t.Fatalf("Error starting socket server: %v", err.Error())
}
server.SetLogger(log.With(logger, "module", "abci-server"))
server.SetLogger(log.With(log.TestingLogger(), "module", "abci-server"))
defer server.Stop()
// Connect to the socket
@ -53,7 +50,7 @@ func testStream(t *testing.T, app types.Application) {
if err != nil {
t.Fatalf("Error starting socket client: %v", err.Error())
}
client.SetLogger(log.With(logger, "module", "abci-client"))
client.SetLogger(log.With(log.TestingLogger(), "module", "abci-client"))
client.Start()
defer client.Stop()
@ -112,16 +109,14 @@ func dialerFunc(addr string, timeout time.Duration) (net.Conn, error) {
}
func testGRPCSync(t *testing.T, app *types.GRPCApplication) {
numDeliverTxs := 2000
logger := log.NewTmLogger(os.Stdout)
// Start the listener
server, err := server.NewGRPCServer("unix://test.sock", app)
if err != nil {
t.Fatalf("Error starting GRPC server: %v", err.Error())
}
server.SetLogger(log.With(logger, "module", "abci-server"))
server.SetLogger(log.With(log.TestingLogger(), "module", "abci-server"))
defer server.Stop()
// Connect to the socket


+ 8
- 8
glide.lock View File

@ -1,12 +1,12 @@
hash: 3918a6fe902116fbac5ac474580edf246bee125df6e63e3bd8378f068fa8f819
updated: 2017-05-01T12:52:56.770980963Z
hash: c29114af0ddcb75dd9093d4006dd6b9039640a35540d5f44f9c19261b5730781
updated: 2017-05-03T07:33:18.832551385Z
imports:
- name: github.com/btcsuite/btcd
version: 4b348c1d33373d672edd83fc576892d0e46686d2
subpackages:
- btcec
- name: github.com/go-kit/kit
version: 8a2988aa81f699fc1e647c3c9dddce0113ef1bfb
version: 0873e56b0faeae3a1d661b10d629135508ea5504
subpackages:
- log
- log/level
@ -49,7 +49,7 @@ imports:
- edwards25519
- extra25519
- name: github.com/tendermint/go-crypto
version: 197a2b270fd94ee03824b158e738fce62862d0b8
version: 524ba917a3a1636f21ab2c0bf76b6526903ab879
- name: github.com/tendermint/go-wire
version: b53add0b622662731985485f3a19be7f684660b8
subpackages:
@ -59,7 +59,7 @@ imports:
subpackages:
- iavl
- name: github.com/tendermint/tmlibs
version: ee90b71eb94d05958875fb9cd756b301b691ea27
version: 8fc36b0097e1dfcfbba793d4b4cc87e96a03096f
subpackages:
- common
- db
@ -69,7 +69,7 @@ imports:
- name: github.com/urfave/cli
version: ab403a54a148f2d857920810291539e1f817ee7b
- name: golang.org/x/crypto
version: c7af5bf2638a1164f2eb5467c39c6cffbd13a02e
version: d1464577745bc7f4e74f65be9cfbd09436a729d6
subpackages:
- nacl/secretbox
- openpgp/armor
@ -78,7 +78,7 @@ imports:
- ripemd160
- salsa20/salsa
- name: golang.org/x/net
version: da118f7b8e5954f39d0d2130ab35d4bf0e3cb344
version: 0819898fb4973868bba6de59b6aaad75beea9a6a
subpackages:
- context
- http2
@ -99,7 +99,7 @@ imports:
subpackages:
- googleapis/rpc/status
- name: google.golang.org/grpc
version: 0eb507a2ca07f13baf499f89d66cc566bf644643
version: 68a5d50f4517bae2b44b18092410fe248d153f1e
subpackages:
- codes
- credentials


+ 1
- 1
glide.yaml View File

@ -13,7 +13,7 @@ import:
subpackages:
- iavl
- package: github.com/tendermint/tmlibs
version: feature/new-logging
version: feature/testing-logger
subpackages:
- common
- db


+ 1
- 1
tests/test_app/app.go View File

@ -38,7 +38,7 @@ func startClient(abciType string) abcicli.Client {
if err != nil {
panic("connecting to abci_app: " + err.Error())
}
logger := log.NewTmLogger(os.Stdout)
logger := log.NewTMLogger(os.Stdout)
client.SetLogger(log.With(logger, "module", "abcicli"))
return client
}


Loading…
Cancel
Save