Commit a51a33d4 authored by Max Woolf's avatar Max Woolf
Browse files

fix(spec): use Time.now in TestRedis autostart wait loop

Time.zone.now requires ActiveSupport::TimeWithZone to be loaded, which
is not guaranteed at the moment TestRedis.autostart! runs on a cold
spec process (first reset! call before any other lib has loaded zones).
Plain Time.now has the same monotonic-enough semantics for a 15-second
docker compose wait and removes the AS dependency from the autostart
path.
parent 14940bbe
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -92,9 +92,9 @@ module TestRedis
  end

  def self.wait_until_reachable!
    deadline = Time.zone.now + AUTOSTART_TIMEOUT
    deadline = Time.now + AUTOSTART_TIMEOUT
    until reachable?
      raise "TestRedis: Redis at #{URL} not reachable within #{AUTOSTART_TIMEOUT}s of `docker compose up`" if Time.zone.now > deadline
      raise "TestRedis: Redis at #{URL} not reachable within #{AUTOSTART_TIMEOUT}s of `docker compose up`" if Time.now > deadline

      sleep 0.2
    end