We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
If you configure a Rails application to use the karafka queue adapter as described in https://karafka.io/docs/Active-Job/, then when writing rspec tests that use the have_enqueued_job matcher, they will fail reporting no jobs were enqueued
When configuring rails to use the karafka ActiveJob adapter with:
config.active_job.queue_adapter = :karafka
Then if I write ruby code to publish a job:
class SomeJob < ApplicationJob def perform puts "performed" end end SomeJob.perform_later
I expect an rspec test like this to pass:
expect do SomeJob.perform_later end.to have_enqueued_job(SomeJob).once
The rspec test fails with
expected to enqueue exactly 1 jobs, but enqueued 0
I also observed this happens regardless of whether I use the produce_sync option or not
karafka_options( dispatch_method: :produce_sync )
Create a rails 7 application, and configure it to use the :karafka queue adapter for ActiveJob as per above
Set up the karafka gem
Write a test that enqueues a job
See that it fails to report enqueueing the job
I am using Rails 7.0.4.3 and rspec 3.12.0
Karafka info is below:
$ [bundle exec] karafka info 2023-04-21 09:30:25.307444 I [65649:57120] Rails -- Karafka version: 2.0.38 Ruby version: ruby 3.2.1 (2023-02-08 revision 31819e82c8) +YJIT [arm64-darwin22] Rdkafka version: 0.12.1 Consumer groups count: 4 Subscription groups count: 4 Workers count: 5 ...
The text was updated successfully, but these errors were encountered:
this API needs to be expanded in karafka-testing:
https://github.com/rspec/rspec-rails/blob/main/lib/rspec/rails/matchers/active_job.rb#L233
moving there
Sorry, something went wrong.
sorry I forgot about this one. Checking now 🙏
@wahlg when I try to do what you did I am getting:
To use ActiveJob matchers set `ActiveJob::Base.queue_adapter = :test`
any chance you could use this example repo to create a repro? https://github.com/karafka/example-apps/tree/master/v2.1-rails
mensfeld
No branches or pull requests
If you configure a Rails application to use the karafka queue adapter as described in https://karafka.io/docs/Active-Job/, then when writing rspec tests that use the have_enqueued_job matcher, they will fail reporting no jobs were enqueued
Expected behavior
When configuring rails to use the karafka ActiveJob adapter with:
Then if I write ruby code to publish a job:
I expect an rspec test like this to pass:
Actual behavior
The rspec test fails with
I also observed this happens regardless of whether I use the produce_sync option or not
Steps to reproduce the problem
Create a rails 7 application, and configure it to use the :karafka queue adapter for ActiveJob as per above
Set up the karafka gem
Write a test that enqueues a job
See that it fails to report enqueueing the job
Your setup details
I am using Rails 7.0.4.3 and rspec 3.12.0
Karafka info is below:
The text was updated successfully, but these errors were encountered: