1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-07 13:22:56 +03:00

feat: add support for rediss protocol in url

This commit is contained in:
calebboyd
2017-10-27 16:32:33 -05:00
committed by Ruben Bridgewater
parent 2a586e35b6
commit 5d6e471d0c
3 changed files with 29 additions and 2 deletions

View File

@@ -108,6 +108,29 @@ describe('TLS connection tests', function () {
client.get('foo', helper.isString('bar', done));
});
describe('using rediss as url protocol', function (done) {
var tls = require('tls')
var tlsConnect = tls.connect
beforeEach(function () {
tls.connect = function (options) {
options = utils.clone(options)
options.ca = tls_options.ca;
return tlsConnect.call(tls, options);
}
})
afterEach(function () {
tls.connect = tlsConnect;
})
it('connect with tls when rediss is used as the protocol', function (done) {
if (skip) this.skip();
client = redis.createClient('rediss://localhost:' + tls_port);
// verify connection is using TCP, not UNIX socket
assert(client.stream.encrypted);
client.set('foo', 'bar');
client.get('foo', helper.isString('bar', done));
});
})
it('fails to connect because the cert is not correct', function (done) {
if (skip) this.skip();
var faulty_cert = utils.clone(tls_options);