Sha256: a68c2c514b75433836ce1639be65bb283778bcd1563966498d2b16be5dde8300

Contents?: true

Size: 1.92 KB

Versions: 15

Compression:

Stored size: 1.92 KB

Contents

require 'spec_helper'

describe Riddle::Configuration::DistributedIndex do
  it "should not be valid without any indices" do
    index = Riddle::Configuration::DistributedIndex.new("dist1")
    index.should_not be_valid
  end

  it "should be valid with just local indices" do
    index = Riddle::Configuration::DistributedIndex.new("dist1")
    index.local_indices << "local_one"
    index.should be_valid
  end

  it "should be valid with just remote indices" do
    index = Riddle::Configuration::DistributedIndex.new("dist1")
    index.remote_indices << Riddle::Configuration::RemoteIndex.new("local", 3312, "remote_one")
    index.should be_valid
  end

  it "should be of type 'distributed'" do
    index = Riddle::Configuration::DistributedIndex.new("dist1")
    index.type.should == 'distributed'
  end

  it "should raise a ConfigurationError if rendering when not valid" do
    index = Riddle::Configuration::DistributedIndex.new("dist1")
    lambda { index.render }.should raise_error(Riddle::Configuration::ConfigurationError)
  end

  it "should render correctly if supplied settings are valid" do
    index = Riddle::Configuration::DistributedIndex.new("dist1")

    index.local_indices << "test1" << "test1stemmed"
    index.remote_indices <<
      Riddle::Configuration::RemoteIndex.new("localhost", 3313, "remote1") <<
      Riddle::Configuration::RemoteIndex.new("localhost", 3314, "remote2") <<
      Riddle::Configuration::RemoteIndex.new("localhost", 3314, "remote3")
    index.agent_blackhole << "testbox:3312:testindex1,testindex2"

    index.agent_connect_timeout = 1000
    index.agent_query_timeout   = 3000

    index.render.should == <<-DISTINDEX
index dist1
{
  type = distributed
  local = test1
  local = test1stemmed
  agent = localhost:3313:remote1
  agent = localhost:3314:remote2,remote3
  agent_blackhole = testbox:3312:testindex1,testindex2
  agent_connect_timeout = 1000
  agent_query_timeout = 3000
}
    DISTINDEX
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
riddle-2.1.0 spec/unit/configuration/distributed_index_spec.rb
riddle-2.0.0 spec/unit/configuration/distributed_index_spec.rb
riddle-1.5.12 spec/unit/configuration/distributed_index_spec.rb
riddle-1.5.11 spec/unit/configuration/distributed_index_spec.rb
riddle-1.5.10 spec/unit/configuration/distributed_index_spec.rb
riddle-1.5.9 spec/unit/configuration/distributed_index_spec.rb
riddle-1.5.8 spec/unit/configuration/distributed_index_spec.rb
riddle-1.5.7 spec/unit/configuration/distributed_index_spec.rb
riddle-1.5.6 spec/unit/configuration/distributed_index_spec.rb
riddle-1.5.5 spec/unit/configuration/distributed_index_spec.rb
riddle-1.5.4 spec/unit/configuration/distributed_index_spec.rb
riddle-1.5.3 spec/unit/configuration/distributed_index_spec.rb
riddle-1.5.2 spec/unit/configuration/distributed_index_spec.rb
riddle-1.5.1 spec/unit/configuration/distributed_index_spec.rb
riddle-1.5.0 spec/unit/configuration/distributed_index_spec.rb