1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-06 02:15:48 +03:00

Add tests for TLS connections

This commit is contained in:
Paddy Byers
2015-10-19 17:17:21 +01:00
committed by Ruben Bridgewater
parent eae5596a3c
commit 1fa9f15ae4
7 changed files with 365 additions and 0 deletions

View File

@@ -4,7 +4,9 @@ var assert = require("assert");
var path = require('path');
var config = require("./lib/config");
var RedisProcess = require("./lib/redis-process");
var StunnelProcess = require("./lib/stunnel-process");
var rp;
var stunnel_process;
function startRedis (conf, done) {
RedisProcess.start(function (err, _rp) {
@@ -13,6 +15,21 @@ function startRedis (conf, done) {
}, path.resolve(__dirname, conf));
}
function startStunnel(done) {
StunnelProcess.start(function (err, _stunnel_process) {
stunnel_process = _stunnel_process;
return done(err);
}, path.resolve(__dirname, './conf'));
}
function stopStunnel(done) {
if(stunnel_process) {
StunnelProcess.stop(stunnel_process, done);
} else {
done();
}
}
// don't start redis every time we
// include this helper file!
if (!process.env.REDIS_TESTS_STARTED) {
@@ -35,6 +52,8 @@ module.exports = {
rp.stop(done);
},
startRedis: startRedis,
stopStunnel: stopStunnel,
startStunnel: startStunnel,
isNumber: function (expected, done) {
return function (err, results) {
assert.strictEqual(null, err, "expected " + expected + ", got error: " + err);