-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #148 from symbol/dev
[statistics-service] task: Dev -> Main - release v1.1.7
- Loading branch information
Showing
10 changed files
with
298 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,15 @@ All notable changes to this project will be documented in this file. | |
|
||
The changelog format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). | ||
|
||
## [v1.1.7][v1.1.7] - 12-May-2022 | ||
|
||
Package | Version | Link | ||
---|---------|--- | ||
REST Core| v2.4.0 | [catapult-rest][[email protected]] | ||
SDK Core| v2.0.0 | [symbol-sdk][[email protected]] | ||
|
||
- Fixed node monitoring scheduled job hanging after a while issue [#145](https://github.com/symbol/statistics-service/pull/145) | ||
|
||
## [v1.1.6][v1.1.6] - 23-Mar-2022 | ||
|
||
Package | Version | Link | ||
|
@@ -175,6 +184,7 @@ REST Core| v2.1.0 | [catapult-rest](https://github.com/symbol/catapult-rest/rele | |
### Fixes | ||
- Cors error. [#13](https://github.com/symbol/statistics-service/issues/13) | ||
|
||
[v1.1.7]: https://github.com/symbol/statistics-service/releases/tag/v1.1.7 | ||
[v1.1.6]: https://github.com/symbol/statistics-service/releases/tag/v1.1.6 | ||
[v1.1.5]: https://github.com/symbol/statistics-service/releases/tag/v1.1.5 | ||
[v1.1.4]: https://github.com/symbol/statistics-service/releases/tag/v1.1.4 | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
import { expect } from 'chai'; | ||
import { stub, restore } from 'sinon'; | ||
import { ApiNodeService } from '@src/services/ApiNodeService'; | ||
|
||
describe('ApiNodeService', () => { | ||
const host = 'localhost'; | ||
const hostURL = `https://${host}:3001`; | ||
const webSocketStatus = { isAvailable: true, wss: true, url: `wss://${host}:3001` }; | ||
const serverInfo = { | ||
restVersion: '2.4.0', | ||
sdkVersion: '2.4.1', | ||
deployment: { | ||
deploymentTool: 'symbol-bootstrap', | ||
deploymentToolVersion: '1.1.6', | ||
lastUpdatedDate: '2022-03-16', | ||
}, | ||
}; | ||
const chainInfo = { | ||
scoreHigh: '0', | ||
scoreLow: '3553661314979960997', | ||
height: '355232', | ||
latestFinalizedBlock: { | ||
finalizationEpoch: 495, | ||
finalizationPoint: 16, | ||
height: '355204', | ||
hash: 'ACE7C54D9DEB625151157D2E0A0EC4CD92235A95A0997FF87FA8DE743A2E46B8', | ||
}, | ||
}; | ||
|
||
afterEach(() => { | ||
restore(); | ||
}); | ||
|
||
it('getStatus returns data successfully', async () => { | ||
// Arrange: | ||
const nodeInfo = { | ||
version: 16777987, | ||
publicKey: '3460D29534CA997D6A74BEBB93F38356833B806E1A35F700EBE08D57FC8D3FED', | ||
networkGenerationHashSeed: '7FCCD304802016BEBBCD342A332F91FF1F3BB5E902988B352697BE245F48E836', | ||
roles: 3, | ||
port: 7900, | ||
networkIdentifier: 152, | ||
host: host, | ||
friendlyName: host, | ||
nodePublicKey: '7F95C44319D02FF33F852142D78D85679B1B82EB48194CCCFBB6749ED75653DC', | ||
}; | ||
|
||
const nodeStatus = { | ||
apiNode: 'up', | ||
db: 'up', | ||
}; | ||
|
||
const finalization = { | ||
height: Number.parseInt(chainInfo.latestFinalizedBlock.height), | ||
epoch: chainInfo.latestFinalizedBlock.finalizationEpoch, | ||
point: chainInfo.latestFinalizedBlock.finalizationPoint, | ||
hash: chainInfo.latestFinalizedBlock.hash, | ||
}; | ||
|
||
stub(ApiNodeService, 'getNodeChainInfo').returns(Promise.resolve(chainInfo)); | ||
stub(ApiNodeService, 'webSocketStatus').returns(Promise.resolve(webSocketStatus)); | ||
stub(ApiNodeService, 'getNodeServer').returns(Promise.resolve(serverInfo)); | ||
stub(ApiNodeService, 'getNodeInfo').returns(Promise.resolve(nodeInfo)); | ||
stub(ApiNodeService, 'getNodeHealth').returns(Promise.resolve(nodeStatus)); | ||
stub(ApiNodeService, 'isHttpsEnabled').returns(Promise.resolve(true)); | ||
|
||
// Act: | ||
const apiStatus = await ApiNodeService.getStatus(hostURL); | ||
|
||
// Assert: | ||
expect(apiStatus.webSocket).to.be.deep.equal(webSocketStatus); | ||
expect(apiStatus.restGatewayUrl).to.be.equal(hostURL); | ||
expect(apiStatus.isAvailable).to.be.equal(true); | ||
expect(apiStatus.isHttpsEnabled).to.be.equal(true); | ||
expect(apiStatus.nodeStatus).to.be.deep.equal(nodeStatus); | ||
expect(apiStatus.chainHeight).to.equal(chainInfo.height); | ||
expect(apiStatus.finalization).to.be.deep.equal(finalization); | ||
expect(apiStatus.nodePublicKey).to.be.equal(nodeInfo.nodePublicKey); | ||
expect(apiStatus.restVersion).to.be.equal(serverInfo.restVersion); | ||
expect(apiStatus.lastStatusCheck).to.be.not.undefined; | ||
}); | ||
|
||
it('getStatus proceeds even if some of the api calls hang', async () => { | ||
// Arrange: | ||
const webSocketStatus = { isAvailable: false, wss: false, url: undefined }; | ||
|
||
stub(ApiNodeService, 'getNodeChainInfo').returns(Promise.resolve(chainInfo)); | ||
stub(ApiNodeService, 'webSocketStatus').returns(Promise.resolve(webSocketStatus)); | ||
|
||
const hangingMethods = ['getNodeInfo', 'getNodeHealth']; | ||
|
||
hangingMethods.map((method: any) => | ||
stub(ApiNodeService, method).returns( | ||
new Promise((_, reject) => { | ||
setTimeout(() => { | ||
reject(Error('timeout')); | ||
}, 6_000); | ||
}), | ||
), | ||
); | ||
stub(ApiNodeService, 'getNodeServer').returns(Promise.resolve(serverInfo)); | ||
|
||
// Act: | ||
const apiStatus = await ApiNodeService.getStatus(hostURL); | ||
|
||
// Assert: | ||
expect(apiStatus.nodePublicKey).to.be.undefined; | ||
expect(apiStatus.nodeStatus).to.be.undefined; | ||
expect(apiStatus.webSocket).to.be.deep.equal(webSocketStatus); | ||
expect(apiStatus.restVersion).to.be.equal(serverInfo.restVersion); | ||
expect(apiStatus.chainHeight).to.be.equal(chainInfo.height); | ||
}).timeout(10_000); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { HTTP } from '@src/services/Http'; | ||
import { use, expect } from 'chai'; | ||
import * as chaiAsPromised from 'chai-as-promised'; | ||
import { stub, restore } from 'sinon'; | ||
import axios from 'axios'; | ||
|
||
use(chaiAsPromised); | ||
|
||
describe('Http', () => { | ||
afterEach(() => { | ||
restore(); | ||
}); | ||
|
||
it('Get method timeouts after given time', async () => { | ||
// Arrange: | ||
stub(axios, 'get').returns( | ||
new Promise((resolve) => { | ||
setTimeout(() => { | ||
resolve('success'); | ||
}, 5_000); | ||
}), | ||
); | ||
|
||
// Act + Assert: | ||
return expect(HTTP.get('SOME_FAKE_URL', { timeout: 2_000 })).to.eventually.be.rejectedWith(HTTP.TIMEOUT_MSG); | ||
}).timeout(3000); | ||
|
||
it('Get method returns data successfully', async () => { | ||
// Arrange: | ||
stub(axios, 'get').returns( | ||
new Promise((resolve, _) => { | ||
setTimeout(() => { | ||
resolve('success'); | ||
}, 1_000); | ||
}), | ||
); | ||
|
||
// Act + Assert: | ||
return expect(HTTP.get('SOME_FAKE_URL', { timeout: 2_000 })).to.eventually.be.equal('success'); | ||
}); | ||
}); |
Oops, something went wrong.