Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 21 additions & 13 deletions spec/runners/unified/test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,8 @@ def set_initial_data
end

def run
kill_sessions

test_spec = UsingHash[self.test_spec]
ops = test_spec.use!('operations')
execute_operations(ops)
Expand All @@ -207,19 +209,7 @@ def stop?

def cleanup
if $kill_transactions || true
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
end
kill_sessions
$kill_transactions = nil
end

Expand Down Expand Up @@ -333,6 +323,24 @@ def disable_fail_points
end
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
end
end
end

def root_authorized_client
@root_authorized_client ||= ClientRegistry.instance.global_client('root_authorized')
end
Expand Down