From bd5e2f8e5702208d7ac013d3645d0a52b3d73f78 Mon Sep 17 00:00:00 2001 From: Richard Schneider Date: Fri, 1 Dec 2017 23:16:32 +1300 Subject: [PATCH 1/2] fix: add package version number to the agent version #1080 --- src/core/components/id.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/core/components/id.js b/src/core/components/id.js index dedad190fd..bd3c3eb9dd 100644 --- a/src/core/components/id.js +++ b/src/core/components/id.js @@ -2,6 +2,7 @@ const promisify = require('promisify-es6') const setImmediate = require('async/setImmediate') +const pkgversion = require('../../../package.json').version module.exports = function id (self) { return promisify((opts, callback) => { @@ -18,7 +19,7 @@ module.exports = function id (self) { .map((ma) => ma.toString()) .filter((ma) => ma.indexOf('ipfs') >= 0) .sort(), - agentVersion: 'js-ipfs', + agentVersion: `js-ipfs/${pkgversion}`, protocolVersion: '9000' })) }) From c7367ecad9943b525433362765e73cad409b3b5f Mon Sep 17 00:00:00 2001 From: Richard Schneider Date: Sat, 2 Dec 2017 00:03:12 +1300 Subject: [PATCH 2/2] test: adjust for new agent version --- test/http-api/extra/id.js | 4 +++- test/http-api/spec/id.js | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/test/http-api/extra/id.js b/test/http-api/extra/id.js index 4ea85bff0e..2e7b75e5d7 100644 --- a/test/http-api/extra/id.js +++ b/test/http-api/extra/id.js @@ -13,7 +13,9 @@ module.exports = (ctl) => { expect(err).to.not.exist() expect(result.id).to.equal(idResult.ID) expect(result.publicKey).to.equal(idResult.PublicKey) - expect(result.agentVersion).to.equal(idResult.AgentVersion) + const agentComponents = result.agentVersion.split('/') + expect(agentComponents).lengthOf.above(1) + expect(agentComponents[0]).to.equal(idResult.AgentVersion) expect(result.protocolVersion).to.equal(idResult.ProtocolVersion) done() }) diff --git a/test/http-api/spec/id.js b/test/http-api/spec/id.js index e06f050a03..35dc443e4d 100644 --- a/test/http-api/spec/id.js +++ b/test/http-api/spec/id.js @@ -18,7 +18,9 @@ module.exports = (http) => { }, (res) => { expect(res.result.ID).to.equal(idResult.ID) expect(res.result.PublicKey).to.equal(idResult.PublicKey) - expect(res.result.AgentVersion).to.equal(idResult.AgentVersion) + const agentComponents = res.result.AgentVersion.split('/') + expect(agentComponents).lengthOf.above(1) + expect(agentComponents[0]).to.equal(idResult.AgentVersion) expect(res.result.ProtocolVersion).to.equal(idResult.ProtocolVersion) done() })