mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-11-29 03:41:45 +00:00
rpcsrv: add close of http server in tests
The HTTP server should be closed at the end of the test. Signed-off-by: Ekaterina Pavlova <ekt@morphbits.io>
This commit is contained in:
parent
46f2da0fb1
commit
ee39b5ca18
3 changed files with 5 additions and 1 deletions
|
@ -172,6 +172,7 @@ func TestWSClientEvents(t *testing.T) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}))
|
}))
|
||||||
|
t.Cleanup(srv.Close)
|
||||||
wsc, err := NewWS(context.TODO(), httpURLtoWS(srv.URL), WSOptions{})
|
wsc, err := NewWS(context.TODO(), httpURLtoWS(srv.URL), WSOptions{})
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
wsc.getNextRequestID = getTestRequestID
|
wsc.getNextRequestID = getTestRequestID
|
||||||
|
@ -314,6 +315,7 @@ func TestWSClientNonBlockingEvents(t *testing.T) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}))
|
}))
|
||||||
|
t.Cleanup(srv.Close)
|
||||||
wsc, err := NewWS(context.TODO(), httpURLtoWS(srv.URL), WSOptions{CloseNotificationChannelIfFull: true})
|
wsc, err := NewWS(context.TODO(), httpURLtoWS(srv.URL), WSOptions{CloseNotificationChannelIfFull: true})
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
wsc.getNextRequestID = getTestRequestID
|
wsc.getNextRequestID = getTestRequestID
|
||||||
|
@ -744,6 +746,7 @@ func TestWSFilteredSubscriptions(t *testing.T) {
|
||||||
ws.Close()
|
ws.Close()
|
||||||
}
|
}
|
||||||
}))
|
}))
|
||||||
|
t.Cleanup(srv.Close)
|
||||||
wsc, err := NewWS(context.TODO(), httpURLtoWS(srv.URL), WSOptions{})
|
wsc, err := NewWS(context.TODO(), httpURLtoWS(srv.URL), WSOptions{})
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
wsc.getNextRequestID = getTestRequestID
|
wsc.getNextRequestID = getTestRequestID
|
||||||
|
|
|
@ -1701,6 +1701,7 @@ func TestClient_Iterator_SessionConfigVariations(t *testing.T) {
|
||||||
rpcSrv.Start()
|
rpcSrv.Start()
|
||||||
handler := http.HandlerFunc(rpcSrv.handleHTTPRequest)
|
handler := http.HandlerFunc(rpcSrv.handleHTTPRequest)
|
||||||
httpSrv := httptest.NewServer(handler)
|
httpSrv := httptest.NewServer(handler)
|
||||||
|
t.Cleanup(httpSrv.Close)
|
||||||
defer rpcSrv.Shutdown()
|
defer rpcSrv.Shutdown()
|
||||||
for _, b := range getTestBlocks(t) {
|
for _, b := range getTestBlocks(t) {
|
||||||
require.NoError(t, chain.AddBlock(b))
|
require.NoError(t, chain.AddBlock(b))
|
||||||
|
|
|
@ -130,7 +130,7 @@ func wrapUnitTestChain(t testing.TB, chain *core.Blockchain, orc OracleHandler,
|
||||||
|
|
||||||
handler := http.HandlerFunc(rpcServer.handleHTTPRequest)
|
handler := http.HandlerFunc(rpcServer.handleHTTPRequest)
|
||||||
srv := httptest.NewServer(handler)
|
srv := httptest.NewServer(handler)
|
||||||
|
t.Cleanup(srv.Close)
|
||||||
return chain, &rpcServer, srv
|
return chain, &rpcServer, srv
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue