Sha256: 98ec566b7abeaea1640f496378fa753b60e7996a49be3d72813502bc9038f068

Contents?: true

Size: 1.26 KB

Versions: 29

Compression:

Stored size: 1.26 KB

Contents

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

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

    describe '#process' do
      before do
        record['normalized_query'] = normalized_query
      end

      context 'when the query includes a sync table' do
        let(:normalized_query) { 'drop table foo;' }
        it do
          expect($log).to receive(:info).with("{:type=>:unsupported_query, :query=>\"drop table foo;\"} at \"mysql-bin.000066\t180\"")
          subject.process(record)
        end
      end

      context 'when the query does not include a sync table' do
        let(:normalized_query) { 'drop table bar;' }
        it do
          expect($log).to receive(:info).never
          subject.process(record)
        end
      end

      context 'when the query is issued in another database' do
        let(:normalized_query) { 'drop table foo;' }
        before do
          record['db_name'] = 'another_db'
        end
        it do
          expect($log).to receive(:info).never
          subject.process(record)
        end
      end
    end
  end
end

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
flydata-0.7.13 spec/flydata/source_mysql/plugin_support/unsupported_query_handler_spec.rb
flydata-0.7.12 spec/flydata/source_mysql/plugin_support/unsupported_query_handler_spec.rb
flydata-0.7.11 spec/flydata/source_mysql/plugin_support/unsupported_query_handler_spec.rb
flydata-0.7.10 spec/flydata/source_mysql/plugin_support/unsupported_query_handler_spec.rb
flydata-0.7.9 spec/flydata/source_mysql/plugin_support/unsupported_query_handler_spec.rb
flydata-0.7.8 spec/flydata/source_mysql/plugin_support/unsupported_query_handler_spec.rb
flydata-0.7.7 spec/flydata/source_mysql/plugin_support/unsupported_query_handler_spec.rb
flydata-0.7.6 spec/flydata/source_mysql/plugin_support/unsupported_query_handler_spec.rb
flydata-0.7.5 spec/flydata/source_mysql/plugin_support/unsupported_query_handler_spec.rb