internal/web3ext, node: migrate node admin API (Start|Stop)RPC->HTTP (#22461)
* internal/web3ext,node: migrate node admin API (Start|Stop)RPC->HTTP Corresponding CLI flags --rpc have been moved to --http. This moves the admin module HTTP RPC start/stop methods to an equivalent namespace. Rel https://github.com/ethereum/go-ethereum/pull/22263 Date: 2021-03-08 08:00:11-06:00 Signed-off-by: meows <b5c6@protonmail.com> * internal/web3ext: fix startRPC/HTTP param count (4->5) Date: 2021-03-16 06:13:23-05:00 Signed-off-by: meows <b5c6@protonmail.com>
This commit is contained in:
@@ -69,7 +69,7 @@ func TestStartRPC(t *testing.T) {
|
||||
name: "rpc enabled through API",
|
||||
cfg: Config{},
|
||||
fn: func(t *testing.T, n *Node, api *privateAdminAPI) {
|
||||
_, err := api.StartRPC(sp("127.0.0.1"), ip(0), nil, nil, nil)
|
||||
_, err := api.StartHTTP(sp("127.0.0.1"), ip(0), nil, nil, nil)
|
||||
assert.NoError(t, err)
|
||||
},
|
||||
wantReachable: true,
|
||||
@@ -90,14 +90,14 @@ func TestStartRPC(t *testing.T) {
|
||||
port := listener.Addr().(*net.TCPAddr).Port
|
||||
|
||||
// Now try to start RPC on that port. This should fail.
|
||||
_, err = api.StartRPC(sp("127.0.0.1"), ip(port), nil, nil, nil)
|
||||
_, err = api.StartHTTP(sp("127.0.0.1"), ip(port), nil, nil, nil)
|
||||
if err == nil {
|
||||
t.Fatal("StartRPC should have failed on port", port)
|
||||
t.Fatal("StartHTTP should have failed on port", port)
|
||||
}
|
||||
|
||||
// Try again after unblocking the port. It should work this time.
|
||||
listener.Close()
|
||||
_, err = api.StartRPC(sp("127.0.0.1"), ip(port), nil, nil, nil)
|
||||
_, err = api.StartHTTP(sp("127.0.0.1"), ip(port), nil, nil, nil)
|
||||
assert.NoError(t, err)
|
||||
},
|
||||
wantReachable: true,
|
||||
@@ -109,7 +109,7 @@ func TestStartRPC(t *testing.T) {
|
||||
name: "rpc stopped through API",
|
||||
cfg: Config{HTTPHost: "127.0.0.1"},
|
||||
fn: func(t *testing.T, n *Node, api *privateAdminAPI) {
|
||||
_, err := api.StopRPC()
|
||||
_, err := api.StopHTTP()
|
||||
assert.NoError(t, err)
|
||||
},
|
||||
wantReachable: false,
|
||||
@@ -121,10 +121,10 @@ func TestStartRPC(t *testing.T) {
|
||||
name: "rpc stopped twice",
|
||||
cfg: Config{HTTPHost: "127.0.0.1"},
|
||||
fn: func(t *testing.T, n *Node, api *privateAdminAPI) {
|
||||
_, err := api.StopRPC()
|
||||
_, err := api.StopHTTP()
|
||||
assert.NoError(t, err)
|
||||
|
||||
_, err = api.StopRPC()
|
||||
_, err = api.StopHTTP()
|
||||
assert.NoError(t, err)
|
||||
},
|
||||
wantReachable: false,
|
||||
@@ -211,14 +211,14 @@ func TestStartRPC(t *testing.T) {
|
||||
{
|
||||
name: "rpc stopped with ws enabled",
|
||||
fn: func(t *testing.T, n *Node, api *privateAdminAPI) {
|
||||
_, err := api.StartRPC(sp("127.0.0.1"), ip(0), nil, nil, nil)
|
||||
_, err := api.StartHTTP(sp("127.0.0.1"), ip(0), nil, nil, nil)
|
||||
assert.NoError(t, err)
|
||||
|
||||
wsport := n.http.port
|
||||
_, err = api.StartWS(sp("127.0.0.1"), ip(wsport), nil, nil)
|
||||
assert.NoError(t, err)
|
||||
|
||||
_, err = api.StopRPC()
|
||||
_, err = api.StopHTTP()
|
||||
assert.NoError(t, err)
|
||||
},
|
||||
wantReachable: false,
|
||||
@@ -233,7 +233,7 @@ func TestStartRPC(t *testing.T) {
|
||||
assert.NoError(t, err)
|
||||
|
||||
wsport := n.http.port
|
||||
_, err = api.StartRPC(sp("127.0.0.1"), ip(wsport), nil, nil, nil)
|
||||
_, err = api.StartHTTP(sp("127.0.0.1"), ip(wsport), nil, nil, nil)
|
||||
assert.NoError(t, err)
|
||||
},
|
||||
wantReachable: true,
|
||||
|
Reference in New Issue
Block a user