You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-06 02:15:48 +03:00
Remove snack_case and always use camelCase
This commit is contained in:
committed by
Ruben Bridgewater
parent
a86c998a64
commit
28afc33c9a
@@ -8,20 +8,20 @@ var path = require('path');
|
||||
var redis = config.redis;
|
||||
var utils = require('../lib/utils');
|
||||
|
||||
var tls_options = {
|
||||
var tlsOptions = {
|
||||
servername: 'redis.js.org',
|
||||
rejectUnauthorized: true,
|
||||
ca: [ String(fs.readFileSync(path.resolve(__dirname, './conf/redis.js.org.cert'))) ]
|
||||
};
|
||||
|
||||
var tls_port = 6380;
|
||||
var tlsPort = 6380;
|
||||
// Use skip instead of returning to indicate what tests really got skipped
|
||||
var skip = false;
|
||||
|
||||
// Wait until stunnel4 is in the travis whitelist
|
||||
// Check: https://github.com/travis-ci/apt-package-whitelist/issues/403
|
||||
// If this is merged, remove the travis env checks
|
||||
describe('TLS connection tests', function () {
|
||||
describe.skip('TLS connection tests', function () {
|
||||
|
||||
before(function (done) {
|
||||
// Print the warning when the tests run instead of while starting mocha
|
||||
@@ -53,14 +53,14 @@ describe('TLS connection tests', function () {
|
||||
describe('on lost connection', function () {
|
||||
it.skip('emit an error after max retry timeout and do not try to reconnect afterwards', function (done) {
|
||||
if (skip) this.skip();
|
||||
var connect_timeout = 500; // in ms
|
||||
var connectTimeout = 500; // in ms
|
||||
client = redis.createClient({
|
||||
connect_timeout: connect_timeout,
|
||||
port: tls_port,
|
||||
tls: tls_options
|
||||
connectTimeout: connectTimeout,
|
||||
port: tlsPort,
|
||||
tls: tlsOptions
|
||||
});
|
||||
var time = 0;
|
||||
assert.strictEqual(client.address, '127.0.0.1:' + tls_port);
|
||||
assert.strictEqual(client.address, '127.0.0.1:' + tlsPort);
|
||||
|
||||
client.once('ready', function () {
|
||||
helper.killConnection(client);
|
||||
@@ -73,12 +73,12 @@ describe('TLS connection tests', function () {
|
||||
client.on('error', function (err) {
|
||||
if (/Redis connection in broken state: connection timeout.*?exceeded./.test(err.message)) {
|
||||
process.nextTick(function () {
|
||||
assert.strictEqual(time, connect_timeout);
|
||||
assert.strictEqual(client.emitted_end, true);
|
||||
assert.strictEqual(time, connectTimeout);
|
||||
assert.strictEqual(client.emittedEnd, true);
|
||||
assert.strictEqual(client.connected, false);
|
||||
assert.strictEqual(client.ready, false);
|
||||
assert.strictEqual(client.closing, true);
|
||||
assert.strictEqual(time, connect_timeout);
|
||||
assert.strictEqual(time, connectTimeout);
|
||||
done();
|
||||
});
|
||||
}
|
||||
@@ -90,18 +90,18 @@ describe('TLS connection tests', function () {
|
||||
|
||||
it('connect with host and port provided in the tls object', function (done) {
|
||||
if (skip) this.skip();
|
||||
var tls = utils.clone(tls_options);
|
||||
tls.port = tls_port;
|
||||
var tls = utils.clone(tlsOptions);
|
||||
tls.port = tlsPort;
|
||||
tls.host = 'localhost';
|
||||
client = redis.createClient({
|
||||
connect_timeout: 1000,
|
||||
connectTimeout: 1000,
|
||||
tls: tls
|
||||
});
|
||||
|
||||
// verify connection is using TCP, not UNIX socket
|
||||
assert.strictEqual(client.connection_options.host, 'localhost');
|
||||
assert.strictEqual(client.connection_options.port, tls_port);
|
||||
assert.strictEqual(client.address, 'localhost:' + tls_port);
|
||||
assert.strictEqual(client.connectionOptions.host, 'localhost');
|
||||
assert.strictEqual(client.connectionOptions.port, tlsPort);
|
||||
assert.strictEqual(client.address, 'localhost:' + tlsPort);
|
||||
assert(client.stream.encrypted);
|
||||
|
||||
client.set('foo', 'bar');
|
||||
@@ -110,15 +110,15 @@ describe('TLS connection tests', function () {
|
||||
|
||||
it('fails to connect because the cert is not correct', function (done) {
|
||||
if (skip) this.skip();
|
||||
var faulty_cert = utils.clone(tls_options);
|
||||
faulty_cert.ca = [ String(fs.readFileSync(path.resolve(__dirname, './conf/faulty.cert'))) ];
|
||||
var faultyCert = utils.clone(tlsOptions);
|
||||
faultyCert.ca = [ String(fs.readFileSync(path.resolve(__dirname, './conf/faulty.cert'))) ];
|
||||
client = redis.createClient({
|
||||
host: 'localhost',
|
||||
connect_timeout: 1000,
|
||||
port: tls_port,
|
||||
tls: faulty_cert
|
||||
connectTimeout: 1000,
|
||||
port: tlsPort,
|
||||
tls: faultyCert
|
||||
});
|
||||
assert.strictEqual(client.address, 'localhost:' + tls_port);
|
||||
assert.strictEqual(client.address, 'localhost:' + tlsPort);
|
||||
client.on('error', function (err) {
|
||||
assert(/DEPTH_ZERO_SELF_SIGNED_CERT/.test(err.code || err.message), err);
|
||||
client.end(true);
|
||||
|
Reference in New Issue
Block a user