cmd/swarm/global-store: terminate subprocess with Kill in tests

This commit is contained in:
Janos Guljas 2019-02-20 16:54:16 +01:00
parent 24563b57b8
commit 1e72a2ffb8
2 changed files with 4 additions and 4 deletions

View file

@ -35,7 +35,7 @@ func TestExplorer(t *testing.T) {
addr := findFreeTCPAddress(t) addr := findFreeTCPAddress(t)
explorerAddr := findFreeTCPAddress(t) explorerAddr := findFreeTCPAddress(t)
testCmd := runGlobalStore(t, "ws", "--addr", addr, "--explorer-address", explorerAddr) testCmd := runGlobalStore(t, "ws", "--addr", addr, "--explorer-address", explorerAddr)
defer testCmd.Interrupt() defer testCmd.Kill()
client := websocketClient(t, addr) client := websocketClient(t, addr)
@ -137,7 +137,7 @@ func TestExplorer_CORSOrigin(t *testing.T) {
"--explorer-address", explorerAddr, "--explorer-address", explorerAddr,
"--explorer-cors-origin", origin, "--explorer-cors-origin", origin,
) )
defer testCmd.Interrupt() defer testCmd.Kill()
// wait until the server is started // wait until the server is started
waitHTTPEndpoint(t, explorerAddr) waitHTTPEndpoint(t, explorerAddr)

View file

@ -60,7 +60,7 @@ func TestHTTP_Database(t *testing.T) {
func testHTTP(t *testing.T, put bool, args ...string) { func testHTTP(t *testing.T, put bool, args ...string) {
addr := findFreeTCPAddress(t) addr := findFreeTCPAddress(t)
testCmd := runGlobalStore(t, append([]string{"http", "--addr", addr}, args...)...) testCmd := runGlobalStore(t, append([]string{"http", "--addr", addr}, args...)...)
defer testCmd.Interrupt() defer testCmd.Kill()
client, err := rpc.DialHTTP("http://" + addr) client, err := rpc.DialHTTP("http://" + addr)
if err != nil { if err != nil {
@ -126,7 +126,7 @@ func TestWebsocket_Database(t *testing.T) {
func testWebsocket(t *testing.T, put bool, args ...string) { func testWebsocket(t *testing.T, put bool, args ...string) {
addr := findFreeTCPAddress(t) addr := findFreeTCPAddress(t)
testCmd := runGlobalStore(t, append([]string{"ws", "--addr", addr}, args...)...) testCmd := runGlobalStore(t, append([]string{"ws", "--addr", addr}, args...)...)
defer testCmd.Interrupt() defer testCmd.Kill()
client := websocketClient(t, addr) client := websocketClient(t, addr)