Skip to content

Commit

Permalink
RUBY-2574 Ignore Unauthorized error when executing killAllSessions in…
Browse files Browse the repository at this point in the history
… unified test runner for drivers-atlas-testing (#2212)

Co-authored-by: Oleg Pudeyev <oleg@bsdpower.com>
  • Loading branch information
p-mongo and p committed Apr 21, 2021
1 parent 1d716fa commit 16af76b
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions spec/runners/unified/test.rb
Expand Up @@ -350,19 +350,20 @@ def disable_fail_points
end

def kill_sessions
if options[:kill_sessions] != false
begin
root_authorized_client.command(
killAllSessions: [],
)
rescue Mongo::Error::OperationFailure => e
if e.code == 11601
# operation was interrupted, ignore
elsif e.code == 59
# no such command (old server), ignore
else
raise
end
begin
root_authorized_client.command(
killAllSessions: [],
)
rescue Mongo::Error::OperationFailure => e
if e.code == 11601
# operation was interrupted, ignore. SERVER-38335
elsif e.code == 13
# Unauthorized - e.g. when running in Atlas as part of
# drivers-atlas-testing, ignore. SERVER-54216
elsif e.code == 59
# no such command (old server), ignore
else
raise
end
end
end
Expand Down

0 comments on commit 16af76b

Please sign in to comment.