@@ -284,6 +284,42 @@ func TestBolt4(ot *testing.T) {
284
284
AssertStringEqual (t , committedBookmark , bolt .Bookmark ())
285
285
})
286
286
287
+ // Verifies that current stream is discarded correctly even if it is larger
288
+ // than what is served by a single pull.
289
+ ot .Run ("Commit while streaming" , func (t * testing.T ) {
290
+ qid := int64 (2 )
291
+ bolt , cleanup := connectToServer (t , func (srv * bolt4server ) {
292
+ srv .accept (4 )
293
+ srv .waitForTxBegin ()
294
+ srv .send (msgSuccess , map [string ]interface {}{})
295
+ srv .waitForRun ()
296
+ srv .waitForPullN (1 )
297
+ // Send Pull response
298
+ srv .send (msgSuccess , map [string ]interface {}{"fields" : []interface {}{"k" }, "t_first" : int64 (1 ), "qid" : qid })
299
+ // ... and the record
300
+ srv .send (msgRecord , []interface {}{"v1" })
301
+ // ... and the batch summary
302
+ srv .send (msgSuccess , map [string ]interface {}{"has_more" : true })
303
+ // Wait for the discard message
304
+ srv .waitForDiscardN (- 1 , int (qid ))
305
+ // Respond to discard with has more to indicate that there are more records
306
+ srv .send (msgSuccess , map [string ]interface {}{"has_more" : true })
307
+ // Wait for the commit
308
+ srv .waitForTxCommit ()
309
+ srv .send (msgSuccess , map [string ]interface {}{"bookmark" : "x" })
310
+ })
311
+ defer cleanup ()
312
+ defer bolt .Close ()
313
+
314
+ tx , err := bolt .TxBegin (db.TxConfig {Mode : db .ReadMode })
315
+ AssertNoError (t , err )
316
+ _ , err = bolt .RunTx (tx , db.Command {Cypher : "Whatever" , FetchSize : 1 })
317
+ AssertNoError (t , err )
318
+
319
+ err = bolt .TxCommit (tx )
320
+ AssertNoError (t , err )
321
+ })
322
+
287
323
ot .Run ("Begin transaction with bookmark success" , func (t * testing.T ) {
288
324
committedBookmark := "cbm"
289
325
bolt , cleanup := connectToServer (t , func (srv * bolt4server ) {
0 commit comments