|
@ -9,6 +9,7 @@ import ( |
|
|
"github.com/tendermint/abci/server" |
|
|
"github.com/tendermint/abci/server" |
|
|
"github.com/tendermint/abci/types" |
|
|
"github.com/tendermint/abci/types" |
|
|
cmn "github.com/tendermint/tmlibs/common" |
|
|
cmn "github.com/tendermint/tmlibs/common" |
|
|
|
|
|
"github.com/tendermint/tmlibs/log" |
|
|
) |
|
|
) |
|
|
|
|
|
|
|
|
//----------------------------------------
|
|
|
//----------------------------------------
|
|
@ -48,16 +49,23 @@ func TestEcho(t *testing.T) { |
|
|
clientCreator := NewRemoteClientCreator(sockPath, SOCKET, true) |
|
|
clientCreator := NewRemoteClientCreator(sockPath, SOCKET, true) |
|
|
|
|
|
|
|
|
// Start server
|
|
|
// Start server
|
|
|
s, err := server.NewSocketServer(sockPath, dummy.NewDummyApplication()) |
|
|
|
|
|
if err != nil { |
|
|
|
|
|
cmn.Exit(err.Error()) |
|
|
|
|
|
|
|
|
s := server.NewSocketServer(sockPath, dummy.NewDummyApplication()) |
|
|
|
|
|
s.SetLogger(log.TestingLogger().With("module", "abci-server")) |
|
|
|
|
|
if _, err := s.Start(); err != nil { |
|
|
|
|
|
t.Fatalf("Error starting socket server: %v", err.Error()) |
|
|
} |
|
|
} |
|
|
defer s.Stop() |
|
|
defer s.Stop() |
|
|
|
|
|
|
|
|
// Start client
|
|
|
// Start client
|
|
|
cli, err := clientCreator.NewABCIClient() |
|
|
cli, err := clientCreator.NewABCIClient() |
|
|
if err != nil { |
|
|
if err != nil { |
|
|
cmn.Exit(err.Error()) |
|
|
|
|
|
|
|
|
t.Fatalf("Error creating ABCI client: %v", err.Error()) |
|
|
} |
|
|
} |
|
|
|
|
|
cli.SetLogger(log.TestingLogger().With("module", "abci-client")) |
|
|
|
|
|
if _, err := cli.Start(); err != nil { |
|
|
|
|
|
t.Fatalf("Error starting ABCI client: %v", err.Error()) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
proxy := NewAppConnTest(cli) |
|
|
proxy := NewAppConnTest(cli) |
|
|
t.Log("Connected") |
|
|
t.Log("Connected") |
|
|
|
|
|
|
|
@ -71,17 +79,25 @@ func BenchmarkEcho(b *testing.B) { |
|
|
b.StopTimer() // Initialize
|
|
|
b.StopTimer() // Initialize
|
|
|
sockPath := cmn.Fmt("unix:///tmp/echo_%v.sock", cmn.RandStr(6)) |
|
|
sockPath := cmn.Fmt("unix:///tmp/echo_%v.sock", cmn.RandStr(6)) |
|
|
clientCreator := NewRemoteClientCreator(sockPath, SOCKET, true) |
|
|
clientCreator := NewRemoteClientCreator(sockPath, SOCKET, true) |
|
|
|
|
|
|
|
|
// Start server
|
|
|
// Start server
|
|
|
s, err := server.NewSocketServer(sockPath, dummy.NewDummyApplication()) |
|
|
|
|
|
if err != nil { |
|
|
|
|
|
cmn.Exit(err.Error()) |
|
|
|
|
|
|
|
|
s := server.NewSocketServer(sockPath, dummy.NewDummyApplication()) |
|
|
|
|
|
s.SetLogger(log.TestingLogger().With("module", "abci-server")) |
|
|
|
|
|
if _, err := s.Start(); err != nil { |
|
|
|
|
|
b.Fatalf("Error starting socket server: %v", err.Error()) |
|
|
} |
|
|
} |
|
|
defer s.Stop() |
|
|
defer s.Stop() |
|
|
|
|
|
|
|
|
// Start client
|
|
|
// Start client
|
|
|
cli, err := clientCreator.NewABCIClient() |
|
|
cli, err := clientCreator.NewABCIClient() |
|
|
if err != nil { |
|
|
if err != nil { |
|
|
cmn.Exit(err.Error()) |
|
|
|
|
|
|
|
|
b.Fatalf("Error creating ABCI client: %v", err.Error()) |
|
|
} |
|
|
} |
|
|
|
|
|
cli.SetLogger(log.TestingLogger().With("module", "abci-client")) |
|
|
|
|
|
if _, err := cli.Start(); err != nil { |
|
|
|
|
|
b.Fatalf("Error starting ABCI client: %v", err.Error()) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
proxy := NewAppConnTest(cli) |
|
|
proxy := NewAppConnTest(cli) |
|
|
b.Log("Connected") |
|
|
b.Log("Connected") |
|
|
echoString := strings.Repeat(" ", 200) |
|
|
echoString := strings.Repeat(" ", 200) |
|
@ -100,17 +116,25 @@ func BenchmarkEcho(b *testing.B) { |
|
|
func TestInfo(t *testing.T) { |
|
|
func TestInfo(t *testing.T) { |
|
|
sockPath := cmn.Fmt("unix:///tmp/echo_%v.sock", cmn.RandStr(6)) |
|
|
sockPath := cmn.Fmt("unix:///tmp/echo_%v.sock", cmn.RandStr(6)) |
|
|
clientCreator := NewRemoteClientCreator(sockPath, SOCKET, true) |
|
|
clientCreator := NewRemoteClientCreator(sockPath, SOCKET, true) |
|
|
|
|
|
|
|
|
// Start server
|
|
|
// Start server
|
|
|
s, err := server.NewSocketServer(sockPath, dummy.NewDummyApplication()) |
|
|
|
|
|
if err != nil { |
|
|
|
|
|
cmn.Exit(err.Error()) |
|
|
|
|
|
|
|
|
s := server.NewSocketServer(sockPath, dummy.NewDummyApplication()) |
|
|
|
|
|
s.SetLogger(log.TestingLogger().With("module", "abci-server")) |
|
|
|
|
|
if _, err := s.Start(); err != nil { |
|
|
|
|
|
t.Fatalf("Error starting socket server: %v", err.Error()) |
|
|
} |
|
|
} |
|
|
defer s.Stop() |
|
|
defer s.Stop() |
|
|
|
|
|
|
|
|
// Start client
|
|
|
// Start client
|
|
|
cli, err := clientCreator.NewABCIClient() |
|
|
cli, err := clientCreator.NewABCIClient() |
|
|
if err != nil { |
|
|
if err != nil { |
|
|
cmn.Exit(err.Error()) |
|
|
|
|
|
|
|
|
t.Fatalf("Error creating ABCI client: %v", err.Error()) |
|
|
|
|
|
} |
|
|
|
|
|
cli.SetLogger(log.TestingLogger().With("module", "abci-client")) |
|
|
|
|
|
if _, err := cli.Start(); err != nil { |
|
|
|
|
|
t.Fatalf("Error starting ABCI client: %v", err.Error()) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
proxy := NewAppConnTest(cli) |
|
|
proxy := NewAppConnTest(cli) |
|
|
t.Log("Connected") |
|
|
t.Log("Connected") |
|
|
|
|
|
|
|
|