Skip to content

Commit

Permalink
Improve redis code coverage (#422)
Browse files Browse the repository at this point in the history
PR-URL: #422
  • Loading branch information
matthewloring authored Feb 28, 2017
1 parent 1ea81a5 commit f17bd67
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 1 deletion.
1 change: 1 addition & 0 deletions test/plugins/fixtures/redis2.4/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require('redis');
8 changes: 8 additions & 0 deletions test/plugins/fixtures/redis2.4/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "redis2.4",
"version": "1.0.0",
"main": "index.js",
"dependencies": {
"redis": "2.4.x"
}
}
2 changes: 2 additions & 0 deletions test/plugins/test-trace-redis.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ var RESULT_SIZE = 5;
var assert = require('assert');
var versions = {
redis0: './fixtures/redis0.12',
// Our patches are different on redis <2.3, 2.3 - 2.6, and >2.6
redis2dot3: './fixtures/redis2.3',
redis2dot4: './fixtures/redis2.4',
redis2dotx: './fixtures/redis2.x',
redisHiredis04: './fixtures/redis2.3-hiredis0.4',
redisHiredis05: './fixtures/redis2.3-hiredis0.5'
Expand Down
17 changes: 16 additions & 1 deletion test/test-unpatch.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,24 @@ describe('index.js', function() {
wrapTest(mongo.Cursor.prototype, 'next');
});

it('should wrap/unwrap redis on start/stop', function() {
it('should wrap/unwrap redis0.12 on start/stop', function() {
var redis = require('./plugins/fixtures/redis0.12');
wrapTest(redis.RedisClient.prototype, 'send_command');
wrapTest(redis.RedisClient.prototype, 'install_stream_listeners');
wrapTest(redis, 'createClient');
});

it('should wrap/unwrap redis2.4 on start/stop', function() {
var redis = require('./plugins/fixtures/redis2.4');
wrapTest(redis.RedisClient.prototype, 'send_command');
wrapTest(redis.RedisClient.prototype, 'create_stream');
wrapTest(redis, 'createClient');
});

it('should wrap/unwrap redis2.x on start/stop', function() {
var redis = require('./plugins/fixtures/redis2.x');
wrapTest(redis.RedisClient.prototype, 'create_stream');
wrapTest(redis.RedisClient.prototype, 'internal_send_command');
wrapTest(redis, 'createClient');
});

Expand Down

0 comments on commit f17bd67

Please sign in to comment.