Skip to content

Commit

Permalink
patch gRPC leaks in Pub/Sub unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenplusplus committed Mar 8, 2016
1 parent 5762699 commit ec9640c
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions test/pubsub/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@ var arrify = require('arrify');
var assert = require('assert');
var extend = require('extend');
var mockery = require('mockery-next');
var nodeutil = require('util');

var GrpcService = require('../../lib/common/grpc-service.js');
var Topic = require('../../lib/pubsub/topic.js');
var util = require('../../lib/common/util.js');

Expand All @@ -38,11 +36,8 @@ var fakeUtil = extend({}, util);

function FakeGrpcService() {
this.calledWith_ = arguments;
GrpcService.apply(this, arguments);
}

nodeutil.inherits(FakeGrpcService, GrpcService);

var extended = false;
var fakeStreamRouter = {
extend: function(Class, methods) {
Expand Down Expand Up @@ -93,6 +88,7 @@ describe('PubSub', function() {
beforeEach(function() {
SubscriptionOverride = null;
pubsub = new PubSub(OPTIONS);
pubsub.projectId = PROJECT_ID;
});

describe('instantiation', function() {
Expand Down Expand Up @@ -120,7 +116,7 @@ describe('PubSub', function() {
});

it('should inherit from GrpcService', function() {
assert(pubsub instanceof GrpcService);
assert(pubsub instanceof FakeGrpcService);

var calledWith = pubsub.calledWith_[0];

Expand Down Expand Up @@ -495,6 +491,8 @@ describe('PubSub', function() {
it('should create a Subscription', function(done) {
var opts = { a: 'b', c: 'd' };

pubsub.request = util.noop;

pubsub.subscription = function(subName, options) {
assert.strictEqual(subName, SUB_NAME);
assert.deepEqual(options, opts);
Expand Down

0 comments on commit ec9640c

Please sign in to comment.