# encoding: utf-8 require 'fluent_plugins_spec_helper' require 'in_postgresql_query_based_flydata' require 'flydata/fluent-plugins/flydata_plugin_ext/flydata_sync_query_based_shared_examples' module Fluent describe PostgresqlQueryBasedFlydataInput do let(:plugin) { PostgresqlQueryBasedFlydataInput.new } let(:default_config) { < 'test_name', 'type' => 'RedshiftMysqlDataEntry', 'postgresql_data_entry_preference' => { 'database' => 'test_db', 'tables' => 'test_table,test_table_1,test_table_2', 'tables_append_only' => 'test_table_3', 'pk_override' => {}, 'host' => 'localhost', 'port' => 5433, 'username' => 'test_admin', 'password' => 'test_password', 'schema' => 'test_schema', } ) end it 'sets data tables as array' do expect(plugin.instance_variable_get(:@tables)).to eq(%w(test_table)) end it 'sets sync_fm' do expect(plugin.instance_variable_get(:@sync_fm)).to be_kind_of(Flydata::SyncFileManager) end it 'sets omit_events' do expect(plugin.instance_variable_get(:@omit_events)).to eq({'test_table_3' => [:delete, :truncate_table]}) end it 'sets context' do expect(plugin.instance_variable_get(:@context)).to be_kind_of(Flydata::SourcePostgresql::PluginSupport::Context) end it 'sets client' do expect(plugin.instance_variable_get(:@client)).to be_kind_of(Flydata::SourcePostgresql::QueryBasedSync::Client) end end end end