File tree Expand file tree Collapse file tree 2 files changed +27
-8
lines changed
activesupport/test/cache/stores Expand file tree Collapse file tree 2 files changed +27
-8
lines changed Original file line number Diff line number Diff line change @@ -25,15 +25,19 @@ def alive?
25
25
end
26
26
end
27
27
28
- begin
29
- servers = ENV [ "MEMCACHE_SERVERS" ] || "localhost:11211"
30
- ss = Dalli ::Client . new ( servers ) . stats
31
- raise Dalli ::DalliError unless ss [ servers ] || ss [ servers + ":11211" ]
32
-
28
+ if ENV [ "CI" ]
33
29
MEMCACHE_UP = true
34
- rescue Dalli ::DalliError
35
- $stderr. puts "Skipping memcached tests. Start memcached and try again."
36
- MEMCACHE_UP = false
30
+ else
31
+ begin
32
+ servers = ENV [ "MEMCACHE_SERVERS" ] || "localhost:11211"
33
+ ss = Dalli ::Client . new ( servers ) . stats
34
+ raise Dalli ::DalliError unless ss [ servers ] || ss [ servers + ":11211" ]
35
+
36
+ MEMCACHE_UP = true
37
+ rescue Dalli ::DalliError
38
+ $stderr. puts "Skipping memcached tests. Start memcached and try again."
39
+ MEMCACHE_UP = false
40
+ end
37
41
end
38
42
39
43
def lookup_store ( options = { } )
Original file line number Diff line number Diff line change @@ -25,6 +25,20 @@ def get(key)
25
25
end
26
26
27
27
module ActiveSupport ::Cache ::RedisCacheStoreTests
28
+ if ENV [ "CI" ]
29
+ REDIS_UP = true
30
+ else
31
+ begin
32
+ redis = Redis . new ( url : "redis://localhost:6379/0" )
33
+ redis . ping
34
+
35
+ REDIS_UP = true
36
+ rescue Redis ::BaseConnectionError
37
+ $stderr. puts "Skipping redis tests. Start redis and try again."
38
+ REDIS_UP = false
39
+ end
40
+ end
41
+
28
42
DRIVER = %w[ ruby hiredis ] . include? ( ENV [ "REDIS_DRIVER" ] ) ? ENV [ "REDIS_DRIVER" ] : "hiredis"
29
43
30
44
class LookupTest < ActiveSupport ::TestCase
@@ -110,6 +124,7 @@ def build(**kwargs)
110
124
111
125
class StoreTest < ActiveSupport ::TestCase
112
126
setup do
127
+ skip "redis server is not up" unless REDIS_UP
113
128
@namespace = "test-#{ SecureRandom . hex } "
114
129
115
130
@cache = lookup_store ( expires_in : 60 )
You can’t perform that action at this time.
0 commit comments