Skip to content

RUBY-2220 add file name context to command monitoring spec #2288

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 30, 2021
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
54 changes: 28 additions & 26 deletions spec/spec_tests/command_monitoring_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,40 +9,42 @@
describe 'Command Monitoring Events' do

COMMAND_MONITORING_TESTS.each do |file|
context File.basename(file) do

spec = Mongo::CommandMonitoring::Spec.new(file)
spec = Mongo::CommandMonitoring::Spec.new(file)

spec.tests.each do |test|
context(test.description) do
spec.tests.each do |test|
context(test.description) do

if test.min_server_fcv
min_server_fcv test.min_server_fcv
end
if test.max_server_version
max_server_version test.max_server_version
end
if test.min_server_fcv
min_server_fcv test.min_server_fcv
end
if test.max_server_version
max_server_version test.max_server_version
end

let(:subscriber) do
EventSubscriber.new
end
let(:subscriber) do
EventSubscriber.new
end

let(:monitoring) do
authorized_client.send(:monitoring)
end
let(:monitoring) do
authorized_client.send(:monitoring)
end

before do
authorized_collection.find.delete_many
authorized_client.subscribe(Mongo::Monitoring::COMMAND, subscriber)
end
before do
authorized_collection.find.delete_many
authorized_client.subscribe(Mongo::Monitoring::COMMAND, subscriber)
end

test.expectations.each_with_index do |expectation, index|
test.expectations.each_with_index do |expectation, index|

it "generates a #{expectation.event_name} for #{expectation.command_name}" do
begin
test.run(authorized_collection, subscriber)
check_event(subscriber, index, expectation)
rescue Mongo::Error::OperationFailure, Mongo::Error::BulkWriteError
check_event(subscriber, index, expectation)
it "generates a #{expectation.event_name} for #{expectation.command_name}" do
begin
test.run(authorized_collection, subscriber)
check_event(subscriber, index, expectation)
rescue Mongo::Error::OperationFailure, Mongo::Error::BulkWriteError
check_event(subscriber, index, expectation)
end
end
end
end
Expand Down