Skip to content

Commit

Permalink
fixed restart / rerun of meteor job collection to update blockchain w…
Browse files Browse the repository at this point in the history
…ith doi signature
  • Loading branch information
silkroadnomad committed Sep 18, 2018
1 parent 3b4bf29 commit b687ad5
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 20 deletions.
5 changes: 3 additions & 2 deletions contrib/scripts/meteor/start_dapp.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
#!/usr/bin/env bash

rm -rf build && meteor build build/ --architecture os.linux.x86_64 --directory #this takes a lot of time and could be excluded when not needed.
npm cache verify
cd build/bundle/programs/server/
meteor npm install --save bcrypt #@babel/runtime
meteor npm install --save bcrypt
cd -
export METEOR_SETTINGS=$(cat settings-jenkins-bob.json)
echo $METEOR_SETTINGS
export PORT=4000
export ROOT_URL=http://localhost:4000
export MONGO_URL=mongodb://mongo:27017/bob
nohup node build/bundle/main.js &
nohup node build/bundle/main.js #don't in background
2 changes: 1 addition & 1 deletion docker-compose-test-regtest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ services:
- 8.8.8.8
dns_search: ci-doichain.org
#&& export MONGO_URL=mongodb://mongo:27017/alice && meteor npm cache verify && meteor npm install && meteor npm run test-d-compose-alice-mocha
command: bash -c "contrib/scripts/meteor/start_dapp.sh && sleep infinity"
command: bash -c "./contrib/scripts/meteor/start_dapp.sh"
ports:
- "3000:3000"
- "4000:4000"
Expand Down
12 changes: 7 additions & 5 deletions imports/modules/server/doichain/update.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,17 +87,19 @@ const update = (data, job) => {
};

function rerun(job){

job.rerun(
logConfirm('rerunning txid in 10sec - canceling old job','');
job.cancel();
logConfirm('restart blockchain doi update','');
job.restart(
{
repeats: 600, // Only repeat this once
//repeats: 600, // Only repeat this once
// This is the default
wait: 10000 // Wait 10 sec between repeats
// wait: 10000 // Wait 10 sec between repeats
// Default is previous setting
},
function (err, result) {
if (result) {
logConfirm('rerunning txid in 30sec:',result);
logConfirm('rerunning txid in 10sec:',result);
}
}
);
Expand Down
24 changes: 12 additions & 12 deletions server/basic-rest-api.app-test.0.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ describe('alice-basic-doi-test', function () {

txid = resultGetRawTransaction.data.result.txid;
done();
}), 25000); //timeout needed because it takes a moment to store the entry in the blockchain through meteor job collection
}), 35000); //timeout needed because it takes a moment to store the entry in the blockchain through meteor job collection
});

it('should return raw transactions from alice on bobs node ', function (done) {
Expand Down Expand Up @@ -254,28 +254,28 @@ describe('alice-basic-doi-test', function () {

it('should confirm the link of the doi-request-email on bobs dapp', function(done){


setTimeout(
Meteor.bindEnvironment(function () {
logBlockchain('we are waiting a little for the queue doi request to get saved in the blockchain','');
generatetoaddress(node_url_alice,aliceAddress,1); //confirms the SOI not the DOI
}), 15000);

logBlockchain("clickable link:",doiConfirmlink);
const doiConfirmlinkResult = getHttpGET(doiConfirmlink,'');
chai.expect(doiConfirmlinkResult.content).to.have.string('ANMELDUNG ERFOLGREICH');
chai.expect(doiConfirmlinkResult.content).to.have.string('Vielen Dank für Ihre Anmeldung');
chai.expect(doiConfirmlinkResult.content).to.have.string('Ihre Anmeldung war erfolgreich.');
chai.assert.equal(200, doiConfirmlinkResult.statusCode);


setTimeout(
Meteor.bindEnvironment(function () {
logBlockchain('we are waiting a little for the queue doi request to get saved in the blockchain','');
generatetoaddress(node_url_alice,aliceAddress,1); //confirms the SOI not the DOI

setTimeout(
Meteor.bindEnvironment(function () {
generatetoaddress(node_url_alice,aliceAddress,6); //generate a block so doi signature becomes visible in blockchain
done();
}), 45000);
}), 15000);
generatetoaddress(node_url_alice,aliceAddress,6); //generate a block so doi signature becomes visible in blockchain
done();
}), 45000);
});

it('should check if alice local db has information about a confirmed doi already.', function(done){
it('should check if alice local db has information about a confirmed doi.', function(done){
logBlockchain('looking for nameId:',nameId.substring(2));
const our_optIn = OptIns.findOne({nameId: nameId.substring(2)});
logBlockchain('optIn:',our_optIn);
Expand Down

0 comments on commit b687ad5

Please sign in to comment.