Skip to content

Commit

Permalink
TravisCI: test tls connect
Browse files Browse the repository at this point in the history
  • Loading branch information
yatsukhnenko committed Jun 5, 2020
1 parent a25d1b8 commit 890ee0e
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
5 changes: 4 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
sudo: required
language: php
php:
- 7.0
Expand Down Expand Up @@ -32,6 +31,7 @@ addons:
- clang
- libzstd1-dev
- valgrind
- stunnel
before_install:
- phpize
- CFGARGS="--enable-redis-lzf --enable-redis-zstd"
Expand All @@ -47,6 +47,9 @@ before_script:
- 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
- echo yes | redis-cli --cluster create $(seq -f 127.0.0.1:%g 7000 7011) --cluster-replicas 3 -a phpredis
- echo 'extension = redis.so' >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
- openssl req -x509 -newkey rsa:1024 -nodes -keyout stunnel.key -out stunnel.pem -days 1 -subj '/CN=localhost'
- echo -e 'key=stunnel.key\ncert=stunnel.pem\npid=/tmp/stunnel.pid\n[redis]\naccept=6378\nconnect=6379' > stunnel.conf
- stunnel stunnel.conf
script:
- php tests/TestRedis.php --class Redis --auth phpredis
- php tests/TestRedis.php --class RedisArray --auth phpredis
Expand Down
1 change: 1 addition & 0 deletions tests/RedisClusterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public function testMultipleConnect() { return $this->markTestSkipped(); }
public function testDoublePipeNoOp() { return $this->markTestSkipped(); }
public function testSwapDB() { return $this->markTestSkipped(); }
public function testConnectException() { return $this->markTestSkipped(); }
public function testTlsConnect() { return $this->markTestSkipped(); }

/* Session locking feature is currently not supported in in context of Redis Cluster.
The biggest issue for this is the distribution nature of Redis cluster */
Expand Down
11 changes: 11 additions & 0 deletions tests/RedisTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6236,6 +6236,17 @@ public function testConnectException() {
}
}

public function testTlsConnect()
{
foreach (['localhost' => true, '127.0.0.1' => false] as $host => $verify) {
$redis = new Redis();
$this->assertTrue($redis->connect('tls://' . $host, 6378, 0, null, 0, 0, [
'verify_peer_name' => $verify,
'verify_peer' => false,
]));
}
}

public function testSession_regenerateSessionId_noLock_noDestroy() {
$this->setSessionHandler();
$sessionId = $this->generateSessionId();
Expand Down

0 comments on commit 890ee0e

Please sign in to comment.