From 96358310f6a022295edbb049c7e7a2d399180318 Mon Sep 17 00:00:00 2001 From: Miguel de Barros Date: Tue, 9 Jul 2019 12:05:37 +0100 Subject: [PATCH 1/7] updating CICD --- .circleci/config.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 9ee2ced54..6a3349fe5 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -147,10 +147,10 @@ jobs: <<: *defaults_working_directory <<: *defaults_docker_node steps: - - checkout - run: name: Install general dependencies command: *defaults_Dependencies + - checkout - run: <<: *defaults_environment - run: @@ -174,10 +174,10 @@ jobs: <<: *defaults_working_directory <<: *defaults_docker_node steps: - - checkout - run: name: Install general dependencies command: *defaults_Dependencies + - checkout - run: <<: *defaults_environment - restore_cache: @@ -202,10 +202,10 @@ jobs: <<: *defaults_working_directory <<: *defaults_docker_node steps: - - checkout - run: name: Install general dependencies command: *defaults_Dependencies + - checkout - run: <<: *defaults_environment - run: From a83582ebbab571bf3a9ea9af960b5dc622115cd5 Mon Sep 17 00:00:00 2001 From: Miguel de Barros Date: Tue, 9 Jul 2019 12:08:04 +0100 Subject: [PATCH 2/7] generalised the sonar cube dir name --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 6a3349fe5..8f274139a 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -228,7 +228,7 @@ jobs: if [ "${CIRCLE_BRANCH}" == "master" ]; then echo "Sending lcov.info to SonarQube..." - aws s3 cp coverage/lcov.info $AWS_S3_DIR_SONARQUBE/central-ledger/lcov.info + aws s3 cp coverage/lcov.info $AWS_S3_DIR_SONARQUBE/$CIRCLE_PROJECT_REPONAME/lcov.info else echo "Not a release (env CIRCLE_BRANCH != 'master'), skipping sending lcov.info to SonarQube." fi From 7fd1f1f643fc7b8c93947181b53d112ef84282e5 Mon Sep 17 00:00:00 2001 From: Miguel de Barros Date: Tue, 9 Jul 2019 12:17:09 +0100 Subject: [PATCH 3/7] updated readme --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index fe0a61677..985509e19 100644 --- a/README.md +++ b/README.md @@ -63,8 +63,8 @@ Tests include unit, functional, and integration. Running the tests: - +```bash npm run test:all - +``` Tests include code coverage via istanbul. See the test/ folder for testing scripts. From 31fffa061aa72eae536b32a0d2ec529b42478e3f Mon Sep 17 00:00:00 2001 From: Miguel de Barros Date: Tue, 9 Jul 2019 13:32:08 +0100 Subject: [PATCH 4/7] Added CLI for starting of Bulk handlers --- src/handlers/bulk/fulfil/handler.js | 1 + src/handlers/bulk/index.js | 62 +++++++++++++++++++++++++ src/handlers/bulk/prepare/handler.js | 1 + src/handlers/bulk/processing/handler.js | 1 + src/handlers/index.js | 27 +++++++++++ src/handlers/register.js | 15 +++--- src/handlers/transfers/handler.js | 11 +++-- src/shared/setup.js | 16 +++++-- 8 files changed, 120 insertions(+), 14 deletions(-) create mode 100644 src/handlers/bulk/index.js diff --git a/src/handlers/bulk/fulfil/handler.js b/src/handlers/bulk/fulfil/handler.js index f3a137eb2..712ee7551 100644 --- a/src/handlers/bulk/fulfil/handler.js +++ b/src/handlers/bulk/fulfil/handler.js @@ -265,5 +265,6 @@ const registerAllHandlers = async () => { module.exports = { bulkFulfil, + registerBulkFulfilHandler, registerAllHandlers } diff --git a/src/handlers/bulk/index.js b/src/handlers/bulk/index.js new file mode 100644 index 000000000..5eb8d1e7c --- /dev/null +++ b/src/handlers/bulk/index.js @@ -0,0 +1,62 @@ +/***** + * @file This registers all handlers for the central-ledger API + License + -------------- + Copyright © 2017 Bill & Melinda Gates Foundation + The Mojaloop files are made available by the Bill & Melinda Gates Foundation under the Apache License, Version 2.0 (the "License") and you may not use these files except in compliance with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, the Mojaloop files are distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. + + Contributors + -------------- + This is the official list of the Mojaloop project contributors for this file. + Names of the original copyright holders (individuals or organizations) + should be listed with a '*' in the first column. People who have + contributed from an organization can be listed under the organization + that actually holds the copyright for their contributions (see the + Gates Foundation organization for an example). Those individuals should have + their names indented and be marked with a '-'. Email address can be added + optionally within square brackets . + + * Gates Foundation + - Name Surname + + * ModusBox + - Miguel de Barros + + -------------- + ******/ + +'use strict' + +const BulkPrepareHandlers = require('./prepare/handler') +const BulkFulfilHandlers = require('./fulfil/handler') +const BulkProcessingHandlers = require('./processing/handler') + +/** + * @function RegisterAllHandlers + * + * @async + * @description Registers all module handlers + * + * @returns {boolean} - Returns a boolean: true if successful, or throws and error if failed + */ +const registerAllHandlers = async () => { + try { + await BulkPrepareHandlers.registerAllHandlers() + await BulkFulfilHandlers.registerAllHandlers() + await BulkProcessingHandlers.registerAllHandlers() + return true + } catch (e) { + throw e + } +} + +module.exports = { + registerBulkPrepareHandler: BulkPrepareHandlers.registerBulkPrepareHandler, + registerBulkFulfilHandler: BulkFulfilHandlers.registerBulkFulfilHandler, + registerBulkProcessingHandler: BulkProcessingHandlers.registerBulkProcessingHandler, + registerAllHandlers +} diff --git a/src/handlers/bulk/prepare/handler.js b/src/handlers/bulk/prepare/handler.js index 9860628a8..b31791d49 100644 --- a/src/handlers/bulk/prepare/handler.js +++ b/src/handlers/bulk/prepare/handler.js @@ -265,5 +265,6 @@ const registerAllHandlers = async () => { module.exports = { bulkPrepare, getBulkMessage, + registerBulkPrepareHandler, registerAllHandlers } diff --git a/src/handlers/bulk/processing/handler.js b/src/handlers/bulk/processing/handler.js index 0df0e47a5..668b216a1 100644 --- a/src/handlers/bulk/processing/handler.js +++ b/src/handlers/bulk/processing/handler.js @@ -360,5 +360,6 @@ const registerAllHandlers = async () => { module.exports = { bulkProcessing, + registerBulkProcessingHandler, registerAllHandlers } diff --git a/src/handlers/index.js b/src/handlers/index.js index 9a7923bfa..a16c81598 100644 --- a/src/handlers/index.js +++ b/src/handlers/index.js @@ -56,6 +56,9 @@ Program.command('handler') // sub-command name, coffeeType = type, required .option('--fulfil', 'Start the Fulfil Handler') .option('--timeout', 'Start the Timeout Handler') .option('--admin', 'Start the Admin Handler') + .option('--bulkprepare', 'Start the Bulk Prepare Handler') + .option('--bulkfulfil', 'Start the Bulk Fulfil Handler') + .option('--bulkprocessing', 'Start the Bulk Processing Handler') // .option('--reject', 'Start the Reject Handler') // function to execute when command is uses @@ -109,6 +112,30 @@ Program.command('handler') // sub-command name, coffeeType = type, required } handlerList.push(handler) } + if (args.bulkprepare) { + Logger.debug(`CLI: Executing --bulkprepare`) + let handler = { + type: 'bulkprepare', + enabled: true + } + handlerList.push(handler) + } + if (args.bulkfulfil) { + Logger.debug(`CLI: Executing --bulkfulfil`) + let handler = { + type: 'bulkfulfil', + enabled: true + } + handlerList.push(handler) + } + if (args.bulkprocessing) { + Logger.debug(`CLI: Executing --bulkprocessing`) + let handler = { + type: 'bulkprocessing', + enabled: true + } + handlerList.push(handler) + } module.exports = Setup.initialize({ service: 'handler', diff --git a/src/handlers/register.js b/src/handlers/register.js index 7d825d053..9d97ec19c 100644 --- a/src/handlers/register.js +++ b/src/handlers/register.js @@ -23,10 +23,11 @@ * Gates Foundation - Name Surname - * Georgi Georgiev - * Lazola Lucas - * Rajiv Mothilal - * Miguel de Barros + * ModusBox + - Georgi Georgiev + - Lazola Lucas + - Rajiv Mothilal + - Miguel de Barros -------------- ******/ @@ -51,7 +52,7 @@ const TransferHandlers = require('./transfers/handler') const PositionHandlers = require('./positions/handler') const TimeoutHandlers = require('./timeouts/handler') const AdminHandlers = require('./admin/handler') -const BulkPrepareHandlers = require('./bulk/prepare/handler') +const BulkHandlers = require('./bulk') const registerAllHandlers = async () => { try { @@ -98,6 +99,8 @@ module.exports = { registerAdminHandlers: AdminHandlers.registerAllHandlers }, bulk: { - registerBulkHandlers: BulkPrepareHandlers.registerAllHandlers + registerBulkPrepareHandler: BulkHandlers.registerBulkPrepareHandler, + registerBulkFulfilHandler: BulkHandlers.registerBulkFulfilHandler, + registerBulkProcessingHandler: BulkHandlers.registerBulkProcessingHandler } } diff --git a/src/handlers/transfers/handler.js b/src/handlers/transfers/handler.js index 88a5bc4c9..53e52e698 100644 --- a/src/handlers/transfers/handler.js +++ b/src/handlers/transfers/handler.js @@ -22,11 +22,12 @@ * Gates Foundation - Name Surname - * Georgi Georgiev - * Rajiv Mothilal - * Miguel de Barros - * Deon Botha - * Shashikant Hirugade + * ModusBox + - Georgi Georgiev + - Rajiv Mothilal + - Miguel de Barros + - Deon Botha + - Shashikant Hirugade -------------- ******/ diff --git a/src/shared/setup.js b/src/shared/setup.js index f00fdcc73..308cc53a8 100644 --- a/src/shared/setup.js +++ b/src/shared/setup.js @@ -23,9 +23,10 @@ * Gates Foundation - Name Surname - * Georgi Georgiev - * Rajiv Mothilal - * Miguel de Barros + * ModusBox + - Georgi Georgiev + - Rajiv Mothilal + - Miguel de Barros -------------- ******/ @@ -188,6 +189,15 @@ const createHandlers = async (handlers) => { case 'get': await RegisterHandlers.transfers.registerGetHandler() break + case 'bulkprepare': + await RegisterHandlers.bulk.registerBulkPrepareHandler() + break + case 'bulkfulfil': + await RegisterHandlers.bulk.registerFulfilHandler() + break + case 'bulkprocessing': + await RegisterHandlers.bulk.registerBulkProcessingHandler() + break default: let error = `Handler Setup - ${JSON.stringify(handler)} is not a valid handler to register!` Logger.error(error) From 19281bc32cc917f7cb962d9960a1eb2df432453f Mon Sep 17 00:00:00 2001 From: Miguel de Barros Date: Wed, 10 Jul 2019 17:42:40 +0100 Subject: [PATCH 5/7] Updates to support Bulk release: 1. Added cli params to start bulkPrepare, bulkFulfil & bulkProcessing handlers 2. Added new default.json config to disable MongoDB (as this is only needed in Bulk Handlers) 3. Updated tests scripts to include additional tests for starting new bulkHandlers via CLI --- config/default.json | 1 + src/lib/config.js | 1 + src/shared/setup.js | 20 ++++++++----- test/integration-config.json | 1 + test/unit/handlers/index.test.js | 25 ++++++++++++++-- test/util/scripts/env.sh | 3 +- test/util/scripts/kill.sh | 2 ++ test/util/scripts/killObjStore.sh | 25 ++++++++++++++++ test/util/scripts/populateTestData.sh | 27 +++++++++++++++++ test/util/scripts/restart.sh | 2 ++ test/util/scripts/restartObjStore.sh | 42 +++++++++++++++++++++++++++ 11 files changed, 138 insertions(+), 11 deletions(-) create mode 100755 test/util/scripts/killObjStore.sh create mode 100755 test/util/scripts/restartObjStore.sh diff --git a/config/default.json b/config/default.json index 50f20adee..8af57768c 100644 --- a/config/default.json +++ b/config/default.json @@ -18,6 +18,7 @@ "POOL_MAX": 30 }, "MONGODB": { + "DISABLED": false, "URI": "mongodb://localhost:27017/mlos" }, "HANDLERS": { diff --git a/src/lib/config.js b/src/lib/config.js index 93f7b14fb..5bce5ea6e 100644 --- a/src/lib/config.js +++ b/src/lib/config.js @@ -8,6 +8,7 @@ module.exports = { DB_CONNECTION_POOL_MIN: RC.DB_CONNECTION.POOL_MIN, DB_CONNECTION_POOL_MAX: RC.DB_CONNECTION.POOL_MAX, MONGODB_URI: RC.MONGODB.URI, + MONGODB_DISABLED: RC.MONGODB.DISABLED, AMOUNT: RC.AMOUNT, EXPIRES_TIMEOUT: RC.EXPIRES_TIMEOUT, SIDECAR: RC.SIDECAR, diff --git a/src/shared/setup.js b/src/shared/setup.js index 308cc53a8..563146de4 100644 --- a/src/shared/setup.js +++ b/src/shared/setup.js @@ -62,13 +62,17 @@ const connectDatabase = async () => { return result } const connectMongoose = async () => { - try { - let db = await ObjStoreDb.connect(Config.MONGODB_URI, { - promiseLibrary: global.Promise - }) - return db - } catch (error) { - Logger.error(`error - ${error}`) // TODO: ADD PROPER ERROR HANDLING HERE POST-POC + if (!Config.MONGODB_DISABLED) { + try { + let db = await ObjStoreDb.connect(Config.MONGODB_URI, { + promiseLibrary: global.Promise + }) + return db + } catch (error) { + Logger.error(`error - ${error}`) // TODO: ADD PROPER ERROR HANDLING HERE POST-POC + return null + } + } else { return null } } @@ -193,7 +197,7 @@ const createHandlers = async (handlers) => { await RegisterHandlers.bulk.registerBulkPrepareHandler() break case 'bulkfulfil': - await RegisterHandlers.bulk.registerFulfilHandler() + await RegisterHandlers.bulk.registerBulkFulfilHandler() break case 'bulkprocessing': await RegisterHandlers.bulk.registerBulkProcessingHandler() diff --git a/test/integration-config.json b/test/integration-config.json index 851c8b7d8..32fea1adf 100644 --- a/test/integration-config.json +++ b/test/integration-config.json @@ -21,6 +21,7 @@ "POOL_MAX": 30 }, "MONGODB": { + "DISABLED": false, "URI": "mongodb://localhost:27017/mlos" }, "HANDLERS": { diff --git a/test/unit/handlers/index.test.js b/test/unit/handlers/index.test.js index 689710390..f9d670d32 100644 --- a/test/unit/handlers/index.test.js +++ b/test/unit/handlers/index.test.js @@ -58,7 +58,10 @@ Test('cli', async (cliTest) => { '--get', '--fulfil', '--timeout', - '--admin' + '--admin', + '--bulkprepare', + '--bulkfulfil', + '--bulkprocessing' ] process.argv = argv @@ -97,13 +100,31 @@ Test('cli', async (cliTest) => { enabled: true } + const bulkprepareHandler = { + type: 'bulkprepare', + enabled: true + } + + const bulkfulfilHandler = { + type: 'bulkfulfil', + enabled: true + } + + const bulkprocessingHandler = { + type: 'bulkprocessing', + enabled: true + } + const modulesList = [ prepareHandler, positionHandler, getHandler, fulfilHandler, timeoutHandler, - adminHandler + adminHandler, + bulkprepareHandler, + bulkfulfilHandler, + bulkprocessingHandler // rejectHandler ] diff --git a/test/util/scripts/env.sh b/test/util/scripts/env.sh index 7d9179ab9..eed82811d 100755 --- a/test/util/scripts/env.sh +++ b/test/util/scripts/env.sh @@ -2,11 +2,12 @@ export KAFKA_ID=kafka export MOCKSERVER_ID=mockserver export DB_ID=mysql -export SLEEP_FACTOR_IN_SECONDS=5 export DBUSER=central_ledger export DBPASS=password export DBNAME=central_ledger export DB_SLEEPTIME=15 +export OBJ_ID=objstore +export SLEEP_FACTOR_IN_SECONDS=5 export MESSAGES_BATCH_SIZE=1000 export SCRIPT_DIR=scripts export FSPList=("dfsp1" "dfsp2") diff --git a/test/util/scripts/kill.sh b/test/util/scripts/kill.sh index 83138e5d0..8f7b13351 100755 --- a/test/util/scripts/kill.sh +++ b/test/util/scripts/kill.sh @@ -20,3 +20,5 @@ sh $CWD/killDb.sh ; sh $CWD/killKafka-johnnypark.sh; sh $CWD/killMockServer.sh + +sh $CWD/killObjStore.sh diff --git a/test/util/scripts/killObjStore.sh b/test/util/scripts/killObjStore.sh new file mode 100755 index 000000000..5eb9e38e5 --- /dev/null +++ b/test/util/scripts/killObjStore.sh @@ -0,0 +1,25 @@ +#!/usr/bin/env bash +echo "---------------------------------------------------------------------" +echo "Starting Object Store Kill Script..." +echo "---------------------------------------------------------------------" +echo + +CWD="${0%/*}" + +if [[ "$CWD" =~ ^(.*)\.sh$ ]]; +then + CWD="." +fi + +echo "Loading env vars..." +source $CWD/env.sh + +echo +echo "---------------------------------------------------------------------" +echo " Stopping ${OBJ_ID} Instance" +echo "---------------------------------------------------------------------" +echo "Destroying ${OBJ_ID}" + +docker stop ${OBJ_ID} +docker rm ${OBJ_ID} +docker volume rm ${OBJ_ID}data diff --git a/test/util/scripts/populateTestData.sh b/test/util/scripts/populateTestData.sh index d051256ae..8457c5d41 100755 --- a/test/util/scripts/populateTestData.sh +++ b/test/util/scripts/populateTestData.sh @@ -186,6 +186,33 @@ do \"value\": \"http://localhost:1080/${FSP}/transfers/{{transferId}}/error\" }'" + sh -c "curl -X POST \ + ${CENTRAL_LEDGER_ADMIN_URI_PREFIX}://${CENTRAL_LEDGER_ADMIN_HOST}:${CENTRAL_LEDGER_ADMIN_PORT}${CENTRAL_LEDGER_ADMIN_BASE}participants/${FSP}/endpoints \ + -H 'Cache-Control: no-cache' \ + -H 'Content-Type: application/json' \ + -d '{ + \"type\": \"FSPIOP_CALLBACK_URL_BULK_TRANSFER_POST\", + \"value\": \"http://localhost:1080/${FSP}/bulkTransfers\" + }'" + + sh -c "curl -X POST \ + ${CENTRAL_LEDGER_ADMIN_URI_PREFIX}://${CENTRAL_LEDGER_ADMIN_HOST}:${CENTRAL_LEDGER_ADMIN_PORT}${CENTRAL_LEDGER_ADMIN_BASE}participants/${FSP}/endpoints \ + -H 'Cache-Control: no-cache' \ + -H 'Content-Type: application/json' \ + -d '{ + \"type\": \"FSPIOP_CALLBACK_URL_BULK_TRANSFER_PUT\", + \"value\": \"http://localhost:1080/${FSP}/bulkTransfers/{{id}}\" + }'" + + sh -c "curl -X POST \ + ${CENTRAL_LEDGER_ADMIN_URI_PREFIX}://${CENTRAL_LEDGER_ADMIN_HOST}:${CENTRAL_LEDGER_ADMIN_PORT}${CENTRAL_LEDGER_ADMIN_BASE}participants/${FSP}/endpoints \ + -H 'Cache-Control: no-cache' \ + -H 'Content-Type: application/json' \ + -d '{ + \"type\": \"FSPIOP_CALLBACK_URL_BULK_TRANSFER_ERROR\", + \"value\": \"http://localhost:1080/${FSP}/bulkTransfers/{{id}}/error\" + }'" + echo echo "Retrieving EndPoints for '$FSP'" echo "---------------------------------------------------------------------" diff --git a/test/util/scripts/restart.sh b/test/util/scripts/restart.sh index 2b812b9f1..5969ad89d 100755 --- a/test/util/scripts/restart.sh +++ b/test/util/scripts/restart.sh @@ -21,4 +21,6 @@ sh $CWD/restartKafka-johnnypark.sh; sh $CWD/restartMockServer.sh; +sh $CWD/restartObjStore.sh; + echo diff --git a/test/util/scripts/restartObjStore.sh b/test/util/scripts/restartObjStore.sh new file mode 100755 index 000000000..ac64a99b9 --- /dev/null +++ b/test/util/scripts/restartObjStore.sh @@ -0,0 +1,42 @@ +#!/usr/bin/env bash +echo "---------------------------------------------------------------------" +echo "Starting Object Store Restart Script..." +echo "---------------------------------------------------------------------" +echo + +CWD="${0%/*}" + +if [[ "$CWD" =~ ^(.*)\.sh$ ]]; +then + CWD="." +fi + +echo "Loading env vars..." +source $CWD/env.sh + +echo +echo "---------------------------------------------------------------------" +echo " Creating ${OBJ_ID} Instance" +echo "---------------------------------------------------------------------" +echo "Destroying ${OBJ_ID}" + +docker stop $OBJ_ID +docker rm $OBJ_ID +docker volume rm ${OBJ_ID}data + +echo "Starting Docker ${OBJ_ID}" +docker run --name ${OBJ_ID} -p 27017:27017 -v ${DB_ID}data:/etc/mongo -d mongo:latest + +sleep $DB_SLEEPTIME; + +is_up() { + curl http://localhost:27017/ --silent --output /dev/null +} + +echo "Waiting for Obj Store to start" +until is_up; do + printf "." + sleep $SLEEP_FACTOR_IN_SECONDS +done + +echo "${OBJ_ID} ready to accept requests..." From ecdb338894b7fc1a55833ea02168c901f1e1f576 Mon Sep 17 00:00:00 2001 From: Miguel de Barros Date: Wed, 10 Jul 2019 18:04:57 +0100 Subject: [PATCH 6/7] Fixing test coverage --- test/unit/shared/setup.test.js | 39 ++++++++++++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) diff --git a/test/unit/shared/setup.test.js b/test/unit/shared/setup.test.js index 9fcee978d..83db70225 100644 --- a/test/unit/shared/setup.test.js +++ b/test/unit/shared/setup.test.js @@ -109,6 +109,7 @@ Test('setup', setupTest => { const ConfigStub = Config ConfigStub.HANDLERS_API_DISABLED = false ConfigStub.HANDLERS_CRON_DISABLED = false + ConfigStub.MONGODB_DISABLED = false Setup = Proxyquire('../../../src/shared/setup', { 'uuid4': uuidStub, @@ -182,7 +183,7 @@ Test('setup', setupTest => { }) setupTest.test('initialize should', async (initializeTest) => { - initializeTest.test('connect to sidecar', async (test) => { + initializeTest.test('connect to Database, Sidecar & ObjStore', async (test) => { const service = 'api' Setup.initialize({ service }).then(s => { @@ -198,6 +199,40 @@ Test('setup', setupTest => { }) }) + initializeTest.test('connect to Database & Sidecar, but NOT too ObjStore', async (test) => { + const ConfigStub = Config + ConfigStub.MONGODB_DISABLED = true + + const service = 'api' + + Setup = Proxyquire('../../../src/shared/setup', { + 'uuid4': uuidStub, + '../handlers/register': RegisterHandlersStub, + '../lib/db': DbStub, + '@mojaloop/central-object-store': ObjStoreStub, + '../lib/migrator': MigratorStub, + '../lib/sidecar': SidecarStub, + '../lib/requestLogger': requestLoggerStub, + './plugins': PluginsStub, + '../lib/urlParser': UrlParserStub, + 'hapi': HapiStub, + '../lib/config': ConfigStub + // '../handlers/lib/kafka': KafkaCronStub + }) + + Setup.initialize({ service }).then(s => { + test.ok(DbStub.connect.calledWith(databaseUri)) + test.notOk(ObjStoreStub.Db.connect.called) + test.ok(SidecarStub.connect.calledWith(service)) + test.notOk(MigratorStub.migrate.called) + test.equal(s, serverStub) + test.end() + }).catch(err => { + test.fail(`Should have not received an error: ${err}`) + test.end() + }) + }) + initializeTest.test('connect to db and return hapi server for "api"', async (test) => { const service = 'api' @@ -360,7 +395,7 @@ Test('setup', setupTest => { './plugins': PluginsStub, '../lib/urlParser': UrlParserStub, 'hapi': HapiStub, - '../lib/config': Config + '../lib/config': ConfigStub // '../handlers/lib/kafka': KafkaCronStub }) From 200b26eb212e926e357e7d6e83ac85dc110c3376 Mon Sep 17 00:00:00 2001 From: Miguel de Barros Date: Wed, 10 Jul 2019 18:09:25 +0100 Subject: [PATCH 7/7] bumped up version to 7.1.1 --- package-lock.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index b93290ddd..9cdf0b2cc 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@mojaloop/central-ledger", - "version": "7.1.0", + "version": "7.1.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index cd55f47f3..ba2c11171 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@mojaloop/central-ledger", - "version": "7.1.0", + "version": "7.1.1", "description": "Central ledger hosted by a scheme to record and settle transfers", "license": "Apache-2.0", "author": "ModusBox",