test: stop abci server started in addr test (#9093)

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.
This commit is contained in:
Mark Rushakoff
2022-07-27 10:25:00 -04:00
committed by GitHub
parent 18c7e3aae5
commit c4e235243b

View File

@@ -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()
}