@@ -319,18 +319,18 @@ func parseMaxAwaitTime(mt *mtest.T, evt *event.CommandStartedEvent) int64 {
319319 return got
320320}
321321
322- func tadcFindFactory (ctx context.Context , mt * mtest.T ) ( * mongo.Cursor , func () error ) {
322+ func tadcFindFactory (ctx context.Context , mt * mtest.T ) * mongo.Cursor {
323323 mt .Helper ()
324324
325325 initCollection (mt , mt .Coll )
326326 cur , err := mt .Coll .Find (ctx , bson.D {{"x" , 1 }},
327327 options .Find ().SetBatchSize (1 ).SetCursorType (options .TailableAwait ))
328328 require .NoError (mt , err , "Find error: %v" , err )
329329
330- return cur , func () error { return cur . Close ( context . Background ()) }
330+ return cur
331331}
332332
333- func tadcAggregateFactory (ctx context.Context , mt * mtest.T ) ( * mongo.Cursor , func () error ) {
333+ func tadcAggregateFactory (ctx context.Context , mt * mtest.T ) * mongo.Cursor {
334334 mt .Helper ()
335335
336336 initCollection (mt , mt .Coll )
@@ -341,10 +341,10 @@ func tadcAggregateFactory(ctx context.Context, mt *mtest.T) (*mongo.Cursor, func
341341 cursor , err := mt .Coll .Aggregate (ctx , pipe , opts )
342342 require .NoError (mt , err , "Aggregate error: %v" , err )
343343
344- return cursor , func () error { return cursor . Close ( context . Background ()) }
344+ return cursor
345345}
346346
347- func tadcRunCommandCursorFactory (ctx context.Context , mt * mtest.T ) ( * mongo.Cursor , func () error ) {
347+ func tadcRunCommandCursorFactory (ctx context.Context , mt * mtest.T ) * mongo.Cursor {
348348 mt .Helper ()
349349
350350 initCollection (mt , mt .Coll )
@@ -358,7 +358,7 @@ func tadcRunCommandCursorFactory(ctx context.Context, mt *mtest.T) (*mongo.Curso
358358 })
359359 require .NoError (mt , err , "RunCommandCursor error: %v" , err )
360360
361- return cur , func () error { return cur . Close ( context . Background ()) }
361+ return cur
362362}
363363
364364// For tailable awaitData cursors, the maxTimeMS for a getMore should be
@@ -374,12 +374,12 @@ func TestCursor_tailableAwaitData_applyRemainingTimeout(t *testing.T) {
374374 cappedOpts := options .CreateCollection ().SetCapped (true ).
375375 SetSizeInBytes (1024 * 64 )
376376
377- // TODO(SERVER-96344 ): mongos doesn't honor a failpoint's full blockTimeMS.
377+ // TODO(GODRIVER-3328 ): mongos doesn't honor a failpoint's full blockTimeMS.
378378 baseTopologies := []mtest.TopologyKind {mtest .Single , mtest .LoadBalanced , mtest .ReplicaSet }
379379
380380 type testCase struct {
381381 name string
382- factory func (ctx context.Context , mt * mtest.T ) ( * mongo.Cursor , func () error )
382+ factory func (ctx context.Context , mt * mtest.T ) * mongo.Cursor
383383 opTimeout bool
384384 topologies []mtest.TopologyKind
385385
@@ -434,7 +434,7 @@ func TestCursor_tailableAwaitData_applyRemainingTimeout(t *testing.T) {
434434 },
435435 }
436436
437- mtOpts := mtest .NewOptions ().CollectionCreateOptions (cappedOpts )
437+ mtOpts := mtest .NewOptions ().CollectionCreateOptions (cappedOpts ). MinServerVersion ( "4.2" )
438438
439439 for _ , tc := range cases {
440440 caseOpts := mtOpts
@@ -463,8 +463,8 @@ func TestCursor_tailableAwaitData_applyRemainingTimeout(t *testing.T) {
463463 defer cancel ()
464464 }
465465
466- cur , cleanup := tc .factory (ctx , mt )
467- defer func () { assert .NoError (mt , cleanup ( )) }()
466+ cur := tc .factory (ctx , mt )
467+ defer func () { assert .NoError (mt , cur . Close ( context . Background () )) }()
468468
469469 require .NoError (mt , cur .Err ())
470470
0 commit comments