cmd/geth: fix forked exe leak in console tests (#20480)
This commit is contained in:
parent
2eeb8dd271
commit
433937fb42
@ -87,11 +87,14 @@ func TestIPCAttachWelcome(t *testing.T) {
|
|||||||
"--port", "0", "--maxpeers", "0", "--nodiscover", "--nat", "none",
|
"--port", "0", "--maxpeers", "0", "--nodiscover", "--nat", "none",
|
||||||
"--etherbase", coinbase, "--shh", "--ipcpath", ipc)
|
"--etherbase", coinbase, "--shh", "--ipcpath", ipc)
|
||||||
|
|
||||||
|
defer func() {
|
||||||
|
geth.Interrupt()
|
||||||
|
geth.ExpectExit()
|
||||||
|
}()
|
||||||
|
|
||||||
waitForEndpoint(t, ipc, 3*time.Second)
|
waitForEndpoint(t, ipc, 3*time.Second)
|
||||||
testAttachWelcome(t, geth, "ipc:"+ipc, ipcAPIs)
|
testAttachWelcome(t, geth, "ipc:"+ipc, ipcAPIs)
|
||||||
|
|
||||||
geth.Interrupt()
|
|
||||||
geth.ExpectExit()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestHTTPAttachWelcome(t *testing.T) {
|
func TestHTTPAttachWelcome(t *testing.T) {
|
||||||
@ -100,13 +103,14 @@ func TestHTTPAttachWelcome(t *testing.T) {
|
|||||||
geth := runGeth(t,
|
geth := runGeth(t,
|
||||||
"--port", "0", "--maxpeers", "0", "--nodiscover", "--nat", "none",
|
"--port", "0", "--maxpeers", "0", "--nodiscover", "--nat", "none",
|
||||||
"--etherbase", coinbase, "--rpc", "--rpcport", port)
|
"--etherbase", coinbase, "--rpc", "--rpcport", port)
|
||||||
|
defer func() {
|
||||||
|
geth.Interrupt()
|
||||||
|
geth.ExpectExit()
|
||||||
|
}()
|
||||||
|
|
||||||
endpoint := "http://127.0.0.1:" + port
|
endpoint := "http://127.0.0.1:" + port
|
||||||
waitForEndpoint(t, endpoint, 3*time.Second)
|
waitForEndpoint(t, endpoint, 3*time.Second)
|
||||||
testAttachWelcome(t, geth, endpoint, httpAPIs)
|
testAttachWelcome(t, geth, endpoint, httpAPIs)
|
||||||
|
|
||||||
geth.Interrupt()
|
|
||||||
geth.ExpectExit()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestWSAttachWelcome(t *testing.T) {
|
func TestWSAttachWelcome(t *testing.T) {
|
||||||
@ -116,13 +120,14 @@ func TestWSAttachWelcome(t *testing.T) {
|
|||||||
geth := runGeth(t,
|
geth := runGeth(t,
|
||||||
"--port", "0", "--maxpeers", "0", "--nodiscover", "--nat", "none",
|
"--port", "0", "--maxpeers", "0", "--nodiscover", "--nat", "none",
|
||||||
"--etherbase", coinbase, "--ws", "--wsport", port)
|
"--etherbase", coinbase, "--ws", "--wsport", port)
|
||||||
|
defer func() {
|
||||||
|
geth.Interrupt()
|
||||||
|
geth.ExpectExit()
|
||||||
|
}()
|
||||||
|
|
||||||
endpoint := "ws://127.0.0.1:" + port
|
endpoint := "ws://127.0.0.1:" + port
|
||||||
waitForEndpoint(t, endpoint, 3*time.Second)
|
waitForEndpoint(t, endpoint, 3*time.Second)
|
||||||
testAttachWelcome(t, geth, endpoint, httpAPIs)
|
testAttachWelcome(t, geth, endpoint, httpAPIs)
|
||||||
|
|
||||||
geth.Interrupt()
|
|
||||||
geth.ExpectExit()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func testAttachWelcome(t *testing.T, geth *testgeth, endpoint, apis string) {
|
func testAttachWelcome(t *testing.T, geth *testgeth, endpoint, apis string) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user