diff --git a/ruby/lib/ci/queue.rb b/ruby/lib/ci/queue.rb index 5f27b189..ce0f5d91 100644 --- a/ruby/lib/ci/queue.rb +++ b/ruby/lib/ci/queue.rb @@ -81,7 +81,13 @@ def from_uri(url, config) Static when 'file', nil File - when 'redis', 'rediss' + when 'redis', 'rediss', 'unix' + # `unix://` URLs are forwarded to the Redis backend as-is; + # redis-client's URL parser accepts the unix:// scheme natively + # and treats the path as the socket path. This lets workloads + # that already run an in-process Redis on a unix socket (Nix + # build sandboxes, hermetic test harnesses, etc.) point ci-queue + # at it without exposing a TCP port. require 'ci/queue/redis' Redis else diff --git a/ruby/test/ci/queue/redis_test.rb b/ruby/test/ci/queue/redis_test.rb index f3139582..6ceb2b20 100644 --- a/ruby/test/ci/queue/redis_test.rb +++ b/ruby/test/ci/queue/redis_test.rb @@ -624,6 +624,11 @@ def test_initialise_from_rediss_uri assert_instance_of CI::Queue::Redis::Worker, queue end + def test_initialise_from_unix_uri + queue = CI::Queue.from_uri('unix:///tmp/redis.sock', config) + assert_instance_of CI::Queue::Redis::Worker, queue + end + def test_first_reserve_at_is_set_on_first_reserve queue = worker(1) assert_nil queue.first_reserve_at