Skip to content

Commit

Permalink
test: stop abci server started in addr test
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
mark-rushakoff committed Jul 25, 2022
1 parent 46badfa commit 42787ef
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions abci/tests/client_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,12 @@ func TestClientServerNoAddrPrefix(t *testing.T) {
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()
}

0 comments on commit 42787ef

Please sign in to comment.