Skip to content

Commit

Permalink
Merge pull request #318 from PengTian0/fix2/node6_8
Browse files Browse the repository at this point in the history
RAC-5743: unit test doesn't exit after upgrading mocha to 4.0.1
  • Loading branch information
anhou authored Nov 10, 2017
2 parents 465ecc3 + ac1c6e9 commit b91b593
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 15 deletions.
2 changes: 1 addition & 1 deletion lib/common/connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ function connectionFactory (assert, amqp, Promise, util, _) {
delete self.connection;
resolve();
});

self.connection.setImplOptions({reconnect: false});
self.connection.disconnect();
} else {
reject(new Error('Connection Not Started.'));
Expand Down
1 change: 1 addition & 0 deletions lib/services/statsd.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ function statsdServiceFactory(
if(this.started) {
this.increment('process.stopped');
this.started = false;
this.close();
}
return Promise.resolve();
};
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
"istanbul": "^0.3.5",
"jsdoc": "^3.3.0-alpha13",
"jshint": "^2.5.11",
"mocha": "^2.1.0",
"mocha": "^4.0.1",
"nock": "~9.0.22",
"sinon": "1.16.1",
"sinon-as-promised": "^2.0.3",
Expand Down
3 changes: 2 additions & 1 deletion spec/lib/common/connection-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,8 @@ describe('Connection', function () {
});
this.subject.start().then(function () {
return expect(self.subject.stop()).to.be.fulfilled;
});
})
.then(done());
});

it('should reject if not connected', function () {
Expand Down
7 changes: 3 additions & 4 deletions spec/lib/protocol/dhcp-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,10 @@ describe("DHCP protocol functions", function () {
testSubscription = new Subscription({},{});
testMessage = new Message({},{},{});
sinon.stub(testMessage);
sinon.stub(messenger);
});

beforeEach(function() {
messenger.subscribe.reset();
messenger.request.reset();
this.sandbox.stub(messenger, 'request');
});

helper.after();
Expand Down Expand Up @@ -291,4 +289,5 @@ describe("DHCP protocol functions", function () {
}).should.be.rejectedWith(sampleError);
});
});
});
});

5 changes: 4 additions & 1 deletion spec/lib/protocol/scheduler-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ describe("Schedular protocol functions", function () {
testSubscription = new Subscription({},{});
testMessage = new Message({},{},{});
sinon.stub(testMessage);
sinon.stub(messenger);
});

beforeEach(function() {
this.sandbox.stub(messenger, 'request');
});

helper.after();
Expand Down
8 changes: 7 additions & 1 deletion spec/lib/protocol/task-graph-runner-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,12 @@ describe("TaskGraph Runner protocol functions", function () {
testSubscription = new Subscription({},{});
testMessage = new Message({},{},{});
sinon.stub(testMessage);
sinon.stub(messenger);
});

beforeEach(function() {
this.sandbox.stub(messenger, 'request');
this.sandbox.stub(messenger, 'publish');
this.sandbox.stub(messenger, 'subscribe');
});

helper.after();
Expand Down Expand Up @@ -88,6 +93,7 @@ describe("TaskGraph Runner protocol functions", function () {

it("should subscribe and receive cancelTaskGraph failures", function() {
var graphId = uuid.v4();
messenger.subscribe.restore();
messenger.request.rejects(sampleError);
return taskgraphrunner.subscribeCancelTaskGraph(function(_graphId) {
expect(_graphId).to.deep.equal(graphId);
Expand Down
5 changes: 4 additions & 1 deletion spec/lib/protocol/task-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,14 @@ describe("Task protocol functions", function() {
testSubscription = new Subscription({},{});
testMessage = new Message({},{},{});
sinon.stub(testMessage);
sinon.stub(messenger);
sinon.stub(testSubscription);
sinon.stub(events);
});

beforeEach(function() {
this.sandbox.stub(messenger, 'request');
this.sandbox.stub(messenger, 'publish');
});
helper.after();

describe("Run", function() {
Expand Down
5 changes: 0 additions & 5 deletions spec/lib/protocol/waterline-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,18 @@ describe('Protocol.Waterline', function() {
var Subscription = helper.injector.get('Subscription');
testSubscription = new Subscription({},{});
sinon.stub(testSubscription);
sinon.stub(messenger);
});

helper.after();

it('should publish a created event', function() {
messenger.publish.resolves();
return waterlineProtocol.publishRecord(collection, 'created', { id: 1 });
});

it('should publish an updated event', function() {
messenger.publish.resolves();
return waterlineProtocol.publishRecord(collection, 'updated', { id: 1 });
});

it('should publish a destroyed event', function() {
messenger.publish.resolves();
return waterlineProtocol.publishRecord(collection, 'destroyed', { id: 1 });
});
});
Expand Down

0 comments on commit b91b593

Please sign in to comment.