Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rspec testing! How to do it ?? #114

Open
RichardsonWTR opened this issue Mar 31, 2022 · 1 comment
Open

Rspec testing! How to do it ?? #114

RichardsonWTR opened this issue Mar 31, 2022 · 1 comment
Labels
enhancement help wanted Contributions are highly appreciated

Comments

@RichardsonWTR
Copy link

Given this situation:

# config/initializers/sidekiq.rb file
Sidekiq::Throttled::Registry.add(
  :my_throttle,
  concurrency: { limit: 50 }
)

# app/jobs/my_job.rb  file
class MyJob
  include Sidekiq::Worker
  include Sidekiq::Throttled::Worker
  sidekiq_throttle_as :my_throttle
end

How can I write tests in Rspec that assures:

  • The MyJob class has the expected throttle
  • The throttle has the expected value (in this case, 50)
  • The throttle is being used (when I push a job, make sure that the available jobs to be run is equals 49 in this case)

I've tried some things but still no luck.
Any help will be useful.

Related #62

@ixti ixti added enhancement help wanted Contributions are highly appreciated labels Apr 16, 2023
@ixti
Copy link
Owner

ixti commented Apr 16, 2023

Re:

  • The MyJob class has the expected throttle
  • The throttle has the expected value (in this case, 50)

We will need to add rspec matchers to simplify this task.


Re:

  • The throttle is being used (when I push a job, make sure that the available jobs to be run is equals 49 in this case)

I don't see a feasible way for such testing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement help wanted Contributions are highly appreciated
Projects
None yet
Development

No branches or pull requests

2 participants