Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patch gRPC leaks in unit test #1157

Merged
merged 1 commit into from
Mar 8, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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