Skip to content

Commit 4137c6d

Browse files
[travis] enable Redis cluster
1 parent 6a4de22 commit 4137c6d

File tree

3 files changed

+61
-0
lines changed

3 files changed

+61
-0
lines changed

.travis.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,15 @@ services:
4141
- mongodb
4242
- redis-server
4343
- rabbitmq
44+
- docker
4445

4546
before_install:
47+
- |
48+
# Start Redis cluster
49+
docker pull grokzen/redis-cluster:4.0.8
50+
docker run -d -p 7000:7000 -p 7001:7001 -p 7002:7002 -p 7003:7003 -p 7004:7004 -p 7005:7005 --name redis-cluster grokzen/redis-cluster:4.0.8
51+
export REDIS_CLUSTER_HOSTS='localhost:7000 localhost:7001 localhost:7002 localhost:7003 localhost:7004 localhost:7005'
52+
4653
- |
4754
# General configuration
4855
set -e
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Component\Cache\Tests\Adapter;
13+
14+
class RedisClusterAdapterTest extends AbstractRedisAdapterTest
15+
{
16+
public static function setupBeforeClass()
17+
{
18+
if (!class_exists('RedisCluster')) {
19+
self::markTestSkipped('The RedisCluster class is required.');
20+
}
21+
if (!$hosts = getenv('REDIS_CLUSTER_HOSTS')) {
22+
self::markTestSkipped('REDIS_CLUSTER_PORTS env var is not defined.');
23+
}
24+
25+
self::$redis = new \RedisCluster(null, explode(' ', $hosts));
26+
}
27+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Component\Cache\Tests\Simple;
13+
14+
class RedisClusterCacheTest extends AbstractRedisCacheTest
15+
{
16+
public static function setupBeforeClass()
17+
{
18+
if (!class_exists('RedisCluster')) {
19+
self::markTestSkipped('The RedisCluster class is required.');
20+
}
21+
if (!$hosts = getenv('REDIS_CLUSTER_HOSTS')) {
22+
self::markTestSkipped('REDIS_CLUSTER_PORTS env var is not defined.');
23+
}
24+
25+
self::$redis = new \RedisCluster(null, explode(' ', $hosts));
26+
}
27+
}

0 commit comments

Comments
 (0)