From c4e235243bcf39455c8379a351689479e36d1caf Mon Sep 17 00:00:00 2001 From: Mark Rushakoff Date: Wed, 27 Jul 2022 10:25:00 -0400 Subject: [PATCH] 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. --- abci/tests/client_server_test.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/abci/tests/client_server_test.go b/abci/tests/client_server_test.go index 2ef64e66a..e975f47f5 100644 --- a/abci/tests/client_server_test.go +++ b/abci/tests/client_server_test.go @@ -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() }