Skip to content

Commit 890ee0e

Browse files
committed
TravisCI: test tls connect
1 parent a25d1b8 commit 890ee0e

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

.travis.yml

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
sudo: required
21
language: php
32
php:
43
- 7.0
@@ -32,6 +31,7 @@ addons:
3231
- clang
3332
- libzstd1-dev
3433
- valgrind
34+
- stunnel
3535
before_install:
3636
- phpize
3737
- CFGARGS="--enable-redis-lzf --enable-redis-zstd"
@@ -47,6 +47,9 @@ before_script:
4747
- for PORT in $(seq 26379 26380); do wget download.redis.io/redis-stable/sentinel.conf -O $PORT.conf; echo sentinel auth-pass mymaster phpredis >> $PORT.conf; redis-server $PORT.conf --port $PORT --daemonize yes --sentinel; done
4848
- echo yes | redis-cli --cluster create $(seq -f 127.0.0.1:%g 7000 7011) --cluster-replicas 3 -a phpredis
4949
- echo 'extension = redis.so' >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
50+
- openssl req -x509 -newkey rsa:1024 -nodes -keyout stunnel.key -out stunnel.pem -days 1 -subj '/CN=localhost'
51+
- echo -e 'key=stunnel.key\ncert=stunnel.pem\npid=/tmp/stunnel.pid\n[redis]\naccept=6378\nconnect=6379' > stunnel.conf
52+
- stunnel stunnel.conf
5053
script:
5154
- php tests/TestRedis.php --class Redis --auth phpredis
5255
- php tests/TestRedis.php --class RedisArray --auth phpredis

tests/RedisClusterTest.php

+1
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ public function testMultipleConnect() { return $this->markTestSkipped(); }
4646
public function testDoublePipeNoOp() { return $this->markTestSkipped(); }
4747
public function testSwapDB() { return $this->markTestSkipped(); }
4848
public function testConnectException() { return $this->markTestSkipped(); }
49+
public function testTlsConnect() { return $this->markTestSkipped(); }
4950

5051
/* Session locking feature is currently not supported in in context of Redis Cluster.
5152
The biggest issue for this is the distribution nature of Redis cluster */

tests/RedisTest.php

+11
Original file line numberDiff line numberDiff line change
@@ -6236,6 +6236,17 @@ public function testConnectException() {
62366236
}
62376237
}
62386238

6239+
public function testTlsConnect()
6240+
{
6241+
foreach (['localhost' => true, '127.0.0.1' => false] as $host => $verify) {
6242+
$redis = new Redis();
6243+
$this->assertTrue($redis->connect('tls://' . $host, 6378, 0, null, 0, 0, [
6244+
'verify_peer_name' => $verify,
6245+
'verify_peer' => false,
6246+
]));
6247+
}
6248+
}
6249+
62396250
public function testSession_regenerateSessionId_noLock_noDestroy() {
62406251
$this->setSessionHandler();
62416252
$sessionId = $this->generateSessionId();

0 commit comments

Comments
 (0)