File tree Expand file tree Collapse file tree 1 file changed +12
-5
lines changed
mongo/integration/unified Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -17,8 +17,11 @@ import (
17
17
"go.mongodb.org/mongo-driver/mongo/options"
18
18
)
19
19
20
- const (
21
- errorInterrupted int32 = 11601
20
+ var (
21
+ ignoredKillAllSessionsErrors = []int {
22
+ 11601 , // Interrupted, for SERVER-38335 on server versions below 4.2
23
+ 13 , // Unauthorized, for SERVER-54216 on atlas
24
+ }
22
25
)
23
26
24
27
// terminateOpenSessions executes a killAllSessions command to ensure that sesssions left open on the server by a test
@@ -34,9 +37,13 @@ func terminateOpenSessions(ctx context.Context) error {
34
37
}
35
38
36
39
err := client .Database ("admin" ).RunCommand (ctx , cmd ).Err ()
37
- if ce , ok := err .(mongo.CommandError ); ok && ce .Code == errorInterrupted {
38
- // Workaround for SERVER-38335 on server versions below 4.2.
39
- err = nil
40
+ if se , ok := err .(mongo.ServerError ); ok {
41
+ for _ , code := range ignoredKillAllSessionsErrors {
42
+ if se .HasErrorCode (code ) {
43
+ err = nil
44
+ break
45
+ }
46
+ }
40
47
}
41
48
return err
42
49
}
You can’t perform that action at this time.
0 commit comments