Skip to content
Merged
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
3 changes: 3 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ jobs:
with:
ruby-version: 3.4
bundler-cache: true
cache-version: 1
- name: Run rubocop
run: |
bundle exec rubocop --parallel
Expand All @@ -29,6 +30,7 @@ jobs:
- 3.2
- 3.3
- 3.4
- 4.0
database: [ mysql, postgres, sqlite ]
gemfile: [ rails_7_1, rails_7_2, rails_8_0, rails_8_1, rails_main ]
exclude:
Expand Down Expand Up @@ -64,6 +66,7 @@ jobs:
with:
ruby-version: ${{ matrix.ruby-version }}
bundler-cache: true
cache-version: 1
- name: Update to latest Rails
run: |
bundle update railties
Expand Down
1 change: 1 addition & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ DEPENDENCIES
appraisal
debug (~> 1.9)
logger
minitest (~> 5.0)
mocha
mysql2
pg
Expand Down
1 change: 1 addition & 0 deletions solid_queue.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ Gem::Specification.new do |spec|

spec.add_development_dependency "appraisal"
spec.add_development_dependency "debug", "~> 1.9"
spec.add_development_dependency "minitest", "~> 5.0"
spec.add_development_dependency "mocha"
spec.add_development_dependency "puma", "~> 7.0"
spec.add_development_dependency "mysql2"
Expand Down
8 changes: 5 additions & 3 deletions test/dummy/config/initializers/sqlite3.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
module SqliteImmediateTransactions
def begin_db_transaction
log("begin immediate transaction", "TRANSACTION") do
with_raw_connection(allow_retry: true, materialize_transactions: false) do |conn|
conn.transaction(:immediate)
if Rails.gem_version < Gem::Version.new("8.2")
log("begin immediate transaction", "TRANSACTION") do
with_raw_connection(allow_retry: true, materialize_transactions: false) do |conn|
conn.transaction(:immediate)
end
end
end
end
Expand Down
15 changes: 7 additions & 8 deletions test/models/solid_queue/process_test.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
require "test_helper"
require "minitest/mock"

class SolidQueue::ProcessTest < ActiveSupport::TestCase
test "prune processes with expired heartbeats" do
Expand Down Expand Up @@ -58,16 +57,16 @@ class SolidQueue::ProcessTest < ActiveSupport::TestCase

test "hostname's with special characters are properly loaded" do
worker = SolidQueue::Worker.new(queues: "*", threads: 3, polling_interval: 0.2)
hostname = "Basecamps-Computer"
hostname = "Basecamp's-Computer"

Socket.stub :gethostname, hostname.dup.force_encoding("ASCII-8BIT") do
worker.start
wait_for_registered_processes(1, timeout: 1.second)
Socket.stubs(:gethostname).returns(hostname.dup.force_encoding("ASCII-8BIT"))

assert_equal hostname, SolidQueue::Process.last.hostname
worker.start
wait_for_registered_processes(1, timeout: 1.second)

worker.stop
end
assert_equal hostname, SolidQueue::Process.last.hostname

worker.stop
end

test "clear unregistered changes before locking for heartbeat" do
Expand Down
3 changes: 3 additions & 0 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Configure Rails Environment
ENV["RAILS_ENV"] = "test"

# Ensure minitest gem is loaded before Rails tries to use minitest/mock
require "minitest"

require_relative "../test/dummy/config/environment"
ActiveRecord::Migrator.migrations_paths = [ File.expand_path("../test/dummy/db/migrate", __dir__) ]
require "rails/test_help"
Expand Down
Loading