Skip to content

Commit

Permalink
Use proper version of Chaotic Job
Browse files Browse the repository at this point in the history
  • Loading branch information
fractaledmind committed Nov 14, 2024
1 parent 62c8e7b commit 1a42ed5
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 30 deletions.
4 changes: 2 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ GEM
base64 (0.2.0)
bigdecimal (3.1.8)
builder (3.3.0)
chaotic_job (0.1.1)
chaotic_job (0.2.0)
combustion (1.3.7)
activesupport (>= 3.0.0)
railties (>= 3.0.0)
Expand Down Expand Up @@ -162,7 +162,7 @@ PLATFORMS

DEPENDENCIES
acidic_job!
chaotic_job
chaotic_job (>= 0.2.0)
combustion
minitest
rake
Expand Down
2 changes: 1 addition & 1 deletion acidic_job.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Gem::Specification.new do |spec|
spec.add_dependency "railties", rails_version
end

spec.add_development_dependency "chaotic_job"
spec.add_development_dependency "chaotic_job", ">= 0.2.0"
spec.add_development_dependency "combustion"
spec.add_development_dependency "minitest"
spec.add_development_dependency "rake"
Expand Down
22 changes: 11 additions & 11 deletions test/acidic_job/basics_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def step_3; ChaoticJob.log_to_journal!; end
end

Job1.perform_later
perform_all
perform_all_jobs

assert_equal 3, ChaoticJob.journal_size
assert_equal 1, AcidicJob::Execution.count
Expand Down Expand Up @@ -63,7 +63,7 @@ def step_3; executions > 3 ? ChaoticJob.log_to_journal! : (raise DefaultsError);
end

Job2.perform_later
perform_all
perform_all_jobs

assert_equal 3, ChaoticJob.journal_size
assert_equal 1, AcidicJob::Execution.count
Expand Down Expand Up @@ -111,7 +111,7 @@ def step_3; ChaoticJob.log_to_journal!; end
end

Job3.perform_later
perform_all
perform_all_jobs

assert_equal 0, ChaoticJob.journal_size
assert_equal 1, AcidicJob::Execution.count
Expand Down Expand Up @@ -149,7 +149,7 @@ def step_3; raise DiscardableError; end
end

ThreeStepDiscardOnThreeJob.perform_later
perform_all
perform_all_jobs

assert_equal 2, ChaoticJob.journal_size
assert_equal 1, AcidicJob::Execution.count
Expand Down Expand Up @@ -190,7 +190,7 @@ def step_3; raise StandardError; end

Job4.perform_later
assert_raises StandardError do
perform_all
perform_all_jobs
end

assert_equal 2, ChaoticJob.journal_size
Expand Down Expand Up @@ -237,7 +237,7 @@ def step_3; ChaoticJob.log_to_journal!; end

Job5.perform_later
assert_raises StandardError do
perform_all
perform_all_jobs
end

assert_equal 1, ChaoticJob.journal_size
Expand Down Expand Up @@ -284,7 +284,7 @@ def step_3; ChaoticJob.log_to_journal!; end

Job6.perform_later
assert_raises StandardError do
perform_all
perform_all_jobs
end

assert_equal 1, ChaoticJob.journal_size
Expand Down Expand Up @@ -334,7 +334,7 @@ def step_3; ChaoticJob.log_to_journal!; end
end

Job7.perform_later
perform_all
perform_all_jobs

assert_equal 3, ChaoticJob.journal_size
assert_equal 1, AcidicJob::Execution.count
Expand Down Expand Up @@ -392,7 +392,7 @@ def step_3; ChaoticJob.log_to_journal!; end
queries << event.payload.fetch(:sql)
end
ActiveSupport::Notifications.subscribed(callback, "sql.active_record") do
perform_all
perform_all_jobs
end

assert_equal 3, ChaoticJob.journal_size
Expand Down Expand Up @@ -460,7 +460,7 @@ def step_3; ChaoticJob.log_to_journal!; end
queries << event.payload.fetch(:sql)
end
ActiveSupport::Notifications.subscribed(callback, "sql.active_record") do
perform_all
perform_all_jobs
end

assert_equal 2, ChaoticJob.journal_size
Expand Down Expand Up @@ -511,7 +511,7 @@ def step_3; ChaoticJob.log_to_journal!; end
end

Job10.perform_later(1, 2, 3)
perform_all
perform_all_jobs

assert_equal 3, ChaoticJob.journal_size
assert_equal 1, AcidicJob::Execution.count
Expand Down
18 changes: 9 additions & 9 deletions test/acidic_job/breakages_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def step_3; ChaoticJob.log_to_journal!; end

ActiveSupport::Notifications.subscribed(callback, /acidic_job/) do
assert_raises(BreakingError) do
perform_all
perform_all_jobs
end
end

Expand All @@ -68,7 +68,7 @@ def step_3; ChaoticJob.log_to_journal!; end
raise DiscardableError
end
ActiveSupport::Notifications.subscribed(callback, /acidic_job/) do
perform_all
perform_all_jobs
end

assert already_raised
Expand All @@ -94,7 +94,7 @@ def step_3; ChaoticJob.log_to_journal!; end

ActiveSupport::Notifications.subscribed(callback, /acidic_job/) do
assert_raises(DefaultsError) do
perform_all
perform_all_jobs
end
end

Expand All @@ -120,7 +120,7 @@ def step_3; ChaoticJob.log_to_journal!; end
raise DefaultsError
end
ActiveSupport::Notifications.subscribed(callback, /acidic_job/) do
perform_all
perform_all_jobs
end

assert already_raised
Expand Down Expand Up @@ -180,7 +180,7 @@ def step_3; ChaoticJob.log_to_journal!; end
raise DefaultsError
end
ActiveSupport::Notifications.subscribed(callback, /acidic_job/) do
perform_all
perform_all_jobs
end

assert already_raised
Expand Down Expand Up @@ -243,7 +243,7 @@ def step_3; ChaoticJob.log_to_journal!; end
raise DefaultsError
end
ActiveSupport::Notifications.subscribed(callback, /acidic_job/) do
perform_all
perform_all_jobs
end

assert already_raised
Expand Down Expand Up @@ -311,7 +311,7 @@ def step_3; ChaoticJob.log_to_journal!; end
raise DefaultsError
end
ActiveSupport::Notifications.subscribed(callback, /acidic_job/) do
perform_all
perform_all_jobs
end

assert already_raised
Expand Down Expand Up @@ -381,7 +381,7 @@ def step_3; ChaoticJob.log_to_journal!; end
raise DefaultsError
end
ActiveSupport::Notifications.subscribed(callback, /acidic_job/) do
perform_all
perform_all_jobs
end

assert already_raised
Expand Down Expand Up @@ -447,7 +447,7 @@ def step_3; ChaoticJob.log_to_journal!; end
raise DefaultsError
end
ActiveSupport::Notifications.subscribed(callback, /acidic_job/) do
perform_all
perform_all_jobs
end

assert already_raised
Expand Down
2 changes: 1 addition & 1 deletion test/crucibles/awaiting_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def do_something

test "workflow runs successfully" do
Job.perform_later
perform_all
perform_all_jobs

assert_equal 3, ChaoticJob.journal_size
assert_equal 1, AcidicJob::Execution.count
Expand Down
8 changes: 4 additions & 4 deletions test/crucibles/delaying_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def do_something

test "workflow runs successfully" do
Job.perform_later
perform_all_within(1.minute)
perform_all_jobs_within(1.minute)

# Performed the first job, then retried it
assert_equal 1, performed_jobs.size
Expand Down Expand Up @@ -63,7 +63,7 @@ def do_something
assert_equal false, AcidicJob::Value.find_by(key: "halt").value

# Now, perform the future scheduled job and check the final state of the execution
perform_all_after(14.days)
perform_all_jobs_after(14.days)

assert_equal 1, ChaoticJob.journal_size
assert_equal 1, AcidicJob::Execution.count
Expand Down Expand Up @@ -123,7 +123,7 @@ def do_something

test "scenario with error before halt_step!" do
run_scenario(Job.new, glitch: ["before", "#{__FILE__}:27"]) do
perform_all_within(1.minute)
perform_all_jobs_within(1.minute)
end

# Performed the first job, then retried it
Expand Down Expand Up @@ -154,7 +154,7 @@ def do_something
assert_equal false, AcidicJob::Value.find_by(key: "halt").value

# Now, perform the future scheduled job and check the final state of the execution
perform_all_after(14.days)
perform_all_jobs_after(14.days)

assert_equal 1, ChaoticJob.journal_size
assert_equal 1, AcidicJob::Execution.count
Expand Down
2 changes: 1 addition & 1 deletion test/crucibles/iteration_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def step_1

test "workflow runs successfully" do
Job.perform_later
perform_all
perform_all_jobs

assert_equal 3, ChaoticJob.journal_size
assert_equal 1, AcidicJob::Execution.count
Expand Down
2 changes: 1 addition & 1 deletion test/crucibles/waiting_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def do_something

test "workflow runs successfully" do
Job.perform_later
perform_all
perform_all_jobs

assert_equal 1, ChaoticJob.journal_size
assert_equal 1, AcidicJob::Execution.count
Expand Down

0 comments on commit 1a42ed5

Please sign in to comment.