@@ -23,6 +23,8 @@ import (
23
23
"go.mongodb.org/mongo-driver/mongo"
24
24
"go.mongodb.org/mongo-driver/mongo/integration/mtest"
25
25
"go.mongodb.org/mongo-driver/mongo/options"
26
+ "go.mongodb.org/mongo-driver/x/mongo/driver"
27
+ "go.mongodb.org/mongo-driver/x/mongo/driver/topology"
26
28
)
27
29
28
30
type netErr struct {
@@ -515,13 +517,25 @@ func TestErrors(t *testing.T) {
515
517
err error
516
518
result bool
517
519
}{
518
- {"context timeout" , mongo.CommandError {100 , "" , []string {"other" }, "blah" , context .DeadlineExceeded , nil }, true },
519
- {"ServerError NetworkTimeoutError" , mongo.CommandError {100 , "" , []string {"NetworkTimeoutError" }, "blah" , nil , nil }, true },
520
- {"ServerError ExceededTimeLimitError" , mongo.CommandError {100 , "" , []string {"ExceededTimeLimitError" }, "blah" , nil , nil }, true },
521
- {"ServerError false" , mongo.CommandError {100 , "" , []string {"other" }, "blah" , nil , nil }, false },
522
- {"net error true" , mongo.CommandError {100 , "" , []string {"other" }, "blah" , netErr {true }, nil }, true },
520
+ {"context timeout" , mongo.CommandError {
521
+ 100 , "" , []string {"other" }, "blah" , context .DeadlineExceeded , nil }, true },
522
+ {"deadline would be exceeded" , mongo.CommandError {
523
+ 100 , "" , []string {"other" }, "blah" , driver .ErrDeadlineWouldBeExceeded , nil }, true },
524
+ {"server selection timeout" , mongo.CommandError {
525
+ 100 , "" , []string {"other" }, "blah" , topology .ErrServerSelectionTimeout , nil }, true },
526
+ {"wait queue timeout" , mongo.CommandError {
527
+ 100 , "" , []string {"other" }, "blah" , topology.WaitQueueTimeoutError {}, nil }, true },
528
+ {"ServerError NetworkTimeoutError" , mongo.CommandError {
529
+ 100 , "" , []string {"NetworkTimeoutError" }, "blah" , nil , nil }, true },
530
+ {"ServerError ExceededTimeLimitError" , mongo.CommandError {
531
+ 100 , "" , []string {"ExceededTimeLimitError" }, "blah" , nil , nil }, true },
532
+ {"ServerError false" , mongo.CommandError {
533
+ 100 , "" , []string {"other" }, "blah" , nil , nil }, false },
534
+ {"net error true" , mongo.CommandError {
535
+ 100 , "" , []string {"other" }, "blah" , netErr {true }, nil }, true },
523
536
{"net error false" , netErr {false }, false },
524
- {"wrapped error" , wrappedError {mongo.CommandError {100 , "" , []string {"other" }, "blah" , context .DeadlineExceeded , nil }}, true },
537
+ {"wrapped error" , wrappedError {mongo.CommandError {
538
+ 100 , "" , []string {"other" }, "blah" , context .DeadlineExceeded , nil }}, true },
525
539
{"other error" , errors .New ("foo" ), false },
526
540
}
527
541
for _ , tc := range testCases {
0 commit comments