Skip to content

Commit

Permalink
BE-695 Add orderer to node list and network view
Browse files Browse the repository at this point in the history
Change-Id: Ie2bfc923efd3385e014d3b0994c8955115c0cf35
Signed-off-by: Atsushi Neki <atsushin@fast.au.fujitsu.com>
  • Loading branch information
nekia committed Oct 2, 2019
1 parent 5a19221 commit 93fe895
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 4 deletions.
13 changes: 13 additions & 0 deletions app/platform/fabric/Proxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,19 @@ class Proxy {
}
}
peers.push(node);
} else if (node.peer_type === 'ORDERER') {
node.status = 'DOWN';
if (discover_results && discover_results.orderers) {
const org = discover_results.orderers[node.mspid];
for (const endpoint of org.endpoints) {
if (endpoint.host.indexOf(node.server_hostname) > -1) {
node.ledger_height_low = '-';
node.ledger_height_high = '-';
node.ledger_height_unsigned = '-';
}
}
}
peers.push(node);
}
}

Expand Down
4 changes: 2 additions & 2 deletions app/platform/fabric/sync/SyncService.js
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ class SyncServices {

const peer_row = {
mspid: peer.mspid,
requests: requesturl,
requests: requesturl.replace(/^grpcs*:\/\//, ''),
events: eventurl,
server_hostname: host_port[0],
channel_genesis_hash,
Expand Down Expand Up @@ -254,7 +254,7 @@ class SyncServices {

const orderer_row = {
mspid: orderer.org_name,
requests: requesturl,
requests: requesturl.replace(/^grpcs*:\/\//, ''),
server_hostname: orderer.host,
channel_genesis_hash,
peer_type: 'ORDERER'
Expand Down
5 changes: 3 additions & 2 deletions client/test/specs/dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,12 @@ describe('Explorer dashboard', () => {
});

describe('peers', () => {
it('should have 4 peers', () => {
it('should have 5 peers', () => {
var peerList = browser.$(
'#root > div > div > div > div > div:nth-child(2) > div:nth-child(1) > div:nth-child(1) > div > div > div.rt-table > div.rt-tbody'
);
var elmNum = peerList.getProperty('childElementCount');
elmNum.should.be.equal(4);
elmNum.should.be.equal(5);
});

it('should have the correct URL for each peer', () => {
Expand All @@ -82,6 +82,7 @@ describe('Explorer dashboard', () => {
expect(peerUrlStrList).to.include('peer1.org1.example.com');
expect(peerUrlStrList).to.include('peer0.org2.example.com');
expect(peerUrlStrList).to.include('peer1.org2.example.com');
expect(peerUrlStrList).to.include('orderer.example.com');
});
});

Expand Down
47 changes: 47 additions & 0 deletions client/test/specs/network_view.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*
* SPDX-License-Identifier: Apache-2.0
*/

/* eslint-disable no-unused-expressions */

require('chai').should();
var expect = require('chai').expect;

describe('Explorer network view', () => {
before(function() {
// runs before all tests in this block
browser.url('http://explorer.mynetwork.com:8080');
// Login
var userInput = browser.$('#user');
var passInput = browser.$('#password');
userInput.setValue('test');
passInput.setValue('test');
var signinBtn = browser.$('#root > div > div > div > form > button > span');

signinBtn.click();
browser.pause(1000);
});

describe('node list', () => {
it('should have 4 peers and 1 orderer: BE-695', () => {
// Validate each node name retrieved form the table
var networkLink = browser.$(
'#root > div > div:nth-child(1) > div:nth-child(2) > nav > div > ul > li:nth-child(2)'
);
networkLink.click();
browser.pause(5000);

var nodeLists = browser.$$(
'#root > div > div > div > div > div > div > div > div.rt-table > div.rt-tbody > div > div > div:nth-child(1)'
);
let nodeStrList = nodeLists.map((elm, idx, array) => {
return elm.getText();
});
expect(nodeStrList).to.include('peer0.org1.example.com');
expect(nodeStrList).to.include('peer1.org1.example.com');
expect(nodeStrList).to.include('peer0.org2.example.com');
expect(nodeStrList).to.include('peer1.org2.example.com');
expect(nodeStrList).to.include('orderer.example.com');
});
});
});

0 comments on commit 93fe895

Please sign in to comment.