Sha256: ca46cf3df8aaa51160f130ddca58626bbe39b98d6d718b58b81e19239f2e04a5

Contents?: true

Size: 1.13 KB

Versions: 46

Compression:

Stored size: 1.13 KB

Contents

# encoding: utf-8
require "logstash/filters/jdbc/db_object"

RSpec.shared_examples "a single load runner" do

  context "with local db objects" do
    let(:local_db_objects) do
      [
       {"name" => "servers", "index_columns" => ["ip"], "columns" => [%w(ip text), %w(name text), %w(location text)]},
      ]
    end

    it "builds local db objects and populates the local db" do
      expect(local_db).to receive(:populate_all).once.with(loaders)
      expect(local_db).to receive(:build_db_object).once.with(instance_of(LogStash::Filters::Jdbc::DbObject))
      runner.initial_load
      expect(runner.preloaders).to be_a(Array)
      expect(runner.preloaders.size).to eq(1)
      expect(runner.preloaders[0].name).to eq(:servers)
      expect(runner.local).to eq(local_db)
      expect(runner.loaders).to eq(loaders)
    end
  end

  context "without local db objects" do
    it "populates the local db" do
      expect(local_db).to receive(:populate_all).once.with(loaders)
      runner.initial_load
      expect(runner.preloaders).to eq([])
      expect(runner.local).to eq(local_db)
      expect(runner.loaders).to eq(loaders)
    end
  end
end

Version data entries

46 entries across 46 versions & 2 rubygems

Version Path
logstash-integration-jdbc-5.5.1 spec/filters/shared_helpers.rb
logstash-integration-jdbc-5.5.0 spec/filters/shared_helpers.rb
logstash-integration-jdbc-5.4.9 spec/filters/shared_helpers.rb
logstash-integration-jdbc-5.4.8 spec/filters/shared_helpers.rb
logstash-integration-jdbc-5.4.7 spec/filters/shared_helpers.rb
logstash-integration-jdbc-5.4.6 spec/filters/shared_helpers.rb
logstash-integration-jdbc-5.4.5 spec/filters/shared_helpers.rb
logstash-integration-jdbc-5.4.4 spec/filters/shared_helpers.rb
logstash-integration-jdbc-5.4.3 spec/filters/shared_helpers.rb
logstash-integration-jdbc-5.4.2 spec/filters/shared_helpers.rb
logstash-integration-jdbc-5.4.1 spec/filters/shared_helpers.rb
logstash-integration-jdbc-5.4.0 spec/filters/shared_helpers.rb
logstash-integration-jdbc-5.3.0 spec/filters/shared_helpers.rb
logstash-integration-jdbc-5.2.6 spec/filters/shared_helpers.rb
logstash-integration-jdbc-5.2.5 spec/filters/shared_helpers.rb
logstash-integration-jdbc-5.2.4 spec/filters/shared_helpers.rb
logstash-integration-jdbc-5.2.3 spec/filters/shared_helpers.rb
logstash-integration-jdbc-5.2.2 spec/filters/shared_helpers.rb
logstash-integration-jdbc-5.2.1 spec/filters/shared_helpers.rb
logstash-integration-jdbc-5.2.0 spec/filters/shared_helpers.rb