diff options
author | Péter Szilágyi <peterke@gmail.com> | 2016-02-09 20:10:40 +0800 |
---|---|---|
committer | Péter Szilágyi <peterke@gmail.com> | 2016-02-09 20:10:40 +0800 |
commit | df75dbfd6804923b1c8a8388b67523072d59f155 (patch) | |
tree | 5191e9a8004499727a42336be1f092bc04943ae8 /node/node_test.go | |
parent | 900e124beea551ded290f61e7bf85ff6b2e4a29e (diff) | |
download | dexon-df75dbfd6804923b1c8a8388b67523072d59f155.tar.gz dexon-df75dbfd6804923b1c8a8388b67523072d59f155.tar.zst dexon-df75dbfd6804923b1c8a8388b67523072d59f155.zip |
cmd, node, rpc: readd inproc RPC client, expose via node
Diffstat (limited to 'node/node_test.go')
-rw-r--r-- | node/node_test.go | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/node/node_test.go b/node/node_test.go index 38bfe27e2..532115d3c 100644 --- a/node/node_test.go +++ b/node/node_test.go @@ -18,9 +18,7 @@ package node import ( "errors" - "fmt" "io/ioutil" - "math/rand" "os" "reflect" "testing" @@ -37,7 +35,6 @@ var ( func testNodeConfig() *Config { return &Config{ - IPCPath: fmt.Sprintf("test-%d.ipc", rand.Int63()), PrivateKey: testNodeKey, Name: "test node", } @@ -541,10 +538,11 @@ func TestAPIGather(t *testing.T) { defer stack.Stop() // Connect to the RPC server and verify the various registered endpoints - ipcClient, err := rpc.NewIPCClient(stack.IPCEndpoint()) + client, err := stack.Attach() if err != nil { - t.Fatalf("failed to connect to the IPC API server: %v", err) + t.Fatalf("failed to connect to the inproc API server: %v", err) } + defer client.Close() tests := []struct { Method string @@ -556,11 +554,11 @@ func TestAPIGather(t *testing.T) { {"multi.v2.nested_theOneMethod", "multi.v2.nested"}, } for i, test := range tests { - if err := ipcClient.Send(rpc.JSONRequest{Id: new(int64), Version: "2.0", Method: test.Method}); err != nil { + if err := client.Send(rpc.JSONRequest{Id: new(int64), Version: "2.0", Method: test.Method}); err != nil { t.Fatalf("test %d: failed to send API request: %v", i, err) } reply := new(rpc.JSONSuccessResponse) - if err := ipcClient.Recv(reply); err != nil { + if err := client.Recv(reply); err != nil { t.Fatalf("test %d: failed to read API reply: %v", i, err) } select { |