mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2025-05-04 09:02:28 +00:00
rpc/server: start and shutdown Server in tests
It will be important for proper subscription testing and it doesn't hurt even though technically we've got two http servers listening after this change (one is a regular Server's http.Server and one is httptest's Server). Reusing rpc.Server would be nice, but it requires some changes to Start sequence to start Listener with net.Listen and then communicate back its resulting Addr. It's not very convenient especially given that no other code needs it, so doing these changes just for a bit cleaner testing seems like and overkill. Update config appropriately. Update Start comment along the way.
This commit is contained in:
parent
b7d2b659b4
commit
612500ed96
4 changed files with 11 additions and 6 deletions
|
@ -875,9 +875,10 @@ func TestRPC(t *testing.T) {
|
|||
// calls. Some tests change the chain state, thus we reinitialize the chain from
|
||||
// scratch here.
|
||||
func testRPCProtocol(t *testing.T, doRPCCall func(string, string, *testing.T) []byte) {
|
||||
chain, httpSrv := initServerWithInMemoryChain(t)
|
||||
chain, rpcSrv, httpSrv := initServerWithInMemoryChain(t)
|
||||
|
||||
defer chain.Close()
|
||||
defer rpcSrv.Shutdown()
|
||||
|
||||
e := &executor{chain: chain, httpSrv: httpSrv}
|
||||
for method, cases := range rpcTestCases {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue