Sha256: 80dea60ee7878fb88e793a132987b34e5e460fc371d88fb9ad606c8fd6e09a7b

Contents?: true

Size: 1.73 KB

Versions: 5

Compression:

Stored size: 1.73 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(:sync_fm) do
      r = double('sync_fm')
      allow(r).to receive(:get_table_binlog_pos).and_return("mysql-bin.000065\t120")
      allow(r).to receive(:increment_and_save_table_position).with(table).and_yield(seq).and_return(nil)
      allow(r).to receive(:delete_table_binlog_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

5 entries across 5 versions & 1 rubygems

Version Path
flydata-0.6.3 spec/flydata/fluent-plugins/mysql/shared_query_handler_context.rb
flydata-0.6.2 spec/flydata/fluent-plugins/mysql/shared_query_handler_context.rb
flydata-0.6.1 spec/flydata/fluent-plugins/mysql/shared_query_handler_context.rb
flydata-0.6.0 spec/flydata/fluent-plugins/mysql/shared_query_handler_context.rb
flydata-0.5.21 spec/flydata/fluent-plugins/mysql/shared_query_handler_context.rb