Handle port-less $MEMCACHE_SERVERS in MemCacheStore tests

Devs may be running tests on a machine which provides $MEMCACHE_SERVERS
without a trailing port. We should allow for this when checking if
Memcache is working.
This commit is contained in:
Sam Bostock 2020-10-20 20:54:37 -04:00
parent 0a608bd987
commit a812537e4d
No known key found for this signature in database
GPG Key ID: 96D854C4833F2660
2 changed files with 2 additions and 2 deletions

@ -40,7 +40,7 @@ def call_reset_session
require "dalli"
servers = ENV["MEMCACHE_SERVERS"] || "localhost:11211"
ss = Dalli::Client.new(servers).stats
raise Dalli::DalliError unless ss[servers]
raise Dalli::DalliError unless ss[servers] || ss[servers + ":11211"]
def test_setting_and_getting_session_value
with_test_route_set do

@ -27,7 +27,7 @@ class MemCacheStoreTest < ActiveSupport::TestCase
begin
servers = ENV["MEMCACHE_SERVERS"] || "localhost:11211"
ss = Dalli::Client.new(servers).stats
raise Dalli::DalliError unless ss[servers]
raise Dalli::DalliError unless ss[servers] || ss[servers + ":11211"]
MEMCACHE_UP = true
rescue Dalli::DalliError