spec/support/change_streams.rb in mongo-2.6.4 vs spec/support/change_streams.rb in mongo-2.7.0.rc0

- old
+ new

@@ -1,6 +1,6 @@ -# Copyright (C) 2014-2018 MongoDB, Inc. +# Copyright (C) 2014-2019 MongoDB, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # @@ -97,19 +97,19 @@ @db1_name = db1 @db2_name = db2 end def setup_test - @global_client = ADMIN_AUTHORIZED_TEST_CLIENT.use('admin') + @global_client = ClientRegistry.instance.global_client('root_authorized').use('admin') @db1 = @global_client.use(@db1_name).database.tap(&:drop) @db2 = @global_client.use(@db2_name).database.tap(&:drop) @db1[@coll1_name].create @db2[@coll2_name].create - client = ADMIN_AUTHORIZED_TEST_CLIENT.with( + client = ClientRegistry.instance.global_client('root_authorized').with( database: @db1_name, app_name: 'this is used solely to force the new client to create its own cluster') client.subscribe(Mongo::Monitoring::COMMAND, EventSubscriber.clear_events!) @target = case @target_type @@ -154,13 +154,13 @@ events: events, } end def teardown_test - @global_client.close - @db1.drop - @db2.drop + @global_client && @global_client.close + @db1 && @db1.drop + @db2 && @db2.drop end def match_result?(result) case @result.first.first when 'success' @@ -178,10 +178,10 @@ private def events EventSubscriber.started_events.reduce([]) do |evs, e| - next evs if [:saslStart, :saslContinue, :killCursors].include?(e.command_name) + next evs if %w(saslStart saslContinue killCursors).include?(e.command_name) evs << { 'command_started_event' => { 'command' => e.command, 'command_name' => e.command_name.to_s,