Skip to content
This repository has been archived by the owner on Apr 1, 2023. It is now read-only.

#store doesn't work in tests #147

Open
brandoncc opened this issue Mar 24, 2019 · 2 comments
Open

#store doesn't work in tests #147

brandoncc opened this issue Mar 24, 2019 · 2 comments

Comments

@brandoncc
Copy link

When I use #get_all, I get an empty hash during my test. Am I missing something?

@dannysullivan
Copy link

I'm also seeing this problem. After setting up inline status testing in spec_helper.rb, I'm able to fetch the stubbed :complete status using Sidekiq::Status.status(job_id), but I get an empty hash when I call Sidekiq::Status.get_all(job_id).

@vizcay
Copy link

vizcay commented Oct 3, 2019

Hi, I've come across the same problem. After inspecting sidekiq-status/testing/inline.rb the reason is very obvious:

module Sidekiq
  module Status
    class << self
      def status(jid)
        :complete
      end
    end

    module Storage
      def store_status(id, status, expiration = nil, redis_pool=nil)
        'ok'
      end

      def store_for_id(id, status_updates, expiration = nil, redis_pool=nil)
        'ok'
      end
    end
  end
end

It's fairly simple, only stubs the result of the Redis operation write operations and a :complete result for the job. I thing this could be done by an in memory storage mechanism (instead of external as Redis). The TTL feature will be lost, but at least we will be able to test the comunication mechanism I believe.

@utgarda do you think this is factible?

@brandoncc, @dannysullivan how have you solved this?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants