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.8.10.2 spec/flydata/source_mysql/plugin_support/unsupported_query_handler_spec.rb
flydata-0.8.10.1 spec/flydata/source_mysql/plugin_support/unsupported_query_handler_spec.rb
flydata-0.8.9.11 spec/flydata/source_mysql/plugin_support/unsupported_query_handler_spec.rb
flydata-0.8.10 spec/flydata/source_mysql/plugin_support/unsupported_query_handler_spec.rb
flydata-0.8.9 spec/flydata/source_mysql/plugin_support/unsupported_query_handler_spec.rb
flydata-0.8.8 spec/flydata/source_mysql/plugin_support/unsupported_query_handler_spec.rb
flydata-0.8.7 spec/flydata/source_mysql/plugin_support/unsupported_query_handler_spec.rb
flydata-0.8.6 spec/flydata/source_mysql/plugin_support/unsupported_query_handler_spec.rb
flydata-0.8.5 spec/flydata/source_mysql/plugin_support/unsupported_query_handler_spec.rb
flydata-0.8.4 spec/flydata/source_mysql/plugin_support/unsupported_query_handler_spec.rb
flydata-0.8.3 spec/flydata/source_mysql/plugin_support/unsupported_query_handler_spec.rb
flydata-0.8.2 spec/flydata/source_mysql/plugin_support/unsupported_query_handler_spec.rb
flydata-0.8.1 spec/flydata/source_mysql/plugin_support/unsupported_query_handler_spec.rb
flydata-0.8.0 spec/flydata/source_mysql/plugin_support/unsupported_query_handler_spec.rb
flydata-0.7.19 spec/flydata/source_mysql/plugin_support/unsupported_query_handler_spec.rb
flydata-0.7.18 spec/flydata/source_mysql/plugin_support/unsupported_query_handler_spec.rb
flydata-0.7.17 spec/flydata/source_mysql/plugin_support/unsupported_query_handler_spec.rb
flydata-0.7.16 spec/flydata/source_mysql/plugin_support/unsupported_query_handler_spec.rb
flydata-0.7.15 spec/flydata/source_mysql/plugin_support/unsupported_query_handler_spec.rb
flydata-0.7.14 spec/flydata/source_mysql/plugin_support/unsupported_query_handler_spec.rb