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
I have this in my spec_helper.rb:
... good_job_adapter = GoodJob::Adapter.new(execution_mode: :inline) ActiveJob::Base.queue_adapter = good_job_adapter config.after do DatabaseCleaner.clean end ...
I have this in my job:
# Worker for testing new job queues, useful for unique worker setting testing class TestJob < ApplicationJob include GoodJob::ActiveJobExtensions::Concurrency good_job_control_concurrency_with(total_limit: 1, key: -> { arguments.to_json }) queue_as :status def perform(params) `sleep 1` end end
This is my spec:
require 'rails_helper' RSpec.describe TestJob, type: :job do it "Runs successfully" do described_class.perform_later({ test: 1 }) end end
However, I get:
1) TestJob Runs successfully Got 0 failures and 2 other errors: 1.1) Failure/Error: described_class.perform_later ActiveRecord::StatementInvalid: PG::InFailedSqlTransaction: ERROR: current transaction is aborted, commands ignored until end of transaction block # ./spec/jobs/test_job_spec.rb:5:in `block (2 levels) in <top (required)>' # ./spec/spec_helper.rb:137:in `block (2 levels) in <top (required)>' # ------------------ # --- Caused by: --- # PG::UndefinedTable: # ERROR: relation "good_jobs" does not exist # LINE 9: WHERE a.attrelid = '"good_jobs"'::regclass # ^ # ./spec/jobs/test_job_spec.rb:5:in `block (2 levels) in <top (required)>' 1.2) Failure/Error: DatabaseCleaner.clean ActiveRecord::StatementInvalid: PG::InFailedSqlTransaction: ERROR: current transaction is aborted, commands ignored until end of transaction block # ./spec/spec_helper.rb:120:in `block (2 levels) in <top (required)>' # ./spec/spec_helper.rb:137:in `block (2 levels) in <top (required)>' # ------------------ # --- Caused by: --- # PG::InFailedSqlTransaction: # ERROR: current transaction is aborted, commands ignored until end of transaction block # ./spec/spec_helper.rb:120:in `block (2 levels) in <top (required)>'
Any ideas? - any best practices for testing good_job jobs?
The text was updated successfully, but these errors were encountered:
Oh sorry, my mistake! - I missed an exception when running migrations, after migration it runs as expected, thank you for creating good_job!
Sorry, something went wrong.
No branches or pull requests
I have this in my spec_helper.rb:
I have this in my job:
This is my spec:
However, I get:
Any ideas? - any best practices for testing good_job jobs?
The text was updated successfully, but these errors were encountered: