Sha256: cb8197621e64c0f488dd91369ea2f64afc378518bbaa846409e420350594ff24

Contents?: true

Size: 1.87 KB

Versions: 8

Compression:

Stored size: 1.87 KB

Contents

module Mysql
  shared_context "query handler context" do
    let(:target_database) { "testdb" }
    let(:database) { target_database }
    let(:table) { "foo" }
    let(:seq) { 200 }
    let(:binlog_pos_string) { "mysql-bin.000065\t120" }
    let(:binlog_pos_object) { FlydataCore::Mysql::BinlogPos.new(binlog_pos_string) }
    let(:sync_fm) do
      r = double('sync_fm')
      allow(r).to receive(:get_table_source_raw_pos).and_return(binlog_pos_string)
      allow(r).to receive(:increment_and_save_table_position).with(table).and_yield(seq).and_return(nil)
      allow(r).to receive(:delete_table_source_pos).with(table)
      r
    end
    let(:table_meta) { double'table_meta' }
    let(:current_binlog_file) { "mysql-bin.000066" }
    let(:tag) { "some_tag" }
    let(:table_rev) { 1 }
    let(:flydata_record_version) { 2 }
    let(:context) do
      r = double('context')
      allow(r).to receive(:sync_fm).and_return(sync_fm)
      allow(r).to receive(:database).and_return(target_database)
      allow(r).to receive(:tables).and_return([table])
      allow(r).to receive(:table_meta).and_return(table_meta)
      allow(r).to receive(:current_binlog_file).and_return(current_binlog_file)
      allow(r).to receive(:omit_events).and_return({})
      allow(r).to receive(:table_revs).and_return({ table => table_rev})
      allow(r).to receive(:tag).and_return(tag)
      r
    end
    let(:query) { "a_query" }
    let(:normalized_query) { 'a_query' }
    let(:event_length) { 20 }
    let(:next_position) { 200 }
    let(:timestamp) { 1427973738 }
    let(:record) do
      {
        'db_name' => database,
        'query' => query,
        'table_name' => table,
        'normalized_query' => normalized_query,
        'next_position' => next_position,
        'event_length' => event_length,
        'timestamp' => "#{timestamp}",
      }
    end
    subject { described_class.new(context) }
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
flydata-0.6.11 spec/flydata/fluent-plugins/mysql/shared_query_handler_context.rb
flydata-0.6.10 spec/flydata/fluent-plugins/mysql/shared_query_handler_context.rb
flydata-0.6.9 spec/flydata/fluent-plugins/mysql/shared_query_handler_context.rb
flydata-0.6.8 spec/flydata/fluent-plugins/mysql/shared_query_handler_context.rb
flydata-0.6.7 spec/flydata/fluent-plugins/mysql/shared_query_handler_context.rb
flydata-0.6.6 spec/flydata/fluent-plugins/mysql/shared_query_handler_context.rb
flydata-0.6.5 spec/flydata/fluent-plugins/mysql/shared_query_handler_context.rb
flydata-0.6.4 spec/flydata/fluent-plugins/mysql/shared_query_handler_context.rb