cmd/geth: fix forked exe leak in console tests (#20480)

This commit is contained in:
Guillaume Ballet 2020-01-06 12:07:21 +01:00 committed by Felix Lange
parent 2eeb8dd271
commit 433937fb42

View File

@ -87,11 +87,14 @@ func TestIPCAttachWelcome(t *testing.T) {
"--port", "0", "--maxpeers", "0", "--nodiscover", "--nat", "none",
"--etherbase", coinbase, "--shh", "--ipcpath", ipc)
defer func() {
geth.Interrupt()
geth.ExpectExit()
}()
waitForEndpoint(t, ipc, 3*time.Second)
testAttachWelcome(t, geth, "ipc:"+ipc, ipcAPIs)
geth.Interrupt()
geth.ExpectExit()
}
func TestHTTPAttachWelcome(t *testing.T) {
@ -100,13 +103,14 @@ func TestHTTPAttachWelcome(t *testing.T) {
geth := runGeth(t,
"--port", "0", "--maxpeers", "0", "--nodiscover", "--nat", "none",
"--etherbase", coinbase, "--rpc", "--rpcport", port)
defer func() {
geth.Interrupt()
geth.ExpectExit()
}()
endpoint := "http://127.0.0.1:" + port
waitForEndpoint(t, endpoint, 3*time.Second)
testAttachWelcome(t, geth, endpoint, httpAPIs)
geth.Interrupt()
geth.ExpectExit()
}
func TestWSAttachWelcome(t *testing.T) {
@ -116,13 +120,14 @@ func TestWSAttachWelcome(t *testing.T) {
geth := runGeth(t,
"--port", "0", "--maxpeers", "0", "--nodiscover", "--nat", "none",
"--etherbase", coinbase, "--ws", "--wsport", port)
defer func() {
geth.Interrupt()
geth.ExpectExit()
}()
endpoint := "ws://127.0.0.1:" + port
waitForEndpoint(t, endpoint, 3*time.Second)
testAttachWelcome(t, geth, endpoint, httpAPIs)
geth.Interrupt()
geth.ExpectExit()
}
func testAttachWelcome(t *testing.T, geth *testgeth, endpoint, apis string) {