I am using Rails 3.2.12, RSpec-rails 2.13.0 and ThinkingSphinx 3.0.10
The problem:
When I run bundle exec rpsec spec/controllers/ads_controller_spec.rb, thinking sphinx spawns 3 searchd processes which become frozen, my tests just lockup until I manually killed the searchd processes after which the tests continue running.
The setup:
Here is my sphinx_env.rb file which in which I setup TS for testing:
require 'thinking_sphinx/test'
def sphinx_environment(*tables, &block)
obj = self
begin
before(:all) do
obj.use_transactional_fixtures = false
ThinkingSphinx::Test.init
ThinkingSphinx::Test.start
sleep(0.5)
end
yield
ensure
after(:all) do
ThinkingSphinx::Test.stop
sleep(0.5)
obj.use_transactional_fixtures = true
end
end
end
Here is my test script:
describe "GET index" do
before(:each) do
@web_origin = FactoryGirl.create(:origin)
@api_origin = FactoryGirl.create(:api_origin)
@first_ad = FactoryGirl.create(:ad, :origin_id => @web_origin.id)
ThinkingSphinx::Test.index #index ads created above
sleep 0.5
end
sphinx_environment :ads do
it 'should return a collection of all live ads' do
get :index, {:format => 'json'}
response.code.should == '200'
end
end
...
UPDATE
No progress made, however here are some additional details:
- When I run my tests, thinking sphinx always starts 3 searchd processes.
- The pid in my test.sphinx.pid always has just one of the searchd pid's, its always the second searchd process pid.
Here is the output from my test.searchd.log file:
[ 568] binlog: finished replaying total 49 in 0.006 sec
[ 568] accepting connections
[ 568] caught SIGHUP (seamless=1, in queue=1)
[ 568] rotating index 'ad_core': started
[ 568] caught SIGHUP (seamless=1, in queue=2)
[ 568] caught SIGTERM, shutting down
Any help is appreciated, I have been trying to sort out this issue for over a day & a bit lost.
Thanks.