mirror of
https://github.com/tendermint/tendermint.git
synced 2026-01-07 05:46:32 +00:00
This test would fail if run with "go test -count=2" because it uses a fixed address and was not closing the server, so the subsequent run could not bind to the address. While closing the server is correct, it would probably be better if the API was able to report the bound address so that we could pass "localhost:0" for an anonymous port. But I am currently focusing on test cleanup, not ready to change any existing APIs.
31 lines
849 B
Go
31 lines
849 B
Go
package tests
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
abciclient "github.com/tendermint/tendermint/abci/client"
|
|
"github.com/tendermint/tendermint/abci/example/kvstore"
|
|
abciserver "github.com/tendermint/tendermint/abci/server"
|
|
)
|
|
|
|
func TestClientServerNoAddrPrefix(t *testing.T) {
|
|
addr := "localhost:26658"
|
|
transport := "socket"
|
|
app := kvstore.NewApplication()
|
|
|
|
server, err := abciserver.NewServer(addr, transport, app)
|
|
assert.NoError(t, err, "expected no error on NewServer")
|
|
err = server.Start()
|
|
assert.NoError(t, err, "expected no error on server.Start")
|
|
defer func() { _ = server.Stop() }()
|
|
|
|
client, err := abciclient.NewClient(addr, transport, true)
|
|
assert.NoError(t, err, "expected no error on NewClient")
|
|
err = client.Start()
|
|
assert.NoError(t, err, "expected no error on client.Start")
|
|
|
|
_ = client.Stop()
|
|
}
|