@@ -20,6 +20,7 @@ import (
2020 "fmt"
2121 "log"
2222 "os"
23+ "strconv"
2324 "sync/atomic"
2425 "testing"
2526 "time"
@@ -34,7 +35,7 @@ func TestClientJSONRPCError(t *testing.T) {
3435
3536 c , _ , done := testClient (t , func (_ jsonrpc.Request ) jsonrpc.Response {
3637 return jsonrpc.Response {
37- ID : intPtr ( 1 ),
38+ ID : strPtr ( "1" ),
3839 Error : str ,
3940 }
4041 })
@@ -51,7 +52,7 @@ func TestClientOVSDBError(t *testing.T) {
5152
5253 c , _ , done := testClient (t , func (_ jsonrpc.Request ) jsonrpc.Response {
5354 return jsonrpc.Response {
54- ID : intPtr ( 1 ),
55+ ID : strPtr ( "1" ),
5556 Result : mustMarshalJSON (t , & ovsdb.Error {
5657 Err : str ,
5758 Details : "malformed" ,
@@ -79,7 +80,7 @@ func TestClientOVSDBError(t *testing.T) {
7980func TestClientBadCallback (t * testing.T ) {
8081 c , notifC , done := testClient (t , func (_ jsonrpc.Request ) jsonrpc.Response {
8182 return jsonrpc.Response {
82- ID : intPtr ( 1 ),
83+ ID : strPtr ( "1" ),
8384 Result : mustMarshalJSON (t , []string {"foo" }),
8485 }
8586 })
@@ -88,7 +89,7 @@ func TestClientBadCallback(t *testing.T) {
8889 // Client doesn't have a callback for this ID.
8990 notifC <- & jsonrpc.Response {
9091 Method : "crash" ,
91- ID : intPtr ( 10 ),
92+ ID : strPtr ( "foo" ),
9293 }
9394
9495 if _ , err := c .ListDatabases (context .Background ()); err != nil {
@@ -103,7 +104,7 @@ func TestClientContextCancelBeforeRPC(t *testing.T) {
103104
104105 c , _ , done := testClient (t , func (_ jsonrpc.Request ) jsonrpc.Response {
105106 return jsonrpc.Response {
106- ID : intPtr ( 1 ),
107+ ID : strPtr ( "1" ),
107108 Result : mustMarshalJSON (t , []string {"foo" }),
108109 }
109110 })
@@ -133,7 +134,7 @@ func TestClientContextCancelDuringRPC(t *testing.T) {
133134 time .Sleep (500 * time .Millisecond )
134135
135136 return jsonrpc.Response {
136- ID : intPtr ( 1 ),
137+ ID : strPtr ( "1" ),
137138 Result : mustMarshalJSON (t , []string {"foo" }),
138139 }
139140 })
@@ -153,7 +154,7 @@ func TestClientLeakCallbacks(t *testing.T) {
153154 c , _ , done := testClient (t , func (_ jsonrpc.Request ) jsonrpc.Response {
154155 // Only respond with messages that don't match an incoming request.
155156 return jsonrpc.Response {
156- ID : intPtr ( 100 ),
157+ ID : strPtr ( "foo" ),
157158 Result : mustMarshalJSON (t , []string {"foo" }),
158159 }
159160 })
@@ -198,7 +199,7 @@ func TestClientEchoLoop(t *testing.T) {
198199 }
199200
200201 // Keep incrementing the request ID to match the client.
201- id := int (atomic .AddInt64 (& reqID , 1 ))
202+ id := strconv . Itoa ( int (atomic .AddInt64 (& reqID , 1 ) ))
202203 return jsonrpc.Response {
203204 ID : & id ,
204205 Result : mustMarshalJSON (t , req .Params ),
@@ -273,8 +274,8 @@ func mustMarshalJSON(t *testing.T, v interface{}) []byte {
273274 return b
274275}
275276
276- func intPtr ( i int ) * int {
277- return & i
277+ func strPtr ( s string ) * string {
278+ return & s
278279}
279280
280281func panicf (format string , a ... interface {}) {
0 commit comments