Comments (8)
That is odd. Are you overwriting Sunspot.session
in your test environment at all?
from sunspot-queue.
Hi,
All I did was following, works fine in dev. Is there any config I need to do for Rspec test? Thanks
Rspec:
https://gist.github.com/jianbo/6289664
Sunspot.yml
test:
solr:
hostname: localhost
port: 8981
log_level: WARNING
auto_commit_after_request: true
Sunspot.rb
require "sunspot/queue/sidekiq"
backend = Sunspot::Queue::Sidekiq::Backend.new
Sunspot.session = Sunspot::Queue::SessionProxy.new(Sunspot.session, backend)
from sunspot-queue.
@jianbo two questions:
- Is
sunspot.rb
inconfig/initializers/
? - You're tagging your test with
:search => true
, what definitions do you have around that (e.g.before
,after
, etc...)
from sunspot-queue.
Hi,
The sunspot.rb is in my initializers. I copied search => true form
http://stackoverflow.com/questions/6989024/how-can-i-write-a-request-spec-with-capybara-rspec-for-testing-sunspot-solr-sear, and it doesn't have any effect before any after adding that, I also restarted solr for test env.
Thanks
from sunspot-queue.
@jianbo I'm guessing you're using sunspot_test
that provides the tag for :search => true
. It looks like the issue is on this line where sunspot_test is overriding Sunspot.session
.
I'm not sure a good way to fix this because of how sunspot_test
injects itself into testing. The below code (put in the right place in spec/spec_helper.rb
might work but I have no idea.
before(:each, :search => true) do
backend = Sunspot::Queue::Sidekiq::Backend.new
Sunspot.session = Sunspot::Queue::SessionProxy.new(Sunspot.session, backend)
end
It looks like it's a strange interaction between sunspot_test
(which hasn't been updated in 2 years) and sunspot_queue. Based on what I've seen I don't think this is an issue in sunspot_test itself.
from sunspot-queue.
Hi, sorry I didn't make it clear. The reindex didn not work before adding sunspot_test and "search => true", I only added now to see if it make any difference.
from sunspot-queue.
Hey @jianbo, so based on the little information I have it sounds like it's working fine in development but you're having issues in test mode. Based on that I don't think it's an issue with sunspot-queue and likely something to do with how your test environment is set up.
I would take a look at what is returned by Sunspot.session
right before calling Toon.reindex
in your test. If it's not an instance of Sunspot::Queue::SessionProxy
then something in overwriting our proxy. The only other thing I can think of is that you have might Sidekiq set to run jobs inline, so they would get run immediately and not queued up like in development mode.
If you can track down the issue I'd love to hear what you found, especially if it's an issue inside sunspot-queue that we can fix for everyone else.
from sunspot-queue.
Its because of this line in my spec_helper.rb :)
require 'sidekiq/testing' # pushes jobs to array called jobs rather than redis
from sunspot-queue.
Related Issues (15)
- Tasks failing with "undefined method `params' for #<Account:0x007ffa6e6f6718>" HOT 4
- uninitialized constant Sunspot::Queue::Helpers HOT 1
- Add delayed enqueue for workers that support it HOT 9
- Add support for Rails.queue HOT 1
- Support for concurrency throttling and document batching
- sunspot-queue is not threadsafe
- Publish gem update to rubygems.org? HOT 3
- ActiveJob support HOT 1
- Checking for existence of object before enqueue? HOT 1
- Resque / Sidekiq queue should be configurable
- Job class should be configurable HOT 3
- Add configurable Timeout for Indexing / Removal
- Nice work, works great! HOT 3
- Any other possible way to use this gem for sunspot_rails 1.1.0 ? HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sunspot-queue.