Skip to content

Commit

Permalink
FAB-1272 enhance marbles.js with steps
Browse files Browse the repository at this point in the history
Added steps control to the test script so each of the 4 steps
(deploy, create marble, transfer to a new owner, query) can
be performed individually.

Also added a corresponding docker-compose.yml because the
query step in the test script assumes couchdb as the ledger's
backing database.

Change-Id: Ib27f348482ace56731805bdc38aeae58acb13f29
Signed-off-by: Jim Zhang <jzhang@us.ibm.com>
  • Loading branch information
jimthematrix committed Dec 7, 2016
1 parent 8846301 commit f3caf77
Show file tree
Hide file tree
Showing 3 changed files with 406 additions and 223 deletions.
69 changes: 69 additions & 0 deletions test/fixtures/docker-compose-marbles.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
orderer:
image: hyperledger/fabric-orderer
environment:
- ORDERER_GENERAL_LEDGERTYPE=ram
- ORDERER_GENERAL_BATCHTIMEOUT=10s
- ORDERER_GENERAL_BATCHSIZE=2
- ORDERER_GENERAL_MAXWINDOWSIZE=1000
- ORDERER_GENERAL_ORDERERTYPE=solo
- ORDERER_GENERAL_LISTENADDRESS=0.0.0.0
- ORDERER_RAMLEDGER_HISTORY_SIZE=100
working_dir: /opt/gopath/src/github.com/hyperledger/fabric/orderer
command: orderer
ports:
- 7050:7050

couchdb0:
image: klaemo/couchdb:2.0.0
command: tini -- /docker-entrypoint.sh /opt/couchdb/bin/couchdb
ports:
- 5984:5984

couchdb1:
image: klaemo/couchdb:2.0.0
command: tini -- /docker-entrypoint.sh /opt/couchdb/bin/couchdb

vp0:
image: hyperledger/fabric-peer
environment:
- CORE_PEER_ADDRESSAUTODETECT=true
- CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
- CORE_PEER_NETWORKID=${CORE_PEER_ID}
- CORE_NEXT=true
- CORE_PEER_ENDORSER_ENABLED=true
- CORE_PEER_COMMITTER_ENABLED=true
- CORE_PEER_ID=vp0
- CORE_PEER_COMMITTER_LEDGER_ORDERER=orderer:7050
- CORE_PEER_GOSSIP_ORGLEADER=true
- CORE_LEDGER_STATE_STATEDATABASE=CouchDB
- CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdb0:5984
volumes:
- /var/run/:/host/var/run/
ports:
- 7051:7051
links:
- orderer
- couchdb0

vp1:
image: hyperledger/fabric-peer
environment:
- CORE_PEER_ADDRESSAUTODETECT=true
- CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
- CORE_PEER_NETWORKID=${CORE_PEER_ID}
- CORE_NEXT=true
- CORE_PEER_ENDORSER_ENABLED=true
- CORE_PEER_COMMITTER_ENABLED=true
- CORE_PEER_ID=vp1
- CORE_PEER_GOSSIP_BOOTSTRAP=vp0:7051
- CORE_PEER_GOSSIP_ORGLEADER=false
- CORE_LEDGER_STATE_STATEDATABASE=CouchDB
- CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdb1:5984
volumes:
- /var/run/:/host/var/run/
ports:
- 7056:7051
links:
- vp0
- couchdb1

72 changes: 36 additions & 36 deletions test/unit/headless-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -973,46 +973,46 @@ test('\n\n ** Member sendTransaction() tests **\n\n', function (t) {
});

var p2 = m.sendTransaction({
proposal: 'blah',
header: 'blah'
})
.then(function () {
t.fail('Should not have been able to resolve the promise because of missing parameters');
}, function (err) {
if (err.message.indexOf('Missing "proposalResponse" parameter in transaction request') >= 0) {
t.pass('Successfully caught missing proposalResponse error');
} else {
t.fail('Failed to catch the missing proposalResponse error. Error: ' + err.stack ? err.stask : err);
}
});
proposal: 'blah',
header: 'blah'
})
.then(function () {
t.fail('Should not have been able to resolve the promise because of missing parameters');
}, function (err) {
if (err.message.indexOf('Missing "proposalResponse" parameter in transaction request') >= 0) {
t.pass('Successfully caught missing proposalResponse error');
} else {
t.fail('Failed to catch the missing proposalResponse error. Error: ' + err.stack ? err.stask : err);
}
});

var p3 = m.sendTransaction({
proposalResponses: 'blah',
header: 'blah'
})
.then(function () {
t.fail('Should not have been able to resolve the promise because of missing parameters');
}, function (err) {
if (err.message.indexOf('Missing "proposal" parameter in transaction request') >= 0) {
t.pass('Successfully caught missing proposal error');
} else {
t.fail('Failed to catch the missing proposal error. Error: ' + err.stack ? err.stask : err);
}
});
proposalResponses: 'blah',
header: 'blah'
})
.then(function () {
t.fail('Should not have been able to resolve the promise because of missing parameters');
}, function (err) {
if (err.message.indexOf('Missing "proposal" parameter in transaction request') >= 0) {
t.pass('Successfully caught missing proposal error');
} else {
t.fail('Failed to catch the missing proposal error. Error: ' + err.stack ? err.stask : err);
}
});

var p4 = m.sendTransaction({
proposalResponses: 'blah',
proposal: 'blah'
})
.then(function () {
t.fail('Should not have been able to resolve the promise because of missing parameters');
}, function (err) {
if (err.message.indexOf('Missing "header" parameter in transaction request') >= 0) {
t.pass('Successfully caught missing header error');
} else {
t.fail('Failed to catch the missing header error. Error: ' + err.stack ? err.stask : err);
}
});
proposalResponses: 'blah',
proposal: 'blah'
})
.then(function () {
t.fail('Should not have been able to resolve the promise because of missing parameters');
}, function (err) {
if (err.message.indexOf('Missing "header" parameter in transaction request') >= 0) {
t.pass('Successfully caught missing header error');
} else {
t.fail('Failed to catch the missing header error. Error: ' + err.stack ? err.stask : err);
}
});

Promise.all([p1, p2, p3, p4])
.then(
Expand Down
Loading

0 comments on commit f3caf77

Please sign in to comment.