Skip to content
This repository has been archived by the owner on Jun 11, 2024. It is now read-only.

Commit

Permalink
Merge pull request #597 from 4miners/543_refactor-rounds-logic
Browse files Browse the repository at this point in the history
Refactor rounds logic - Closes #543
  • Loading branch information
Isabella Dell authored Aug 8, 2017
2 parents e331a6b + 0b2365a commit ef84e1d
Show file tree
Hide file tree
Showing 60 changed files with 3,447 additions and 1,445 deletions.
333 changes: 168 additions & 165 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -124,175 +124,178 @@ lock(resource: "Lisk-Core-Nodes", inversePrecedence: true) {
)
}

stage ('Parallel Tests') {
parallel(
"ESLint" : {
node('node-01'){
sh '''
cd "$(echo $WORKSPACE | cut -f 1 -d '@')"
npm run eslint
'''
}
},
"Functional Accounts" : {
node('node-01'){
sh '''
export TEST=test/api/accounts.js TEST_TYPE='FUNC' NODE_ENV='TEST'
cd "$(echo $WORKSPACE | cut -f 1 -d '@')"
npm run jenkins
'''
}
},
"Functional Blocks" : {
node('node-01'){
sh '''
export TEST=test/api/blocks.js TEST_TYPE='FUNC' NODE_ENV='TEST'
cd "$(echo $WORKSPACE | cut -f 1 -d '@')"
npm run jenkins
'''
}
},
"Functional Delegates" : {
node('node-01'){
sh '''
export TEST=test/api/delegates.js TEST_TYPE='FUNC' NODE_ENV='TEST'
cd "$(echo $WORKSPACE | cut -f 1 -d '@')"
npm run jenkins
'''
}
},
"Functional Dapps" : {
node('node-01'){
sh '''
export TEST=test/api/dapps.js TEST_TYPE='FUNC' NODE_ENV='TEST'
cd "$(echo $WORKSPACE | cut -f 1 -d '@')"
npm run jenkins
'''
}
},
"Functional Loader" : {
node('node-01'){
sh '''
export TEST=test/api/loader.js TEST_TYPE='FUNC' NODE_ENV='TEST'
cd "$(echo $WORKSPACE | cut -f 1 -d '@')"
npm run jenkins
'''
}
},
"Functional Multisignatures" : {
node('node-01'){
sh '''
export TEST=test/api/multisignatures.js TEST_TYPE='FUNC' NODE_ENV='TEST'
cd "$(echo $WORKSPACE | cut -f 1 -d '@')"
npm run jenkins
'''
}
},
"Functional Transactions" : {
node('node-01'){
sh '''
export TEST=test/api/transactions.js TEST_TYPE='FUNC' NODE_ENV='TEST'
cd "$(echo $WORKSPACE | cut -f 1 -d '@')"
npm run jenkins
'''
}
}, //End node-01 tests
"Functional Transport - Main" : {
node('node-02'){
sh '''
export TEST=test/api/transport/transport.js TEST_TYPE='FUNC' NODE_ENV='TEST'
cd "$(echo $WORKSPACE | cut -f 1 -d '@')"
npm run jenkins
'''
}
},
"Functional Transport - Blocks" : {
node('node-02'){
sh '''
export TEST=test/api/transport/transport.blocks.js TEST_TYPE='FUNC' NODE_ENV='TEST'
cd "$(echo $WORKSPACE | cut -f 1 -d '@')"
npm run jenkins
'''
}
},
"Functional Transport - Transactions Main" : {
node('node-02'){
sh '''
export TEST=test/api/transport/transport.transactions.main.js TEST_TYPE='FUNC' NODE_ENV='TEST'
cd "$(echo $WORKSPACE | cut -f 1 -d '@')"
npm run jenkins
'''
}
},
"Functional Transport - Peers" : {
node('node-02'){
sh '''
export TEST=test/api/peers.js TEST_TYPE='FUNC' NODE_ENV='TEST'
cd "$(echo $WORKSPACE | cut -f 1 -d '@')"
npm run jenkins
'''
}
}, // End Node-02 Tests
"Unit - Helpers" : {
node('node-03'){
sh '''
export TEST=test/unit/helpers TEST_TYPE='UNIT' NODE_ENV='TEST'
cd "$(echo $WORKSPACE | cut -f 1 -d '@')"
npm run jenkins
'''
}
},
"Unit - Modules" : {
node('node-03'){
sh '''
export TEST=test/unit/modules/blocks.js TEST_TYPE='UNIT' NODE_ENV='TEST'
cd "$(echo $WORKSPACE | cut -f 1 -d '@')"
npm run jenkins
stage ('Parallel Tests') {
parallel(
"ESLint" : {
node('node-01'){
sh '''
cd "$(echo $WORKSPACE | cut -f 1 -d '@')"
npm run eslint
'''
}
},
"Functional Accounts" : {
node('node-01'){
sh '''
export TEST=test/api/accounts.js TEST_TYPE='FUNC' NODE_ENV='TEST'
cd "$(echo $WORKSPACE | cut -f 1 -d '@')"
npm run jenkins
'''
}
},
"Functional Blocks" : {
node('node-01'){
sh '''
export TEST=test/api/blocks.js TEST_TYPE='FUNC' NODE_ENV='TEST'
cd "$(echo $WORKSPACE | cut -f 1 -d '@')"
npm run jenkins
'''
}
},
"Functional Delegates" : {
node('node-01'){
sh '''
export TEST=test/api/delegates.js TEST_TYPE='FUNC' NODE_ENV='TEST'
cd "$(echo $WORKSPACE | cut -f 1 -d '@')"
npm run jenkins
'''
}
},
"Functional Dapps" : {
node('node-01'){
sh '''
export TEST=test/api/dapps.js TEST_TYPE='FUNC' NODE_ENV='TEST'
cd "$(echo $WORKSPACE | cut -f 1 -d '@')"
npm run jenkins
'''
}
},
"Functional Loader" : {
node('node-01'){
sh '''
export TEST=test/api/loader.js TEST_TYPE='FUNC' NODE_ENV='TEST'
cd "$(echo $WORKSPACE | cut -f 1 -d '@')"
npm run jenkins
'''
}
},
"Functional Multisignatures" : {
node('node-01'){
sh '''
export TEST=test/api/multisignatures.js TEST_TYPE='FUNC' NODE_ENV='TEST'
cd "$(echo $WORKSPACE | cut -f 1 -d '@')"
npm run jenkins
'''
}
},
"Functional Transactions" : {
node('node-01'){
sh '''
export TEST=test/api/transactions.js TEST_TYPE='FUNC' NODE_ENV='TEST'
cd "$(echo $WORKSPACE | cut -f 1 -d '@')"
npm run jenkins
'''
}
}, //End node-01 tests
"Functional Transport - Main" : {
node('node-02'){
sh '''
export TEST=test/api/transport/transport.js TEST_TYPE='FUNC' NODE_ENV='TEST'
cd "$(echo $WORKSPACE | cut -f 1 -d '@')"
npm run jenkins
'''
}
},
"Functional Transport - Blocks" : {
node('node-02'){
sh '''
export TEST=test/api/transport/transport.blocks.js TEST_TYPE='FUNC' NODE_ENV='TEST'
cd "$(echo $WORKSPACE | cut -f 1 -d '@')"
npm run jenkins
'''
}
},
"Functional Transport - Transactions Main" : {
node('node-02'){
sh '''
export TEST=test/api/transport/transport.transactions.main.js TEST_TYPE='FUNC' NODE_ENV='TEST'
cd "$(echo $WORKSPACE | cut -f 1 -d '@')"
npm run jenkins
'''
}
},
"Functional Transport - Peers" : {
node('node-02'){
sh '''
export TEST=test/api/peers.js TEST_TYPE='FUNC' NODE_ENV='TEST'
cd "$(echo $WORKSPACE | cut -f 1 -d '@')"
npm run jenkins
'''
}
}, // End Node-02 Tests
"Unit - Modules" : {
node('node-03'){
sh '''
export TEST=test/unit/modules/blocks.js TEST_TYPE='UNIT' NODE_ENV='TEST'
cd "$(echo $WORKSPACE | cut -f 1 -d '@')"
npm run jenkins
export TEST=test/unit/modules/cache.js TEST_TYPE='UNIT' NODE_ENV='TEST'
npm run jenkins
export TEST=test/unit/modules/cache.js TEST_TYPE='UNIT' NODE_ENV='TEST'
npm run jenkins
export TEST=test/unit/modules/peers.js TEST_TYPE='UNIT' NODE_ENV='TEST'
npm run jenkins
export TEST=test/unit/modules/peers.js TEST_TYPE='UNIT' NODE_ENV='TEST'
npm run jenkins
# Temporarily disabled until implemented
#TEST=test/unit/modules/transactions.js TEST_TYPE='UNIT' NODE_ENV='TEST'
#npm run jenkins
'''
}
},
"Unit - SQL" : {
node('node-03'){
sh '''
export TEST=test/unit/sql/blockRewards.js TEST_TYPE='UNIT' NODE_ENV='TEST'
cd "$(echo $WORKSPACE | cut -f 1 -d '@')"
npm run jenkins
export TEST=test/unit/modules/rounds.js TEST_TYPE='UNIT' NODE_ENV='TEST'
npm run jenkins
export TEST=test/unit/sql/delegatesList.js TEST_TYPE='UNIT' NODE_ENV='TEST'
npm run jenkins
# Temporarily disabled until implemented
#TEST=test/unit/modules/transactions.js TEST_TYPE='UNIT' NODE_ENV='TEST'
#npm run jenkins
'''
}
},
"Unit - SQL" : {
node('node-03'){
sh '''
export TEST=test/unit/sql TEST_TYPE='UNIT' NODE_ENV='TEST'
cd "$(echo $WORKSPACE | cut -f 1 -d '@')"
npm run jenkins
'''
}
},
"Unit - Logic" : {
node('node-03'){
sh '''
export TEST=test/unit/logic TEST_TYPE='UNIT' NODE_ENV='TEST'
cd "$(echo $WORKSPACE | cut -f 1 -d '@')"
npm run jenkins
'''
}
}, // Begin node-04
"Functional Stress - Transactions" : {
node('node-04'){
sh '''
export TEST=test/api/transport/transport.transactions.stress.js TEST_TYPE='FUNC' NODE_ENV='TEST'
cd "$(echo $WORKSPACE | cut -f 1 -d '@')"
npm run jenkins
'''
}
}
) // End Parallel
}
export TEST=test/unit/sql/rounds.js TEST_TYPE='UNIT' NODE_ENV='TEST'
npm run jenkins
'''
}
},
"Unit - Helpers" : {
node('node-03'){
sh '''
export TEST=test/unit/helpers TEST_TYPE='UNIT' NODE_ENV='TEST'
cd "$(echo $WORKSPACE | cut -f 1 -d '@')"
npm run jenkins
'''
}
},
"Unit - Logic" : {
node('node-03'){
sh '''
export TEST=test/unit/logic TEST_TYPE='UNIT' NODE_ENV='TEST'
cd "$(echo $WORKSPACE | cut -f 1 -d '@')"
npm run jenkins
'''
}
}, // Begin node-04
"Functional Stress - Transactions" : {
node('node-04'){
sh '''
export TEST=test/api/transport/transport.transactions.stress.js TEST_TYPE='FUNC' NODE_ENV='TEST'
cd "$(echo $WORKSPACE | cut -f 1 -d '@')"
npm run jenkins
'''
}
}
) // End Parallel
}

stage ('Gather Coverage') {
parallel(
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ Lisk is a next generation crypto-currency and decentralized application platform
sudo -u postgres psql -d lisk_main -c "alter user "$USER" with password 'password';"
```

**NOTE:** Database user requires privileges to `CREATE EXTENSION pgcrypto`.

- Bower (<http://bower.io/>) -- Bower helps to install required JavaScript dependencies.

`npm install -g bower`
Expand Down
10 changes: 7 additions & 3 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ var config = {
system: './modules/system.js',
peers: './modules/peers.js',
delegates: './modules/delegates.js',
rounds: './modules/rounds.js',
multisignatures: './modules/multisignatures.js',
dapps: './modules/dapps.js',
crypto: './modules/crypto.js',
Expand Down Expand Up @@ -395,7 +394,7 @@ d.run(function () {
var topic = args.shift();
var eventName = 'on' + changeCase.pascalCase(topic);

// executes the each module onBind function
// Iterate over modules and execute event functions (on*)
modules.forEach(function (module) {
if (typeof(module[eventName]) === 'function') {
module[eventName].apply(module[eventName], args);
Expand All @@ -416,6 +415,10 @@ d.run(function () {
var db = require('./helpers/database.js');
db.connect(config.db, logger, cb);
},
pg_notify: ['db', 'bus', 'logger', function (scope, cb) {
var pg_notify = require('./helpers/pg-notify.js');
pg_notify.init(scope.db, scope.bus, scope.logger, cb);
}],
/**
* It tries to connect with redis server based on config. provided in config.json file
* @param {function} cb
Expand Down Expand Up @@ -534,8 +537,9 @@ d.run(function () {
}],

ready: ['modules', 'bus', 'logic', function (scope, cb) {
// Fire onBind event in every module
scope.bus.message('bind', scope.modules);
scope.logic.transaction.bindModules(scope.modules);

scope.logic.peers.bindModules(scope.modules);
cb();
}],
Expand Down
1 change: 0 additions & 1 deletion docs/typedef/components.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
* @property {Loader} loader
* @property {Multisignatures} multisignatures
* @property {Peers} peers
* @property {Rounds} rounds
* @property {Server} server
* @property {Signatures} signatures
* @property {Sql} sql
Expand Down
Loading

0 comments on commit ef84e1d

Please sign in to comment.