@@ -420,7 +420,7 @@ func TestClientBulkWrite(t *testing.T) {
420420 mt .Run ("input with greater than maxWriteBatchSize" , func (mt * mtest.T ) {
421421 var opsCnt []int
422422 monitor := & event.CommandMonitor {
423- Started : func (ctx context.Context , e * event.CommandStartedEvent ) {
423+ Started : func (_ context.Context , e * event.CommandStartedEvent ) {
424424 if e .CommandName == "bulkWrite" {
425425 v := e .Command .Lookup ("ops" )
426426 elems , err := v .Array ().Elements ()
@@ -453,7 +453,7 @@ func TestClientBulkWrite(t *testing.T) {
453453 mt .Run ("input with greater than maxMessageSizeBytes" , func (mt * mtest.T ) {
454454 var opsCnt []int
455455 monitor := & event.CommandMonitor {
456- Started : func (ctx context.Context , e * event.CommandStartedEvent ) {
456+ Started : func (_ context.Context , e * event.CommandStartedEvent ) {
457457 if e .CommandName == "bulkWrite" {
458458 v := e .Command .Lookup ("ops" )
459459 elems , err := v .Array ().Elements ()
@@ -533,7 +533,7 @@ func TestClientBulkWrite(t *testing.T) {
533533
534534 var eventCnt int
535535 monitor := & event.CommandMonitor {
536- Started : func (ctx context.Context , e * event.CommandStartedEvent ) {
536+ Started : func (_ context.Context , e * event.CommandStartedEvent ) {
537537 if e .CommandName == "bulkWrite" {
538538 eventCnt ++
539539 }
@@ -578,11 +578,12 @@ func TestClientBulkWrite(t *testing.T) {
578578
579579 mt .Run ("bulkWrite handles a cursor requiring a getMore" , func (mt * mtest.T ) {
580580 coll := mt .CreateCollection (mtest.Collection {DB : "db" , Name : "coll" }, true )
581- coll .Drop (context .Background ())
581+ err := coll .Drop (context .Background ())
582+ require .NoError (mt , err , "Drop error" )
582583
583584 var getMoreCalled bool
584585 monitor := & event.CommandMonitor {
585- Started : func (ctx context.Context , e * event.CommandStartedEvent ) {
586+ Started : func (_ context.Context , e * event.CommandStartedEvent ) {
586587 if e .CommandName == "getMore" {
587588 getMoreCalled = true
588589 }
@@ -592,7 +593,8 @@ func TestClientBulkWrite(t *testing.T) {
592593 var hello struct {
593594 MaxBsonObjectSize int
594595 }
595- require .NoError (mt , mt .DB .RunCommand (context .Background (), bson.D {{"hello" , 1 }}).Decode (& hello ), "Hello error" )
596+ err = mt .DB .RunCommand (context .Background (), bson.D {{"hello" , 1 }}).Decode (& hello )
597+ require .NoError (mt , err , "Hello error" )
596598 upsert := true
597599 models := (& mongo.ClientWriteModels {}).
598600 AppendUpdateOne (& mongo.ClientUpdateOneModel {
@@ -616,11 +618,12 @@ func TestClientBulkWrite(t *testing.T) {
616618
617619 mt .Run ("bulkWrite handles a cursor requiring a getMore within a transaction" , func (mt * mtest.T ) {
618620 coll := mt .CreateCollection (mtest.Collection {DB : "db" , Name : "coll" }, true )
619- coll .Drop (context .Background ())
621+ err := coll .Drop (context .Background ())
622+ require .NoError (mt , err , "Drop error" )
620623
621624 var getMoreCalled bool
622625 monitor := & event.CommandMonitor {
623- Started : func (ctx context.Context , e * event.CommandStartedEvent ) {
626+ Started : func (_ context.Context , e * event.CommandStartedEvent ) {
624627 if e .CommandName == "getMore" {
625628 getMoreCalled = true
626629 }
@@ -630,7 +633,8 @@ func TestClientBulkWrite(t *testing.T) {
630633 var hello struct {
631634 MaxBsonObjectSize int
632635 }
633- require .NoError (mt , mt .DB .RunCommand (context .Background (), bson.D {{"hello" , 1 }}).Decode (& hello ), "Hello error" )
636+ err = mt .DB .RunCommand (context .Background (), bson.D {{"hello" , 1 }}).Decode (& hello )
637+ require .NoError (mt , err , "Hello error" )
634638 session , err := mt .Client .StartSession ()
635639 require .NoError (mt , err , "StartSession error" )
636640 defer session .EndSession (context .Background ())
@@ -648,7 +652,7 @@ func TestClientBulkWrite(t *testing.T) {
648652 Update : bson.D {{"$set" , bson.D {{"x" , 1 }}}},
649653 Upsert : & upsert ,
650654 })
651- result , err := session .WithTransaction (context .TODO (), func (ctx mongo.SessionContext ) (interface {}, error ) {
655+ result , err := session .WithTransaction (context .Background (), func (mongo.SessionContext ) (interface {}, error ) {
652656 return mt .Client .BulkWrite (context .Background (), models , options .ClientBulkWrite ().SetVerboseResults (true ))
653657 })
654658 require .NoError (mt , err , "BulkWrite error" )
@@ -659,7 +663,7 @@ func TestClientBulkWrite(t *testing.T) {
659663 assert .True (mt , getMoreCalled , "the getMore was not called" )
660664 })
661665
662- mt .Run ("bulkWrite handles a getMore error" , func (mt * mtest.T ) {
666+ mt .Run ("bulkWrite handles a getMore error" , func (_ * mtest.T ) {
663667 })
664668
665669 mt .Run ("bulkWrite returns error for unacknowledged too-large insert" , func (mt * mtest.T ) {
0 commit comments