diff options
author | Andrea Campi <andrea.campi@zephirworks.com> | 2011-10-03 20:29:42 +0200 |
---|---|---|
committer | Daniel DeLeo <dan@opscode.com> | 2011-10-26 13:36:35 -0700 |
commit | 6bfb2d5ef1b6d40251e72507d78db0948e5f6f77 (patch) | |
tree | 5bf53a333d278f4261100e5607f4e1c29e8ae5f9 /chef-expander | |
parent | bdde71bcb2908519b5a087b222e532ae5cdf5f58 (diff) | |
download | chef-6bfb2d5ef1b6d40251e72507d78db0948e5f6f77.tar.gz |
CHEF-2652: respect solr_url configuration.
Diffstat (limited to 'chef-expander')
-rw-r--r-- | chef-expander/lib/chef/expander/configuration.rb | 2 | ||||
-rw-r--r-- | chef-expander/lib/chef/expander/solrizer.rb | 2 | ||||
-rw-r--r-- | chef-expander/spec/fixtures/chef-expander.rb | 2 | ||||
-rw-r--r-- | chef-expander/spec/unit/configuration_spec.rb | 2 | ||||
-rw-r--r-- | chef-expander/spec/unit/solrizer_spec.rb | 17 |
5 files changed, 21 insertions, 4 deletions
diff --git a/chef-expander/lib/chef/expander/configuration.rb b/chef-expander/lib/chef/expander/configuration.rb index 66ad93fa29..58b29fc9cc 100644 --- a/chef-expander/lib/chef/expander/configuration.rb +++ b/chef-expander/lib/chef/expander/configuration.rb @@ -143,7 +143,7 @@ module Chef configurable :ps_tag, "" - configurable :solr_url, "http://localhost:8983" + configurable :solr_url, "http://localhost:8983/solr" configurable :amqp_host, '0.0.0.0' diff --git a/chef-expander/lib/chef/expander/solrizer.rb b/chef-expander/lib/chef/expander/solrizer.rb index 1a6fed9521..1faf288674 100644 --- a/chef-expander/lib/chef/expander/solrizer.rb +++ b/chef-expander/lib/chef/expander/solrizer.rb @@ -251,7 +251,7 @@ module Chef end def solr_url - 'http://127.0.0.1:8983/solr/update' + "#{Expander.config.solr_url}/update" end def indexed_object diff --git a/chef-expander/spec/fixtures/chef-expander.rb b/chef-expander/spec/fixtures/chef-expander.rb index 32778a1a09..00ff1908ab 100644 --- a/chef-expander/spec/fixtures/chef-expander.rb +++ b/chef-expander/spec/fixtures/chef-expander.rb @@ -24,7 +24,7 @@ ## The Actual Config Settings for Chef Expander ## # Solr -solr_url "http://localhost:8983" +solr_url "http://localhost:8983/solr" ## Parameters for connecting to RabbitMQ ## # Defaults: diff --git a/chef-expander/spec/unit/configuration_spec.rb b/chef-expander/spec/unit/configuration_spec.rb index 7838c6ae4d..30460ae69e 100644 --- a/chef-expander/spec/unit/configuration_spec.rb +++ b/chef-expander/spec/unit/configuration_spec.rb @@ -55,7 +55,7 @@ describe Expander::Configuration do end it "has a setting for solr url defaulting to localhost:8983" do - @config.solr_url.should == "http://localhost:8983" + @config.solr_url.should == "http://localhost:8983/solr" end it "has a setting for the amqp host to connect to, defaulting to 0.0.0.0" do diff --git a/chef-expander/spec/unit/solrizer_spec.rb b/chef-expander/spec/unit/solrizer_spec.rb index 443e93a3fa..ca5f92ed75 100644 --- a/chef-expander/spec/unit/solrizer_spec.rb +++ b/chef-expander/spec/unit/solrizer_spec.rb @@ -257,4 +257,21 @@ describe Expander::Solrizer do end + describe "solr_url" do + before do + @indexer_payload = {:id => "2342"} + @update_object = {:action => "add", :payload => @indexer_payload} + @update_json = Yajl::Encoder.encode(@update_object) + @solrizer = Expander::Solrizer.new(@update_json) + end + + it "appends /update to the default solr_url" do + @solrizer.solr_url.should == "http://localhost:8983/solr/update" + end + + it "appends /update to a configured solr_url" do + Expander.config.solr_url = "https://vhost/abcdef/solr/collection" + @solrizer.solr_url.should == "https://vhost/abcdef/solr/collection/update" + end + end end |