@@ -25,9 +25,9 @@ func (s *ConnectionSuite) TestConnection_Query_Ok(c *test.C) {
25
25
header := respHeader (token , respData )
26
26
27
27
conn := & connMock {}
28
- conn .On ("Write" , writeData ).Return (len (writeData ), nil )
29
- conn .On ("Read" , respHeaderLen ).Return (header , respHeaderLen , nil )
30
- conn .On ("Read" , len (respData )).Return (respData , len (respData ), nil )
28
+ conn .On ("Write" , writeData ).Return (len (writeData ), nil , nil )
29
+ conn .On ("Read" , respHeaderLen ).Return (header , respHeaderLen , nil , nil )
30
+ conn .On ("Read" , len (respData )).Return (respData , len (respData ), nil , nil )
31
31
conn .On ("Close" ).Return (nil )
32
32
33
33
connection := newConnection (conn , "addr" , & ConnectOpts {})
@@ -60,9 +60,9 @@ func (s *ConnectionSuite) TestConnection_Query_DefaultDBOk(c *test.C) {
60
60
header := respHeader (token , respData )
61
61
62
62
conn := & connMock {}
63
- conn .On ("Write" , writeData ).Return (len (writeData ), nil )
64
- conn .On ("Read" , respHeaderLen ).Return (header , respHeaderLen , nil )
65
- conn .On ("Read" , len (respData )).Return (respData , len (respData ), nil )
63
+ conn .On ("Write" , writeData ).Return (len (writeData ), nil , nil )
64
+ conn .On ("Read" , respHeaderLen ).Return (header , respHeaderLen , nil , nil )
65
+ conn .On ("Read" , len (respData )).Return (respData , len (respData ), nil , nil )
66
66
conn .On ("Close" ).Return (nil )
67
67
68
68
connection := newConnection (conn , "addr" , & ConnectOpts {Database : "db" })
@@ -106,7 +106,7 @@ func (s *ConnectionSuite) TestConnection_Query_SendFail(c *test.C) {
106
106
writeData := serializeQuery (token , q )
107
107
108
108
conn := & connMock {}
109
- conn .On ("Write" , writeData ).Return (0 , io .EOF )
109
+ conn .On ("Write" , writeData ).Return (0 , io .EOF , nil )
110
110
111
111
connection := newConnection (conn , "addr" , & ConnectOpts {})
112
112
response , cursor , err := connection .Query (ctx , q )
@@ -126,9 +126,9 @@ func (s *ConnectionSuite) TestConnection_Query_NoReplyOk(c *test.C) {
126
126
header := respHeader (token , respData )
127
127
128
128
conn := & connMock {}
129
- conn .On ("Write" , writeData ).Return (len (writeData ), nil )
130
- conn .On ("Read" , respHeaderLen ).Return (header , respHeaderLen , nil )
131
- conn .On ("Read" , len (respData )).Return (respData , len (respData ), nil )
129
+ conn .On ("Write" , writeData ).Return (len (writeData ), nil , nil )
130
+ conn .On ("Read" , respHeaderLen ).Return (header , respHeaderLen , nil , nil )
131
+ conn .On ("Read" , len (respData )).Return (respData , len (respData ), nil , nil )
132
132
conn .On ("Close" ).Return (nil )
133
133
134
134
connection := newConnection (conn , "addr" , & ConnectOpts {})
@@ -151,9 +151,8 @@ func (s *ConnectionSuite) TestConnection_Query_TimeoutWrite(c *test.C) {
151
151
stopData := serializeQuery (token , newStopQuery (token ))
152
152
153
153
conn := & connMock {}
154
- conn .On ("Write" , writeData ).Return (len (writeData ), nil )
155
- conn .On ("Write" , stopData ).Return (len (stopData ), nil )
156
- conn .On ("SetWriteDeadline" ).Return (nil )
154
+ conn .On ("Write" , writeData ).Return (len (writeData ), nil , nil )
155
+ conn .On ("Write" , stopData ).Return (len (stopData ), nil , nil )
157
156
158
157
connection := newConnection (conn , "addr" , & ConnectOpts {ReadTimeout : time .Millisecond , WriteTimeout : time .Millisecond })
159
158
connection .readRequestsChan = make (chan tokenAndPromise , 0 )
@@ -174,9 +173,8 @@ func (s *ConnectionSuite) TestConnection_Query_TimeoutRead(c *test.C) {
174
173
stopData := serializeQuery (token , newStopQuery (token ))
175
174
176
175
conn := & connMock {}
177
- conn .On ("Write" , writeData ).Return (len (writeData ), nil )
178
- conn .On ("Write" , stopData ).Return (len (stopData ), nil )
179
- conn .On ("SetWriteDeadline" ).Return (nil )
176
+ conn .On ("Write" , writeData ).Return (len (writeData ), nil , 10 * time .Millisecond )
177
+ conn .On ("Write" , stopData ).Return (len (stopData ), nil , nil )
180
178
181
179
connection := newConnection (conn , "addr" , & ConnectOpts {ReadTimeout : time .Millisecond , WriteTimeout : time .Millisecond })
182
180
response , cursor , err := connection .Query (ctx , q )
@@ -196,7 +194,7 @@ func (s *ConnectionSuite) TestConnection_Query_SendFailTracing(c *test.C) {
196
194
writeData := serializeQuery (token , q )
197
195
198
196
conn := & connMock {}
199
- conn .On ("Write" , writeData ).Return (0 , io .EOF )
197
+ conn .On ("Write" , writeData ).Return (0 , io .EOF , nil )
200
198
201
199
connection := newConnection (conn , "addr" , & ConnectOpts {UseOpentracing : true })
202
200
response , cursor , err := connection .Query (ctx , q )
@@ -306,8 +304,7 @@ func (s *ConnectionSuite) TestConnection_readResponse_TimeoutHeader(c *test.C) {
306
304
timeout := time .Second
307
305
308
306
conn := & connMock {}
309
- conn .On ("SetReadDeadline" ).Return (nil )
310
- conn .On ("Read" , respHeaderLen ).Return (nil , 0 , io .EOF )
307
+ conn .On ("Read" , respHeaderLen ).Return (nil , 0 , io .EOF , nil )
311
308
312
309
connection := newConnection (conn , "addr" , & ConnectOpts {ReadTimeout : timeout })
313
310
@@ -325,8 +322,8 @@ func (s *ConnectionSuite) TestConnection_readResponse_BodySocketErr(c *test.C) {
325
322
header := respHeader (token , respData )
326
323
327
324
conn := & connMock {}
328
- conn .On ("Read" , respHeaderLen ).Return (header , len (header ), nil )
329
- conn .On ("Read" , len (respData )).Return (nil , 0 , io .EOF )
325
+ conn .On ("Read" , respHeaderLen ).Return (header , len (header ), nil , nil )
326
+ conn .On ("Read" , len (respData )).Return (nil , 0 , io .EOF , nil )
330
327
331
328
connection := newConnection (conn , "addr" , & ConnectOpts {})
332
329
@@ -344,8 +341,8 @@ func (s *ConnectionSuite) TestConnection_readResponse_BodyUnmarshalErr(c *test.C
344
341
header := respHeader (token , respData )
345
342
346
343
conn := & connMock {}
347
- conn .On ("Read" , respHeaderLen ).Return (header , len (header ), nil )
348
- conn .On ("Read" , len (respData )).Return (make ([]byte , len (respData )), len (respData ), nil )
344
+ conn .On ("Read" , respHeaderLen ).Return (header , len (header ), nil , nil )
345
+ conn .On ("Read" , len (respData )).Return (make ([]byte , len (respData )), len (respData ), nil , nil )
349
346
350
347
connection := newConnection (conn , "addr" , & ConnectOpts {})
351
348
0 commit comments