Sha256: 81cd52211859820eaa1e29e32339c88892bb6d6c40483587cddb2c0ded1afbc6
Contents?: true
Size: 1.94 KB
Versions: 8
Compression:
Stored size: 1.94 KB
Contents
require 'fluent_plugins_spec_helper' require 'flydata/fluent-plugins/mysql/drop_database_query_handler' require 'flydata/fluent-plugins/mysql/shared_query_handler_context' module Mysql describe DropDatabaseQueryHandler do include_context "query handler context" describe '#process' do let(:drop_database_query) { "DROP database foo" } before do allow(record).to receive(:[]).with("query").and_return(drop_database_query) allow(record).to receive(:[]).with("normalized_query").and_return(drop_database_query) end shared_examples "process drop database queries correctly" do let(:expected_record) do { query: drop_database_query, type: :drop_database, respect_order: true, src_pos: "#{current_binlog_file}\t#{next_position - event_length}", v: flydata_record_version } end context "for the registered database" do it "should call Fluent's emit with appropriate params" do # Should mock up the method to return true #expect(Fluent::Engine).to receive(:emit).with(tag, timestamp, expected_record) expect(Fluent::Engine).to receive(:emit).never expect($log).to receive(:warn) expect(subject.process(record)) end end end shared_examples "skip processing queries" do it "should not call Fluent's emit" do expect(Fluent::Engine).to receive(:emit).never subject.process(record) end end context "drop database queries with database keyword" do let(:drop_database_query) { "DROP DATABASE foo" } include_examples "process drop database queries correctly" end context "drop database queries with schema keyword" do let(:drop_database_query) { "DROP SCHEMA foo" } include_examples "process drop database queries correctly" end end end end
Version data entries
8 entries across 8 versions & 1 rubygems