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

Require Rails 7.2 #302

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 38 additions & 28 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,50 +2,52 @@ PATH
remote: .
specs:
solid_queue (0.6.0)
activejob (>= 7.1)
activerecord (>= 7.1)
activejob (>= 7.2)
activerecord (>= 7.2)
concurrent-ruby (>= 1.3.1)
fugit (~> 1.11.0)
railties (>= 7.1)
railties (>= 7.2)

GEM
remote: https://rubygems.org/
specs:
actionpack (7.1.3.4)
actionview (= 7.1.3.4)
activesupport (= 7.1.3.4)
actionpack (7.2.1)
actionview (= 7.2.1)
activesupport (= 7.2.1)
nokogiri (>= 1.8.5)
racc
rack (>= 2.2.4)
rack (>= 2.2.4, < 3.2)
rack-session (>= 1.0.1)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.2)
rails-html-sanitizer (~> 1.6)
actionview (7.1.3.4)
activesupport (= 7.1.3.4)
useragent (~> 0.16)
actionview (7.2.1)
activesupport (= 7.2.1)
builder (~> 3.1)
erubi (~> 1.11)
rails-dom-testing (~> 2.2)
rails-html-sanitizer (~> 1.6)
activejob (7.1.3.4)
activesupport (= 7.1.3.4)
activejob (7.2.1)
activesupport (= 7.2.1)
globalid (>= 0.3.6)
activemodel (7.1.3.4)
activesupport (= 7.1.3.4)
activerecord (7.1.3.4)
activemodel (= 7.1.3.4)
activesupport (= 7.1.3.4)
activemodel (7.2.1)
activesupport (= 7.2.1)
activerecord (7.2.1)
activemodel (= 7.2.1)
activesupport (= 7.2.1)
timeout (>= 0.4.0)
activesupport (7.1.3.4)
activesupport (7.2.1)
base64
bigdecimal
concurrent-ruby (~> 1.0, >= 1.0.2)
concurrent-ruby (~> 1.0, >= 1.3.1)
connection_pool (>= 2.2.5)
drb
i18n (>= 1.6, < 2)
logger (>= 1.4.2)
minitest (>= 5.1)
mutex_m
tzinfo (~> 2.0)
securerandom (>= 0.3)
tzinfo (~> 2.0, >= 2.0.5)
ast (2.4.2)
base64 (0.2.0)
bigdecimal (3.1.8)
Expand All @@ -68,18 +70,19 @@ GEM
i18n (1.14.5)
concurrent-ruby (~> 1.0)
io-console (0.6.0)
irb (1.6.2)
reline (>= 0.3.0)
irb (1.14.0)
rdoc (>= 4.0.0)
reline (>= 0.4.2)
json (2.7.1)
language_server-protocol (3.17.0.3)
logger (1.6.0)
loofah (2.22.0)
crass (~> 1.0.2)
nokogiri (>= 1.12.0)
mini_portile2 (2.8.1)
minitest (5.24.0)
mocha (2.1.0)
ruby2_keywords (>= 0.0.5)
mutex_m (0.2.0)
mysql2 (0.5.4)
nio4r (2.7.0)
nokogiri (1.16.6-arm64-darwin)
Expand All @@ -93,6 +96,8 @@ GEM
ast (~> 2.4.1)
racc
pg (1.5.4)
psych (5.1.2)
stringio
puma (6.4.2)
nio4r (~> 2.0)
raabro (1.4.0)
Expand All @@ -112,18 +117,20 @@ GEM
rails-html-sanitizer (1.6.0)
loofah (~> 2.21)
nokogiri (~> 1.14)
railties (7.1.3.4)
actionpack (= 7.1.3.4)
activesupport (= 7.1.3.4)
irb
railties (7.2.1)
actionpack (= 7.2.1)
activesupport (= 7.2.1)
irb (~> 1.13)
rackup (>= 1.0.0)
rake (>= 12.2)
thor (~> 1.0, >= 1.2.2)
zeitwerk (~> 2.6)
rainbow (3.1.1)
rake (13.0.6)
rdoc (6.7.0)
psych (>= 4.0.0)
regexp_parser (2.9.0)
reline (0.3.2)
reline (0.5.9)
io-console (~> 0.5)
rexml (3.3.3)
strscan
Expand Down Expand Up @@ -158,14 +165,17 @@ GEM
rubocop-rails
ruby-progressbar (1.13.0)
ruby2_keywords (0.0.5)
securerandom (0.3.1)
sqlite3 (1.5.4)
mini_portile2 (~> 2.8.0)
stringio (3.1.1)
strscan (3.1.0)
thor (1.2.2)
timeout (0.4.1)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
unicode-display_width (2.5.0)
useragent (0.16.10)
webrick (1.8.1)
zeitwerk (2.6.12)

Expand Down
2 changes: 1 addition & 1 deletion solid_queue.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Gem::Specification.new do |spec|
Dir["{app,config,db,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.md"]
end

rails_version = ">= 7.1"
rails_version = ">= 7.2"
spec.add_dependency "activerecord", rails_version
spec.add_dependency "activejob", rails_version
spec.add_dependency "railties", rails_version
Expand Down
3 changes: 1 addition & 2 deletions test/integration/forked_processes_lifecycle_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -266,8 +266,7 @@ class ForkedProcessesLifecycleTest < ActiveSupport::TestCase

private
def assert_clean_termination
wait_for_registered_processes 0, timeout: 0.2.second
assert_no_registered_processes
wait_for_full_process_shutdown
assert_no_claimed_jobs
assert_not process_exists?(@pid)
end
Expand Down
2 changes: 0 additions & 2 deletions test/integration/puma/plugin_testing.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ module PluginTesting

teardown do
terminate_process(@pid, signal: :INT) if process_exists?(@pid)

wait_for_registered_processes 0, timeout: 2.seconds
end
end

Expand Down
9 changes: 8 additions & 1 deletion test/test_helpers/processes_test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,15 @@ def run_supervisor_as_fork(**options)
end
end

def wait_for_full_process_shutdown
wait_for_registered_processes(0, timeout: SolidQueue.shutdown_timeout + 0.2.seconds)
assert_no_registered_processes
end

def wait_for_registered_processes(count, timeout: 1.second)
wait_while_with_timeout(timeout) { SolidQueue::Process.count != count }
wait_while_with_timeout(timeout) do
SolidQueue::Process.count != count
end
end

def assert_no_registered_processes
Expand Down
7 changes: 3 additions & 4 deletions test/unit/async_supervisor_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ class AsyncSupervisorTest < ActiveSupport::TestCase
assert_registered_processes(kind: "Dispatcher", supervisor_id: supervisor.process_id)

supervisor.stop

assert_no_registered_processes
wait_for_full_process_shutdown
end

test "start with provided configuration" do
Expand All @@ -24,8 +23,7 @@ class AsyncSupervisorTest < ActiveSupport::TestCase
assert_registered_processes(kind: "Dispatcher", supervisor_id: supervisor.process_id)

supervisor.stop

assert_no_registered_processes
wait_for_full_process_shutdown
end

test "failed orphaned executions" do
Expand All @@ -52,6 +50,7 @@ class AsyncSupervisorTest < ActiveSupport::TestCase
assert_registered_processes(kind: "Supervisor(async)")

supervisor.stop
wait_for_full_process_shutdown

assert_equal 0, SolidQueue::ClaimedExecution.count
assert_equal 3, SolidQueue::FailedExecution.count
Expand Down
21 changes: 12 additions & 9 deletions test/unit/dispatcher_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ class DispatcherTest < ActiveSupport::TestCase

teardown do
@dispatcher.stop
wait_for_full_process_shutdown
end

test "dispatcher is registered as process" do
Expand Down Expand Up @@ -57,7 +58,8 @@ class DispatcherTest < ActiveSupport::TestCase
with_active_record_logger(ActiveSupport::Logger.new(log)) do
with_polling(silence: false) do
@dispatcher.start
sleep 0.2
wait_for_registered_processes(1, timeout: 1.second)
sleep(0.3)
end
end

Expand All @@ -69,7 +71,8 @@ class DispatcherTest < ActiveSupport::TestCase
with_active_record_logger(ActiveSupport::Logger.new(log)) do
with_polling(silence: true) do
@dispatcher.start
sleep 0.2
wait_for_registered_processes(1, timeout: 1.second)
sleep(0.3)
end
end

Expand All @@ -80,13 +83,10 @@ class DispatcherTest < ActiveSupport::TestCase
with_active_record_logger(nil) do
with_polling(silence: true) do
@dispatcher.start
sleep 0.2
wait_for_registered_processes(1, timeout: 1.second)
sleep 0.3
end
end

@dispatcher.stop
wait_for_registered_processes(0, timeout: 1.second)
assert_no_registered_processes
end

test "run more than one instance of the dispatcher without recurring tasks" do
Expand All @@ -100,7 +100,7 @@ class DispatcherTest < ActiveSupport::TestCase
@dispatcher.start
another_dispatcher.start

wait_while_with_timeout(1.second) { SolidQueue::ScheduledExecution.any? }
wait_while_with_timeout(2.second) { SolidQueue::ScheduledExecution.any? }

assert_equal 0, SolidQueue::ScheduledExecution.count
assert_equal 15, SolidQueue::ReadyExecution.count
Expand All @@ -115,8 +115,11 @@ class DispatcherTest < ActiveSupport::TestCase
end

dispatchers.each(&:start)
sleep 2
wait_for_registered_processes(2, timeout: 2.second)
sleep 1.5

dispatchers.each(&:stop)
wait_for_full_process_shutdown

assert_equal SolidQueue::Job.count, SolidQueue::RecurringExecution.count
run_at_times = SolidQueue::RecurringExecution.all.map(&:run_at).sort
Expand Down
2 changes: 1 addition & 1 deletion test/unit/fork_supervisor_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class ForkSupervisorTest < ActiveSupport::TestCase
assert File.exist?(@pidfile)
assert_equal pid, File.read(@pidfile).strip.to_i

wait_for_registered_processes(0)
sleep(1)

pid = run_supervisor_as_fork
wait_for_registered_processes(4)
Expand Down
3 changes: 1 addition & 2 deletions test/unit/worker_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,7 @@ class WorkerTest < ActiveSupport::TestCase
end

@worker.stop
wait_for_registered_processes(0, timeout: 1.second)
assert_no_registered_processes
wait_for_full_process_shutdown
end

test "run inline" do
Expand Down
Loading