Sha256: 873a4bd669f421ecf28ef098c1f73bb8ee16cebd060d0f10844088bfd5788e54

Contents?: true

Size: 1.26 KB

Versions: 19

Compression:

Stored size: 1.26 KB

Contents

require 'fluent_plugins_spec_helper'
require 'flydata/source_mysql/plugin_support/drop_table_query_handler'
require 'flydata/source_mysql/plugin_support/shared_query_handler_context'

module Flydata::SourceMysql::PluginSupport
  describe DropTableQueryHandler do
    include_context "query handler context"

    let(:query) { "DROP TABLE #{table}" }
    let(:normalized_query) { "DROP TABLE #{table}" }
    let(:subject_object) { described_class.new(context) }

    describe '#process' do
      subject { subject_object.process(record) }

      it 'handles a drop table event' do
        expect(Fluent::Engine).to receive(:emit_array).once
        expect(sync_fm).to receive(:increment_table_rev).with(table, 1)
        expect(sync_fm).to receive(:save_table_position).with(table, 200)
        expect(sync_fm).to receive(:save_table_source_pos).with(table, FlydataCore::Mysql::BinlogPos.infinity_src_pos, destination: :positions)
        subject
      end

      context 'when unsupported table is dropped' do
        let(:normalized_query) { "DROP TABLE bar" }
        it 'ignore a drop table event' do
          expect(Fluent::Engine).to receive(:emit_array).never
          expect(sync_fm).to receive(:save_table_source_pos).never
          subject
        end
      end
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
flydata-0.8.10.2 spec/flydata/source_mysql/plugin_support/drop_table_query_handler_spec.rb
flydata-0.8.10.1 spec/flydata/source_mysql/plugin_support/drop_table_query_handler_spec.rb
flydata-0.8.9.11 spec/flydata/source_mysql/plugin_support/drop_table_query_handler_spec.rb
flydata-0.8.10 spec/flydata/source_mysql/plugin_support/drop_table_query_handler_spec.rb
flydata-0.8.9 spec/flydata/source_mysql/plugin_support/drop_table_query_handler_spec.rb
flydata-0.8.8 spec/flydata/source_mysql/plugin_support/drop_table_query_handler_spec.rb
flydata-0.8.7 spec/flydata/source_mysql/plugin_support/drop_table_query_handler_spec.rb
flydata-0.8.6 spec/flydata/source_mysql/plugin_support/drop_table_query_handler_spec.rb
flydata-0.8.5 spec/flydata/source_mysql/plugin_support/drop_table_query_handler_spec.rb
flydata-0.8.4 spec/flydata/source_mysql/plugin_support/drop_table_query_handler_spec.rb
flydata-0.8.3 spec/flydata/source_mysql/plugin_support/drop_table_query_handler_spec.rb
flydata-0.8.2 spec/flydata/source_mysql/plugin_support/drop_table_query_handler_spec.rb
flydata-0.8.1 spec/flydata/source_mysql/plugin_support/drop_table_query_handler_spec.rb
flydata-0.8.0 spec/flydata/source_mysql/plugin_support/drop_table_query_handler_spec.rb
flydata-0.7.19 spec/flydata/source_mysql/plugin_support/drop_table_query_handler_spec.rb
flydata-0.7.18 spec/flydata/source_mysql/plugin_support/drop_table_query_handler_spec.rb
flydata-0.7.17 spec/flydata/source_mysql/plugin_support/drop_table_query_handler_spec.rb
flydata-0.7.16 spec/flydata/source_mysql/plugin_support/drop_table_query_handler_spec.rb
flydata-0.7.15 spec/flydata/source_mysql/plugin_support/drop_table_query_handler_spec.rb