Sha256: dbef699444aa8b4a6b809e145221ab7d467e695688236b8905a07602887da78c

Contents?: true

Size: 1.84 KB

Versions: 34

Compression:

Stored size: 1.84 KB

Contents

require 'timecop'
require 'fileutils'
require 'flydata/fluent-plugins/flydata_plugin_ext/flydata_sync_context'

module Fluent

# plugin and config is required
shared_examples 'flydata sync shared examples' do
  include_context 'flydata sync context'

  describe '#configure' do
    let(:config) do
      c = default_config
      c = replace_conf(c, 'tables', 'table_1,table_2')
      c = replace_conf(c, 'tables_append_only', 'table_3,table_4')
      c
    end

    subject { Test.configure_plugin(plugin, config) }

    before do
      create_table_pos_file(%w(table_1 table_2 table_3))
      create_table_rev_file('table_1', '2')
      subject
    end

    it { expect(config_value(:@data_entry_name)).to be_kind_of(String) }
    it { expect(config_value(:@data_entry_type)).to be_kind_of(String) }
    it { expect(config_value(:@tag)).to be_kind_of(String) }
    it { expect(config_value(:@position_file)).to be_kind_of(String) }

    it 'sets @source_position_file' do
      expect(config_value(:@source_position_file)).
        to be_kind_of(described_class::SOURCE_POSITION_FILE_CLASS)
    end

    it 'sets @sent_position_file' do
      expect(config_value(:@sent_position_file)).
        to be_kind_of(described_class::SOURCE_POSITION_FILE_CLASS)
    end

    it { expect(config_value(:@data_entry)).to have_key('name') }
    it { expect(config_value(:@data_entry)).to have_key('type') }
    it { expect(config_value(:@tables)).to be_kind_of(Array) }

    it do
      expect(config_value(:@tables)).to eq(%w(table_1 table_2 table_3))
    end

    it do
      expect(config_value(:@omit_events)).to eq(
        'table_3' => [:delete, :truncate_table],
        'table_4' => [:delete, :truncate_table],
      )
    end

    it do
      expect(config_value(:@table_revs)).to eq(
        'table_1' => 2,
        'table_2' => 1,
        'table_3' => 1,
      )
    end
  end
end

end

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
flydata-0.8.10.2 spec/flydata/fluent-plugins/flydata_plugin_ext/flydata_sync_shared_examples.rb
flydata-0.8.10.1 spec/flydata/fluent-plugins/flydata_plugin_ext/flydata_sync_shared_examples.rb
flydata-0.8.9.11 spec/flydata/fluent-plugins/flydata_plugin_ext/flydata_sync_shared_examples.rb
flydata-0.8.10 spec/flydata/fluent-plugins/flydata_plugin_ext/flydata_sync_shared_examples.rb
flydata-0.8.9 spec/flydata/fluent-plugins/flydata_plugin_ext/flydata_sync_shared_examples.rb
flydata-0.8.8 spec/flydata/fluent-plugins/flydata_plugin_ext/flydata_sync_shared_examples.rb
flydata-0.8.7 spec/flydata/fluent-plugins/flydata_plugin_ext/flydata_sync_shared_examples.rb
flydata-0.8.6 spec/flydata/fluent-plugins/flydata_plugin_ext/flydata_sync_shared_examples.rb
flydata-0.8.5 spec/flydata/fluent-plugins/flydata_plugin_ext/flydata_sync_shared_examples.rb
flydata-0.8.4 spec/flydata/fluent-plugins/flydata_plugin_ext/flydata_sync_shared_examples.rb
flydata-0.8.3 spec/flydata/fluent-plugins/flydata_plugin_ext/flydata_sync_shared_examples.rb
flydata-0.8.2 spec/flydata/fluent-plugins/flydata_plugin_ext/flydata_sync_shared_examples.rb
flydata-0.8.1 spec/flydata/fluent-plugins/flydata_plugin_ext/flydata_sync_shared_examples.rb
flydata-0.8.0 spec/flydata/fluent-plugins/flydata_plugin_ext/flydata_sync_shared_examples.rb
flydata-0.7.19 spec/flydata/fluent-plugins/flydata_plugin_ext/flydata_sync_shared_examples.rb
flydata-0.7.18 spec/flydata/fluent-plugins/flydata_plugin_ext/flydata_sync_shared_examples.rb
flydata-0.7.17 spec/flydata/fluent-plugins/flydata_plugin_ext/flydata_sync_shared_examples.rb
flydata-0.7.16 spec/flydata/fluent-plugins/flydata_plugin_ext/flydata_sync_shared_examples.rb
flydata-0.7.15 spec/flydata/fluent-plugins/flydata_plugin_ext/flydata_sync_shared_examples.rb
flydata-0.7.14 spec/flydata/fluent-plugins/flydata_plugin_ext/flydata_sync_shared_examples.rb