@mojaloop/central-ledger 9.2.2 → 15.1.3-snapshot.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.circleci/config.yml +625 -204
- package/.env +3 -2
- package/.ncurc.yaml +9 -0
- package/.nvmrc +1 -1
- package/.versionrc +15 -0
- package/CHANGELOG.md +353 -0
- package/CODEOWNERS +31 -0
- package/Dockerfile +20 -14
- package/LICENSE.md +4 -4
- package/Onboarding.md +0 -7
- package/README.md +99 -22
- package/audit-resolve.json +136 -1
- package/config/default.json +82 -27
- package/docker/central-ledger/default.json +68 -21
- package/docker/ml-api-adapter/default.json +10 -1
- package/docker/wait-for/wait-for-objstore.sh +1 -6
- package/docker/wait-for/wait-for.env +1 -1
- package/docker-compose.integration.yml +8 -5
- package/docker-compose.yml +73 -16
- package/migrations/310203_transferParticipant-indexes.js +38 -0
- package/migrations/310503_participantLimit-indexes-composite.js +38 -0
- package/migrations/{400401_settlementWindowStateChange-indexes.js → 400401_settlmentWindowStateChange-indexes.js} +0 -0
- package/migrations/401301_settlementModel-indexes.js +2 -0
- package/migrations/500401_quote-hotfix-2719.js +58 -0
- package/migrations/500501_feature-fixSubIdRef.js +53 -0
- package/migrations/500601_party-2480.js +63 -0
- package/migrations/501001_quoteExtension-quote-service-174.js +46 -0
- package/migrations/501002_quoteExtension-2522.js +61 -0
- package/migrations/800101_feature-fixSubIdRef.js +90 -0
- package/migrations/910102_hotfix954.js +4 -1
- package/migrations/940100_quotePartyIdInfoExtension.js +52 -0
- package/migrations/940101_quotePartyIdInfoExtension-2522.js +64 -0
- package/migrations/950100_settlementContentAggregation-decimal184.js +40 -0
- package/migrations/950101_transferParticipantStateChange.js +46 -0
- package/migrations/950102_settlementModel-adjustPosition.js +42 -0
- package/migrations/950103_dropTransferParticipantStateChange.js +47 -0
- package/migrations/950104_settlementModel-settlementAccountTypeId.js +79 -0
- package/migrations/950106_unique_settlement_model_ledger_account_currency.js +38 -0
- package/migrations/950107_settlementWindowContent_foreign_settlementModel.js +60 -0
- package/package.json +99 -81
- package/scripts/_wait4_all.js +146 -0
- package/seeds/amountType.js +4 -6
- package/seeds/balanceOfPayments.js +4 -6
- package/seeds/bulkProcessingState.js +4 -6
- package/seeds/bulkTransferState.js +4 -6
- package/seeds/currency.js +4 -6
- package/seeds/endpointType.js +128 -7
- package/seeds/ledgerAccountType.js +11 -10
- package/seeds/ledgerEntryType.js +5 -7
- package/seeds/participant.js +4 -6
- package/seeds/participantLimitType.js +4 -6
- package/seeds/partyIdentifierType.js +4 -6
- package/seeds/partyType.js +4 -6
- package/seeds/settlementDelay.js +4 -6
- package/seeds/settlementGranularity.js +4 -6
- package/seeds/settlementInterchange.js +4 -6
- package/seeds/settlementState.js +4 -6
- package/seeds/settlementWindow1State.js +4 -6
- package/seeds/transactionInitiator.js +4 -6
- package/seeds/transactionInitiatorType.js +4 -6
- package/seeds/transactionScenario.js +4 -6
- package/seeds/transferParticipantRoleType.js +4 -6
- package/seeds/transferState.js +9 -6
- package/src/api/interface/swagger.json +728 -948
- package/src/api/ledgerAccountTypes/handler.js +55 -0
- package/src/api/ledgerAccountTypes/routes.js +63 -0
- package/src/api/metrics/handler.js +2 -2
- package/src/api/metrics/routes.js +1 -1
- package/src/api/participants/handler.js +43 -35
- package/src/api/participants/routes.js +13 -13
- package/src/api/root/routes.js +2 -2
- package/src/api/settlementModels/handler.js +9 -26
- package/src/api/settlementModels/routes.js +4 -4
- package/src/api/transactions/handler.js +46 -0
- package/src/api/transactions/routes.js +45 -0
- package/src/domain/bulkTransfer/index.js +6 -5
- package/src/domain/ledgerAccountTypes/index.js +58 -0
- package/src/domain/participant/index.js +55 -4
- package/src/domain/position/index.js +18 -2
- package/src/domain/settlement/index.js +39 -6
- package/src/domain/transactions/index.js +61 -0
- package/src/domain/transfer/index.js +22 -2
- package/src/domain/transfer/transform.js +3 -3
- package/src/handlers/admin/handler.js +24 -32
- package/src/handlers/bulk/fulfil/handler.js +89 -56
- package/src/handlers/bulk/get/handler.js +203 -0
- package/src/handlers/bulk/index.js +4 -1
- package/src/handlers/bulk/prepare/handler.js +30 -29
- package/src/handlers/bulk/processing/handler.js +61 -32
- package/src/handlers/bulk/shared/validator.js +13 -1
- package/src/handlers/index.js +18 -9
- package/src/handlers/positions/handler.js +67 -46
- package/src/handlers/register.js +7 -7
- package/src/handlers/timeouts/handler.js +9 -4
- package/src/handlers/transfers/handler.js +408 -182
- package/src/handlers/transfers/validator.js +41 -11
- package/src/lib/cache.js +8 -34
- package/src/lib/config.js +5 -7
- package/src/lib/enum.js +22 -22
- package/src/lib/enumCached.js +76 -0
- package/src/lib/healthCheck/subServiceHealth.js +2 -2
- package/src/lib/requestLogger.js +9 -9
- package/src/lib/urlParser.js +1 -1
- package/src/models/bulkTransfer/bulkTransfer.js +6 -6
- package/src/models/bulkTransfer/bulkTransferAssociation.js +3 -3
- package/src/models/bulkTransfer/bulkTransferDuplicateCheck.js +4 -4
- package/src/models/bulkTransfer/bulkTransferExtension.js +2 -2
- package/src/models/bulkTransfer/bulkTransferFulfilmentDuplicateCheck.js +4 -4
- package/src/models/bulkTransfer/bulkTransferStateChange.js +7 -7
- package/src/models/bulkTransfer/facade.js +54 -3
- package/src/models/bulkTransfer/individualTransfer.js +2 -2
- package/src/models/ilpPackets/ilpPacket.js +36 -0
- package/src/models/ledgerAccountType/ledgerAccountType.js +139 -3
- package/src/models/misc/migrationLock.js +1 -1
- package/src/models/misc/segment.js +1 -1
- package/src/models/participant/facade.js +226 -76
- package/src/models/participant/participant.js +6 -5
- package/src/models/participant/participantCached.js +8 -0
- package/src/models/participant/participantCurrency.js +7 -7
- package/src/models/participant/participantCurrencyCached.js +11 -1
- package/src/models/participant/participantLimit.js +13 -13
- package/src/models/participant/participantLimitCached.js +124 -0
- package/src/models/participant/participantPosition.js +34 -5
- package/src/models/participant/participantPositionChange.js +10 -2
- package/src/models/position/facade.js +112 -18
- package/src/models/position/participantPosition.js +6 -6
- package/src/models/settlement/settlementModel.js +92 -17
- package/src/models/settlement/settlementModelCached.js +139 -0
- package/src/models/transfer/facade.js +97 -32
- package/src/models/transfer/ilpPacket.js +4 -4
- package/src/models/transfer/transfer.js +7 -7
- package/src/models/transfer/transferDuplicateCheck.js +21 -5
- package/src/models/transfer/transferError.js +5 -5
- package/src/models/transfer/transferErrorDuplicateCheck.js +4 -4
- package/src/models/transfer/transferExtension.js +4 -4
- package/src/models/transfer/transferFulfilment.js +5 -5
- package/src/models/transfer/transferFulfilmentDuplicateCheck.js +4 -4
- package/src/models/transfer/transferParticipant.js +3 -3
- package/src/models/transfer/transferStateChange.js +11 -11
- package/src/models/transfer/transferTimeout.js +5 -5
- package/src/schema/bulkTransfer.js +4 -4
- package/src/shared/plugins.js +10 -9
- package/src/shared/setup.js +69 -46
- package/test/integration/domain/participant/index.test.js +2 -0
- package/test/integration/handlers/handlers.test.js +605 -166
- package/test/integration/handlers/root.test.js +1 -1
- package/test/integration/helpers/hubAccounts.js +62 -0
- package/test/integration/helpers/ilpPacket.js +1 -1
- package/test/integration/helpers/participantFundsInOut.js +80 -0
- package/test/integration/helpers/participantLimit.js +6 -1
- package/test/integration/helpers/settlementModels.js +88 -0
- package/test/integration/helpers/testConsumer.js +163 -0
- package/test/integration/helpers/testProducer.js +0 -1
- package/test/integration/helpers/transferDuplicateCheck.js +1 -1
- package/test/integration/helpers/transferStateChange.js +1 -1
- package/test/integration/helpers/transferTestHelper.js +3 -5
- package/test/integration/models/transfer/transferStateChange.test.js +6 -0
- package/test/unit/api/ledgerAccountTypes/handler.test.js +126 -0
- package/test/unit/api/ledgerAccountTypes/routes.test.js +52 -0
- package/test/unit/api/participants/handler.test.js +75 -33
- package/test/unit/api/root/handler.test.js +1 -1
- package/test/unit/api/root/routes.test.js +2 -2
- package/test/unit/api/settlementModels/handler.test.js +21 -57
- package/test/unit/api/transactions/handler.test.js +108 -0
- package/test/unit/api/transactions/routes.test.js +38 -0
- package/test/unit/domain/ledgerAccountTypes/index.test.js +197 -0
- package/test/unit/domain/participant/index.test.js +115 -2
- package/test/unit/domain/settlement/index.test.js +199 -29
- package/test/unit/domain/transactions/index.test.js +128 -0
- package/test/unit/domain/transfer/index.test.js +1 -0
- package/test/unit/domain/transfer/transform.test.js +2 -0
- package/test/unit/handlers/admin/handler.test.js +5 -5
- package/test/unit/handlers/bulk/get/handler.test.js +401 -0
- package/test/unit/handlers/index.test.js +6 -0
- package/test/unit/handlers/positions/handler.test.js +26 -0
- package/test/unit/handlers/register.test.js +2 -0
- package/test/unit/handlers/transfers/handler.test.js +491 -36
- package/test/unit/handlers/transfers/validator.test.js +31 -31
- package/test/unit/lib/cache.test.js +0 -64
- package/test/unit/lib/cachingOfEnums.test.js +121 -0
- package/test/unit/lib/config.test.js +34 -0
- package/test/unit/lib/enum.test.js +6 -1
- package/test/unit/lib/enumCached.test.js +82 -0
- package/test/unit/lib/healthCheck/subServiceHealth.test.js +2 -0
- package/test/unit/lib/requestLogger.test.js +14 -12
- package/test/unit/models/ilpPackets/ilpPacket.test.js +89 -0
- package/test/unit/models/ledgerAccountType/ledgerAccountType.test.js +255 -6
- package/test/unit/models/misc/migrationLock.test.js +4 -0
- package/test/unit/models/misc/segment.test.js +5 -0
- package/test/unit/models/participant/facade.test.js +493 -54
- package/test/unit/models/participant/participant.test.js +4 -0
- package/test/unit/models/participant/participantCurrency.test.js +22 -9
- package/test/unit/models/participant/participantCurrencyCached.test.js +1 -1
- package/test/unit/models/participant/participantLimit.test.js +97 -0
- package/test/unit/models/participant/participantLimitCached.test.js +232 -0
- package/test/unit/models/participant/participantPosition.test.js +217 -0
- package/test/unit/models/participant/participantPositionChange.test.js +3 -0
- package/test/unit/models/position/facade.test.js +318 -29
- package/test/unit/models/position/participantPosition.test.js +22 -7
- package/test/unit/models/settlement/settlementModel.test.js +18 -37
- package/test/unit/models/settlement/settlementModelCached.test.js +171 -0
- package/test/unit/models/transfer/facade.test.js +115 -0
- package/test/unit/models/transfer/ilpPacket.test.js +28 -11
- package/test/unit/models/transfer/transfer.test.js +13 -4
- package/test/unit/models/transfer/transferDuplicateCheck.test.js +4 -0
- package/test/unit/models/transfer/transferError.test.js +5 -1
- package/test/unit/models/transfer/transferErrorDuplicateCheck.test.js +4 -0
- package/test/unit/models/transfer/transferExtension.test.js +26 -9
- package/test/unit/models/transfer/transferFulfilment.test.js +14 -5
- package/test/unit/models/transfer/transferFulfilmentDuplicateCheck.test.js +4 -0
- package/test/unit/models/transfer/transferParticipant.test.js +14 -5
- package/test/unit/models/transfer/transferStateChange.test.js +3 -0
- package/test/unit/models/transfer/transferTimeout.test.js +6 -0
- package/test/unit/seeds/amountType.test.js +6 -22
- package/test/unit/seeds/balanceOfPayments.test.js +6 -22
- package/test/unit/seeds/bulkProcessingState.test.js +84 -0
- package/test/unit/{lib/sidecar/nullClient.test.js → seeds/bulkTransferState.test.js} +36 -39
- package/test/unit/seeds/currency.test.js +6 -22
- package/test/unit/seeds/endpointType.test.js +6 -22
- package/test/unit/seeds/ledgerAccountType.test.js +5 -22
- package/test/unit/seeds/ledgerEntryType.test.js +6 -22
- package/test/unit/seeds/participant.test.js +5 -22
- package/test/unit/seeds/participantLimitType.test.js +6 -22
- package/test/unit/seeds/partyIdentifierType.test.js +6 -22
- package/test/unit/seeds/partyType.test.js +6 -22
- package/test/unit/seeds/settlementState.test.js +5 -22
- package/test/unit/seeds/settlementWindow1State.test.js +5 -22
- package/test/unit/seeds/transactionInitiator.test.js +6 -22
- package/test/unit/seeds/transactionInitiatorType.test.js +6 -22
- package/test/unit/seeds/transactionScenario.test.js +6 -22
- package/test/unit/seeds/transferParticipantRoleType.test.js +6 -22
- package/test/unit/seeds/transferState.test.js +6 -22
- package/test/unit/shared/plugins.test.js +31 -1
- package/test/unit/shared/setup.test.js +25 -36
- package/test/util/helpers.js +37 -2
- package/test/util/randomTransfers.js +1 -1
- package/test/util/scripts/env.sh +6 -5
- package/test/util/scripts/populateTestData.sh +204 -181
- package/test/util/scripts/populateTestDataForLegacySimulator.sh +261 -0
- package/test/util/scripts/restartObjStore.sh +1 -1
- package/test-integration.Dockerfile +15 -15
- package/test.Dockerfile +12 -12
- package/.circleci/_set_up_deploy_envs.sh +0 -47
- package/.dockerignore +0 -17
- package/.ncurc.json +0 -3
- package/server.sh +0 -4
- package/sonar-project.properties +0 -17
- package/src/lib/sidecar/index.js +0 -47
- package/src/lib/sidecar/nullClient.js +0 -18
- package/test/.env +0 -8
- package/test/integration-config.json +0 -367
- package/test/integration-runner.env +0 -31
- package/test/integration-runner.sh +0 -264
- package/test/spec-runner.sh +0 -132
- package/test/unit/lib/sidecar/index.test.js +0 -148
- package/test/unit/models/position/participantLimit.test.js +0 -135
|
@@ -45,7 +45,11 @@ Test('Settlement Window1 State', async (settlementWindow1StateTest) => {
|
|
|
45
45
|
await settlementWindow1StateTest.test('seed should', async (test) => {
|
|
46
46
|
const knexStub = sandbox.stub()
|
|
47
47
|
knexStub.returns({
|
|
48
|
-
insert: sandbox.stub().returns(
|
|
48
|
+
insert: sandbox.stub().returns({
|
|
49
|
+
onConflict: sandbox.stub().returns({
|
|
50
|
+
ignore: sandbox.stub().returns(true)
|
|
51
|
+
})
|
|
52
|
+
})
|
|
49
53
|
})
|
|
50
54
|
|
|
51
55
|
try {
|
|
@@ -60,27 +64,6 @@ Test('Settlement Window1 State', async (settlementWindow1StateTest) => {
|
|
|
60
64
|
}
|
|
61
65
|
})
|
|
62
66
|
|
|
63
|
-
await settlementWindow1StateTest.test('seed should', async (test) => {
|
|
64
|
-
function DuplicateEntryError (message) {
|
|
65
|
-
this.name = 'DuplicateEntryError'
|
|
66
|
-
this.message = message || ''
|
|
67
|
-
this.code = 'ER_DUP_ENTRY'
|
|
68
|
-
}
|
|
69
|
-
DuplicateEntryError.prototype = Error.prototype
|
|
70
|
-
|
|
71
|
-
const knexStub = sandbox.stub()
|
|
72
|
-
knexStub.throws(new DuplicateEntryError())
|
|
73
|
-
try {
|
|
74
|
-
const result = await Model.seed(knexStub)
|
|
75
|
-
test.equal(result, -1001, 'Duplicate error intercepted and ignored')
|
|
76
|
-
test.end()
|
|
77
|
-
} catch (err) {
|
|
78
|
-
Logger.error(`settlementWindow1State seed failed with error - ${err}`)
|
|
79
|
-
test.fail()
|
|
80
|
-
test.end()
|
|
81
|
-
}
|
|
82
|
-
})
|
|
83
|
-
|
|
84
67
|
await settlementWindow1StateTest.test('seed should', async (test) => {
|
|
85
68
|
const knexStub = sandbox.stub()
|
|
86
69
|
knexStub.returns({
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
- Name Surname <name.surname@gatesfoundation.com>
|
|
20
20
|
|
|
21
21
|
* Georgi Georgiev <georgi.georgiev@modusbox.com>
|
|
22
|
+
* Shashikant Hirugade <shashikant.hirugade@modusbox.com>
|
|
22
23
|
--------------
|
|
23
24
|
******/
|
|
24
25
|
|
|
@@ -46,7 +47,11 @@ Test('TransactionInitiator', async (transactionInitiatorTest) => {
|
|
|
46
47
|
await transactionInitiatorTest.test('seed should', async (test) => {
|
|
47
48
|
const knexStub = sandbox.stub()
|
|
48
49
|
knexStub.returns({
|
|
49
|
-
insert: sandbox.stub().returns(
|
|
50
|
+
insert: sandbox.stub().returns({
|
|
51
|
+
onConflict: sandbox.stub().returns({
|
|
52
|
+
ignore: sandbox.stub().returns(true)
|
|
53
|
+
})
|
|
54
|
+
})
|
|
50
55
|
})
|
|
51
56
|
|
|
52
57
|
try {
|
|
@@ -61,27 +66,6 @@ Test('TransactionInitiator', async (transactionInitiatorTest) => {
|
|
|
61
66
|
}
|
|
62
67
|
})
|
|
63
68
|
|
|
64
|
-
await transactionInitiatorTest.test('seed should', async (test) => {
|
|
65
|
-
function DuplicateEntryError (message) {
|
|
66
|
-
this.name = 'DuplicateEntryError'
|
|
67
|
-
this.message = message || ''
|
|
68
|
-
this.code = 'ER_DUP_ENTRY'
|
|
69
|
-
}
|
|
70
|
-
DuplicateEntryError.prototype = Error.prototype
|
|
71
|
-
|
|
72
|
-
const knexStub = sandbox.stub()
|
|
73
|
-
knexStub.throws(new DuplicateEntryError())
|
|
74
|
-
try {
|
|
75
|
-
const result = await Model.seed(knexStub)
|
|
76
|
-
test.equal(result, -1001, 'Duplicate error intercepted and ignored')
|
|
77
|
-
test.end()
|
|
78
|
-
} catch (err) {
|
|
79
|
-
Logger.error(`transactionInitiator seed failed with error - ${err}`)
|
|
80
|
-
test.fail()
|
|
81
|
-
test.end()
|
|
82
|
-
}
|
|
83
|
-
})
|
|
84
|
-
|
|
85
69
|
await transactionInitiatorTest.test('seed should', async (test) => {
|
|
86
70
|
const knexStub = sandbox.stub()
|
|
87
71
|
knexStub.returns({
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
- Name Surname <name.surname@gatesfoundation.com>
|
|
20
20
|
|
|
21
21
|
* Georgi Georgiev <georgi.georgiev@modusbox.com>
|
|
22
|
+
* Shashikant Hirugade <shashikant.hirugade@modusbox.com>
|
|
22
23
|
--------------
|
|
23
24
|
******/
|
|
24
25
|
|
|
@@ -46,7 +47,11 @@ Test('TransactionInitiatorType', async (transactionInitiatorTypeTest) => {
|
|
|
46
47
|
await transactionInitiatorTypeTest.test('seed should', async (test) => {
|
|
47
48
|
const knexStub = sandbox.stub()
|
|
48
49
|
knexStub.returns({
|
|
49
|
-
insert: sandbox.stub().returns(
|
|
50
|
+
insert: sandbox.stub().returns({
|
|
51
|
+
onConflict: sandbox.stub().returns({
|
|
52
|
+
ignore: sandbox.stub().returns(true)
|
|
53
|
+
})
|
|
54
|
+
})
|
|
50
55
|
})
|
|
51
56
|
|
|
52
57
|
try {
|
|
@@ -61,27 +66,6 @@ Test('TransactionInitiatorType', async (transactionInitiatorTypeTest) => {
|
|
|
61
66
|
}
|
|
62
67
|
})
|
|
63
68
|
|
|
64
|
-
await transactionInitiatorTypeTest.test('seed should', async (test) => {
|
|
65
|
-
function DuplicateEntryError (message) {
|
|
66
|
-
this.name = 'DuplicateEntryError'
|
|
67
|
-
this.message = message || ''
|
|
68
|
-
this.code = 'ER_DUP_ENTRY'
|
|
69
|
-
}
|
|
70
|
-
DuplicateEntryError.prototype = Error.prototype
|
|
71
|
-
|
|
72
|
-
const knexStub = sandbox.stub()
|
|
73
|
-
knexStub.throws(new DuplicateEntryError())
|
|
74
|
-
try {
|
|
75
|
-
const result = await Model.seed(knexStub)
|
|
76
|
-
test.equal(result, -1001, 'Duplicate error intercepted and ignored')
|
|
77
|
-
test.end()
|
|
78
|
-
} catch (err) {
|
|
79
|
-
Logger.error(`transactionInitiatorType seed failed with error - ${err}`)
|
|
80
|
-
test.fail()
|
|
81
|
-
test.end()
|
|
82
|
-
}
|
|
83
|
-
})
|
|
84
|
-
|
|
85
69
|
await transactionInitiatorTypeTest.test('seed should', async (test) => {
|
|
86
70
|
const knexStub = sandbox.stub()
|
|
87
71
|
knexStub.returns({
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
- Name Surname <name.surname@gatesfoundation.com>
|
|
20
20
|
|
|
21
21
|
* Georgi Georgiev <georgi.georgiev@modusbox.com>
|
|
22
|
+
* Shashikant Hirugade <shashikant.hirugade@modusbox.com>
|
|
22
23
|
--------------
|
|
23
24
|
******/
|
|
24
25
|
|
|
@@ -46,7 +47,11 @@ Test('TransactionScenario', async (transactionScenarioTest) => {
|
|
|
46
47
|
await transactionScenarioTest.test('seed should', async (test) => {
|
|
47
48
|
const knexStub = sandbox.stub()
|
|
48
49
|
knexStub.returns({
|
|
49
|
-
insert: sandbox.stub().returns(
|
|
50
|
+
insert: sandbox.stub().returns({
|
|
51
|
+
onConflict: sandbox.stub().returns({
|
|
52
|
+
ignore: sandbox.stub().returns(true)
|
|
53
|
+
})
|
|
54
|
+
})
|
|
50
55
|
})
|
|
51
56
|
|
|
52
57
|
try {
|
|
@@ -61,27 +66,6 @@ Test('TransactionScenario', async (transactionScenarioTest) => {
|
|
|
61
66
|
}
|
|
62
67
|
})
|
|
63
68
|
|
|
64
|
-
await transactionScenarioTest.test('seed should', async (test) => {
|
|
65
|
-
function DuplicateEntryError (message) {
|
|
66
|
-
this.name = 'DuplicateEntryError'
|
|
67
|
-
this.message = message || ''
|
|
68
|
-
this.code = 'ER_DUP_ENTRY'
|
|
69
|
-
}
|
|
70
|
-
DuplicateEntryError.prototype = Error.prototype
|
|
71
|
-
|
|
72
|
-
const knexStub = sandbox.stub()
|
|
73
|
-
knexStub.throws(new DuplicateEntryError())
|
|
74
|
-
try {
|
|
75
|
-
const result = await Model.seed(knexStub)
|
|
76
|
-
test.equal(result, -1001, 'Duplicate error intercepted and ignored')
|
|
77
|
-
test.end()
|
|
78
|
-
} catch (err) {
|
|
79
|
-
Logger.error(`transactionScenario seed failed with error - ${err}`)
|
|
80
|
-
test.fail()
|
|
81
|
-
test.end()
|
|
82
|
-
}
|
|
83
|
-
})
|
|
84
|
-
|
|
85
69
|
await transactionScenarioTest.test('seed should', async (test) => {
|
|
86
70
|
const knexStub = sandbox.stub()
|
|
87
71
|
knexStub.returns({
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
- Name Surname <name.surname@gatesfoundation.com>
|
|
20
20
|
|
|
21
21
|
* Georgi Georgiev <georgi.georgiev@modusbox.com>
|
|
22
|
+
* Shashikant Hirugade <shashikant.hirugade@modusbox.com>
|
|
22
23
|
--------------
|
|
23
24
|
******/
|
|
24
25
|
|
|
@@ -45,7 +46,11 @@ Test('Transfer participant role type', async (transferParticipantRoleTypeTest) =
|
|
|
45
46
|
await transferParticipantRoleTypeTest.test('seed should', async (test) => {
|
|
46
47
|
const knexStub = sandbox.stub()
|
|
47
48
|
knexStub.returns({
|
|
48
|
-
insert: sandbox.stub().returns(
|
|
49
|
+
insert: sandbox.stub().returns({
|
|
50
|
+
onConflict: sandbox.stub().returns({
|
|
51
|
+
ignore: sandbox.stub().returns(true)
|
|
52
|
+
})
|
|
53
|
+
})
|
|
49
54
|
})
|
|
50
55
|
|
|
51
56
|
try {
|
|
@@ -60,27 +65,6 @@ Test('Transfer participant role type', async (transferParticipantRoleTypeTest) =
|
|
|
60
65
|
}
|
|
61
66
|
})
|
|
62
67
|
|
|
63
|
-
await transferParticipantRoleTypeTest.test('seed should', async (test) => {
|
|
64
|
-
function DuplicateEntryError (message) {
|
|
65
|
-
this.name = 'DuplicateEntryError'
|
|
66
|
-
this.message = message || ''
|
|
67
|
-
this.code = 'ER_DUP_ENTRY'
|
|
68
|
-
}
|
|
69
|
-
DuplicateEntryError.prototype = Error.prototype
|
|
70
|
-
|
|
71
|
-
const knexStub = sandbox.stub()
|
|
72
|
-
knexStub.throws(new DuplicateEntryError())
|
|
73
|
-
try {
|
|
74
|
-
const result = await Model.seed(knexStub)
|
|
75
|
-
test.equal(result, -1001, 'Duplicate error intercepted and ignored')
|
|
76
|
-
test.end()
|
|
77
|
-
} catch (err) {
|
|
78
|
-
Logger.error(`transferParticipantRoleType seed failed with error - ${err}`)
|
|
79
|
-
test.fail()
|
|
80
|
-
test.end()
|
|
81
|
-
}
|
|
82
|
-
})
|
|
83
|
-
|
|
84
68
|
await transferParticipantRoleTypeTest.test('seed should', async (test) => {
|
|
85
69
|
const knexStub = sandbox.stub()
|
|
86
70
|
knexStub.returns({
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
- Name Surname <name.surname@gatesfoundation.com>
|
|
20
20
|
|
|
21
21
|
* Georgi Georgiev <georgi.georgiev@modusbox.com>
|
|
22
|
+
* Shashikant Hirugade <shashikant.hirugade@modusbox.com>
|
|
22
23
|
--------------
|
|
23
24
|
******/
|
|
24
25
|
|
|
@@ -45,7 +46,11 @@ Test('Transfer state', async (transferStateTest) => {
|
|
|
45
46
|
await transferStateTest.test('seed should', async (test) => {
|
|
46
47
|
const knexStub = sandbox.stub()
|
|
47
48
|
knexStub.returns({
|
|
48
|
-
insert: sandbox.stub().returns(
|
|
49
|
+
insert: sandbox.stub().returns({
|
|
50
|
+
onConflict: sandbox.stub().returns({
|
|
51
|
+
ignore: sandbox.stub().returns(true)
|
|
52
|
+
})
|
|
53
|
+
})
|
|
49
54
|
})
|
|
50
55
|
|
|
51
56
|
try {
|
|
@@ -60,27 +65,6 @@ Test('Transfer state', async (transferStateTest) => {
|
|
|
60
65
|
}
|
|
61
66
|
})
|
|
62
67
|
|
|
63
|
-
await transferStateTest.test('seed should', async (test) => {
|
|
64
|
-
function DuplicateEntryError (message) {
|
|
65
|
-
this.name = 'DuplicateEntryError'
|
|
66
|
-
this.message = message || ''
|
|
67
|
-
this.code = 'ER_DUP_ENTRY'
|
|
68
|
-
}
|
|
69
|
-
DuplicateEntryError.prototype = Error.prototype
|
|
70
|
-
|
|
71
|
-
const knexStub = sandbox.stub()
|
|
72
|
-
knexStub.throws(new DuplicateEntryError())
|
|
73
|
-
try {
|
|
74
|
-
const result = await Model.seed(knexStub)
|
|
75
|
-
test.equal(result, -1001, 'Duplicate error intercepted and ignored')
|
|
76
|
-
test.end()
|
|
77
|
-
} catch (err) {
|
|
78
|
-
Logger.error(`transferState seed failed with error - ${err}`)
|
|
79
|
-
test.fail()
|
|
80
|
-
test.end()
|
|
81
|
-
}
|
|
82
|
-
})
|
|
83
|
-
|
|
84
68
|
await transferStateTest.test('seed should', async (test) => {
|
|
85
69
|
const knexStub = sandbox.stub()
|
|
86
70
|
knexStub.returns({
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
3
|
const Test = require('tape')
|
|
4
|
-
const Plugins = require('../../../src/shared/plugins')
|
|
5
4
|
const Inert = require('@hapi/inert')
|
|
6
5
|
const Blipp = require('blipp')
|
|
7
6
|
const Vision = require('@hapi/vision')
|
|
8
7
|
const ErrorHandling = require('@mojaloop/central-services-error-handling')
|
|
8
|
+
const Config = require('../../../src/lib/config')
|
|
9
|
+
const Proxyquire = require('proxyquire')
|
|
10
|
+
const APIDocumentation = require('@mojaloop/central-services-shared').Util.Hapi.APIDocumentation
|
|
11
|
+
let Plugins = require('../../../src/shared/plugins')
|
|
9
12
|
|
|
10
13
|
class Server {
|
|
11
14
|
constructor () {
|
|
@@ -33,5 +36,32 @@ Test('registerPlugins should', pluginsTest => {
|
|
|
33
36
|
modules.forEach(x => test.ok(server.contains(x)))
|
|
34
37
|
test.end()
|
|
35
38
|
})
|
|
39
|
+
|
|
40
|
+
pluginsTest.test('not register API documentation plugin if disabled in config', async function (test) {
|
|
41
|
+
const ConfigStub = { ...Config }
|
|
42
|
+
ConfigStub.API_DOC_ENDPOINTS_ENABLED = false
|
|
43
|
+
|
|
44
|
+
Plugins = Proxyquire('../../../src/shared/plugins', {
|
|
45
|
+
'../lib/config': ConfigStub
|
|
46
|
+
})
|
|
47
|
+
const server = await new Server()
|
|
48
|
+
await Plugins.registerPlugins(server)
|
|
49
|
+
test.ok(!server.contains(APIDocumentation))
|
|
50
|
+
test.end()
|
|
51
|
+
})
|
|
52
|
+
|
|
53
|
+
pluginsTest.test('register API documentation plugin if enabled in config', async function (test) {
|
|
54
|
+
const ConfigStub = { ...Config }
|
|
55
|
+
ConfigStub.API_DOC_ENDPOINTS_ENABLED = true
|
|
56
|
+
|
|
57
|
+
Plugins = Proxyquire('../../../src/shared/plugins', {
|
|
58
|
+
'../lib/config': ConfigStub
|
|
59
|
+
})
|
|
60
|
+
const server = await new Server()
|
|
61
|
+
await Plugins.registerPlugins(server)
|
|
62
|
+
test.ok(server.registrations[0].plugin.plugin.name.includes('apiDocumentation'))
|
|
63
|
+
test.end()
|
|
64
|
+
})
|
|
65
|
+
|
|
36
66
|
pluginsTest.end()
|
|
37
67
|
})
|
|
@@ -17,7 +17,6 @@ Test('setup', setupTest => {
|
|
|
17
17
|
let CacheStub
|
|
18
18
|
let ObjStoreStub
|
|
19
19
|
// let ObjStoreStubThrows
|
|
20
|
-
let SidecarStub
|
|
21
20
|
let MigratorStub
|
|
22
21
|
let RegisterHandlersStub
|
|
23
22
|
let requestLoggerStub
|
|
@@ -25,11 +24,12 @@ Test('setup', setupTest => {
|
|
|
25
24
|
let HapiStub
|
|
26
25
|
let UrlParserStub
|
|
27
26
|
let serverStub
|
|
27
|
+
let processExitStub
|
|
28
28
|
// let KafkaCronStub
|
|
29
29
|
|
|
30
30
|
setupTest.beforeEach(test => {
|
|
31
31
|
sandbox = Sinon.createSandbox()
|
|
32
|
-
|
|
32
|
+
processExitStub = sandbox.stub(process, 'exit')
|
|
33
33
|
PluginsStub = {
|
|
34
34
|
registerPlugins: sandbox.stub().returns(Promise.resolve())
|
|
35
35
|
}
|
|
@@ -58,10 +58,6 @@ Test('setup', setupTest => {
|
|
|
58
58
|
logResponse: sandbox.stub().returns(Promise.resolve())
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
SidecarStub = {
|
|
62
|
-
connect: sandbox.stub().returns(Promise.resolve())
|
|
63
|
-
}
|
|
64
|
-
|
|
65
61
|
DbStub = {
|
|
66
62
|
connect: sandbox.stub().returns(Promise.resolve()),
|
|
67
63
|
disconnect: sandbox.stub().returns(Promise.resolve())
|
|
@@ -73,7 +69,10 @@ Test('setup', setupTest => {
|
|
|
73
69
|
|
|
74
70
|
ObjStoreStub = {
|
|
75
71
|
Db: {
|
|
76
|
-
connect: sandbox.stub().returns(Promise.resolve())
|
|
72
|
+
connect: sandbox.stub().returns(Promise.resolve()),
|
|
73
|
+
Mongoose: {
|
|
74
|
+
set: sandbox.stub()
|
|
75
|
+
}
|
|
77
76
|
}
|
|
78
77
|
}
|
|
79
78
|
// ObjStoreStubThrows = {
|
|
@@ -122,9 +121,8 @@ Test('setup', setupTest => {
|
|
|
122
121
|
'../handlers/register': RegisterHandlersStub,
|
|
123
122
|
'../lib/db': DbStub,
|
|
124
123
|
'../lib/cache': CacheStub,
|
|
125
|
-
'@mojaloop/
|
|
124
|
+
'@mojaloop/object-store-lib': ObjStoreStub,
|
|
126
125
|
'../lib/migrator': MigratorStub,
|
|
127
|
-
'../lib/sidecar': SidecarStub,
|
|
128
126
|
'../lib/requestLogger': requestLoggerStub,
|
|
129
127
|
'./plugins': PluginsStub,
|
|
130
128
|
'../lib/urlParser': UrlParserStub,
|
|
@@ -165,14 +163,14 @@ Test('setup', setupTest => {
|
|
|
165
163
|
'../handlers/register': RegisterHandlersStub,
|
|
166
164
|
'../lib/db': DbStub,
|
|
167
165
|
'../lib/cache': CacheStub,
|
|
168
|
-
'@mojaloop/
|
|
166
|
+
'@mojaloop/object-store-lib': ObjStoreStub,
|
|
169
167
|
'../lib/migrator': MigratorStub,
|
|
170
|
-
'../lib/sidecar': SidecarStub,
|
|
171
168
|
'../lib/requestLogger': requestLoggerStub,
|
|
172
169
|
'./plugins': PluginsStub,
|
|
173
170
|
'../lib/urlParser': UrlParserStub,
|
|
174
171
|
'@hapi/hapi': HapiStubThrowError,
|
|
175
172
|
'../lib/config': Config
|
|
173
|
+
|
|
176
174
|
// '../handlers/lib/kafka': KafkaCronStub
|
|
177
175
|
})
|
|
178
176
|
|
|
@@ -188,13 +186,12 @@ Test('setup', setupTest => {
|
|
|
188
186
|
})
|
|
189
187
|
|
|
190
188
|
setupTest.test('initialize should', async (initializeTest) => {
|
|
191
|
-
initializeTest.test('connect to Database
|
|
189
|
+
initializeTest.test('connect to Database & ObjStore', async (test) => {
|
|
192
190
|
const service = 'api'
|
|
193
191
|
|
|
194
192
|
Setup.initialize({ service }).then(s => {
|
|
195
193
|
test.ok(DbStub.connect.calledWith(Config.DATABASE))
|
|
196
194
|
test.ok(ObjStoreStub.Db.connect.calledWith(mongoDbUri))
|
|
197
|
-
test.ok(SidecarStub.connect.calledWith(service))
|
|
198
195
|
test.ok(CacheStub.initCache.called)
|
|
199
196
|
test.notOk(MigratorStub.migrate.called)
|
|
200
197
|
test.equal(s, serverStub)
|
|
@@ -205,7 +202,7 @@ Test('setup', setupTest => {
|
|
|
205
202
|
})
|
|
206
203
|
})
|
|
207
204
|
|
|
208
|
-
initializeTest.test('connect to Database
|
|
205
|
+
initializeTest.test('connect to Database, but NOT too ObjStore', async (test) => {
|
|
209
206
|
const ConfigStub = Config
|
|
210
207
|
ConfigStub.MONGODB_DISABLED = true
|
|
211
208
|
|
|
@@ -216,21 +213,18 @@ Test('setup', setupTest => {
|
|
|
216
213
|
'../handlers/register': RegisterHandlersStub,
|
|
217
214
|
'../lib/db': DbStub,
|
|
218
215
|
'../lib/cache': CacheStub,
|
|
219
|
-
'@mojaloop/
|
|
216
|
+
'@mojaloop/object-store-lib': ObjStoreStub,
|
|
220
217
|
'../lib/migrator': MigratorStub,
|
|
221
|
-
'../lib/sidecar': SidecarStub,
|
|
222
218
|
'../lib/requestLogger': requestLoggerStub,
|
|
223
219
|
'./plugins': PluginsStub,
|
|
224
220
|
'../lib/urlParser': UrlParserStub,
|
|
225
221
|
'@hapi/hapi': HapiStub,
|
|
226
222
|
'../lib/config': ConfigStub
|
|
227
|
-
// '../handlers/lib/kafka': KafkaCronStub
|
|
228
223
|
})
|
|
229
224
|
|
|
230
225
|
Setup.initialize({ service }).then(s => {
|
|
231
226
|
test.ok(DbStub.connect.calledWith(Config.DATABASE))
|
|
232
227
|
test.notOk(ObjStoreStub.Db.connect.called)
|
|
233
|
-
test.ok(SidecarStub.connect.calledWith(service))
|
|
234
228
|
test.notOk(MigratorStub.migrate.called)
|
|
235
229
|
test.equal(s, serverStub)
|
|
236
230
|
test.end()
|
|
@@ -285,17 +279,17 @@ Test('setup', setupTest => {
|
|
|
285
279
|
})
|
|
286
280
|
})
|
|
287
281
|
|
|
288
|
-
initializeTest.test('
|
|
282
|
+
initializeTest.test('exit the process when service is "undefined"', async (test) => {
|
|
289
283
|
const service = 'undefined'
|
|
290
284
|
|
|
291
285
|
Setup.initialize({ service }).then(s => {
|
|
292
286
|
test.ok(DbStub.connect.calledWith(Config.DATABASE))
|
|
293
287
|
test.ok(ObjStoreStub.Db.connect.calledWith(mongoDbUri))
|
|
294
288
|
test.notOk(MigratorStub.migrate.called)
|
|
295
|
-
test.
|
|
289
|
+
test.ok(processExitStub.called)
|
|
296
290
|
test.end()
|
|
297
291
|
}).catch(err => {
|
|
298
|
-
test.
|
|
292
|
+
test.fail(`Should have exited the process: ${err.message}`)
|
|
299
293
|
test.end()
|
|
300
294
|
})
|
|
301
295
|
})
|
|
@@ -333,9 +327,8 @@ Test('setup', setupTest => {
|
|
|
333
327
|
'../handlers/register': RegisterHandlersStub,
|
|
334
328
|
'../lib/db': DbStub,
|
|
335
329
|
'../lib/cache': CacheStub,
|
|
336
|
-
'@mojaloop/
|
|
330
|
+
'@mojaloop/object-store-lib': ObjStoreStub,
|
|
337
331
|
'../lib/migrator': MigratorStub,
|
|
338
|
-
'../lib/sidecar': SidecarStub,
|
|
339
332
|
'../lib/requestLogger': requestLoggerStub,
|
|
340
333
|
'./plugins': PluginsStub,
|
|
341
334
|
'../lib/urlParser': UrlParserStub,
|
|
@@ -365,9 +358,8 @@ Test('setup', setupTest => {
|
|
|
365
358
|
'../handlers/register': RegisterHandlersStub,
|
|
366
359
|
'../lib/db': DbStub,
|
|
367
360
|
'../lib/cache': CacheStub,
|
|
368
|
-
'@mojaloop/
|
|
361
|
+
'@mojaloop/object-store-lib': ObjStoreStub,
|
|
369
362
|
'../lib/migrator': MigratorStub,
|
|
370
|
-
'../lib/sidecar': SidecarStub,
|
|
371
363
|
'../lib/requestLogger': requestLoggerStub,
|
|
372
364
|
'./plugins': PluginsStub,
|
|
373
365
|
'../lib/urlParser': UrlParserStub,
|
|
@@ -398,9 +390,8 @@ Test('setup', setupTest => {
|
|
|
398
390
|
'../handlers/register': RegisterHandlersStub,
|
|
399
391
|
'../lib/db': DbStub,
|
|
400
392
|
'../lib/cache': CacheStub,
|
|
401
|
-
'@mojaloop/
|
|
393
|
+
'@mojaloop/object-store-lib': ObjStoreStub,
|
|
402
394
|
'../lib/migrator': MigratorStub,
|
|
403
|
-
'../lib/sidecar': SidecarStub,
|
|
404
395
|
'../lib/requestLogger': requestLoggerStub,
|
|
405
396
|
'./plugins': PluginsStub,
|
|
406
397
|
'../lib/urlParser': UrlParserStub,
|
|
@@ -433,9 +424,8 @@ Test('setup', setupTest => {
|
|
|
433
424
|
'../handlers/register': RegisterHandlersStub,
|
|
434
425
|
'../lib/db': DbStub,
|
|
435
426
|
'../lib/cache': CacheStub,
|
|
436
|
-
'@mojaloop/
|
|
427
|
+
'@mojaloop/object-store-lib': ObjStoreStub,
|
|
437
428
|
'../lib/migrator': MigratorStub,
|
|
438
|
-
'../lib/sidecar': SidecarStub,
|
|
439
429
|
'../lib/requestLogger': requestLoggerStub,
|
|
440
430
|
'./plugins': PluginsStub,
|
|
441
431
|
'../lib/urlParser': UrlParserStub,
|
|
@@ -530,10 +520,6 @@ Test('setup', setupTest => {
|
|
|
530
520
|
]
|
|
531
521
|
|
|
532
522
|
Setup.initialize({ service, runHandlers: true, handlers: modulesList }).then(() => {
|
|
533
|
-
test.fail('Expected exception to be thrown')
|
|
534
|
-
test.end()
|
|
535
|
-
}).catch(err => {
|
|
536
|
-
console.log(err)
|
|
537
523
|
test.ok(RegisterHandlersStub.transfers.registerPrepareHandler.called)
|
|
538
524
|
test.ok(RegisterHandlersStub.transfers.registerFulfilHandler.called)
|
|
539
525
|
test.ok(RegisterHandlersStub.positions.registerPositionHandler.called)
|
|
@@ -543,7 +529,10 @@ Test('setup', setupTest => {
|
|
|
543
529
|
test.ok(RegisterHandlersStub.bulk.registerBulkPrepareHandler.called)
|
|
544
530
|
test.ok(RegisterHandlersStub.bulk.registerBulkFulfilHandler.called)
|
|
545
531
|
test.ok(RegisterHandlersStub.bulk.registerBulkProcessingHandler.called)
|
|
546
|
-
test.ok(
|
|
532
|
+
test.ok(processExitStub.called)
|
|
533
|
+
test.end()
|
|
534
|
+
}).catch(err => {
|
|
535
|
+
test.fail(`should have exited the process ${err}`)
|
|
547
536
|
test.end()
|
|
548
537
|
})
|
|
549
538
|
})
|
|
@@ -667,14 +656,14 @@ Test('setup', setupTest => {
|
|
|
667
656
|
'../handlers/register': RegisterHandlersStub,
|
|
668
657
|
'../lib/db': DbStub,
|
|
669
658
|
'../lib/cache': CacheStub,
|
|
670
|
-
'@mojaloop/
|
|
659
|
+
'@mojaloop/object-store-lib': ObjStoreStub,
|
|
671
660
|
'../lib/migrator': MigratorStub,
|
|
672
|
-
'../lib/sidecar': SidecarStub,
|
|
673
661
|
'../lib/requestLogger': requestLoggerStub,
|
|
674
662
|
'./plugins': PluginsStub,
|
|
675
663
|
'../lib/urlParser': UrlParserStub,
|
|
676
664
|
'@hapi/hapi': HapiStub,
|
|
677
665
|
'../lib/config': Config
|
|
666
|
+
|
|
678
667
|
// '../handlers/lib/kafka': KafkaCronStub
|
|
679
668
|
})
|
|
680
669
|
|
package/test/util/helpers.js
CHANGED
|
@@ -128,16 +128,51 @@ async function waitFor (func, name, retries = 5, increment = 2) {
|
|
|
128
128
|
await func()
|
|
129
129
|
return Promise.resolve(true)
|
|
130
130
|
} catch (err) {
|
|
131
|
-
Logger.
|
|
131
|
+
Logger.warn(`waitFor: '${name}' failed. Sleeping for: ${curr} seconds.`)
|
|
132
132
|
}
|
|
133
133
|
|
|
134
134
|
return sleepPromise(curr).then(() => false)
|
|
135
135
|
}, Promise.resolve(false))
|
|
136
136
|
}
|
|
137
137
|
|
|
138
|
+
async function wrapWithRetries (func, remainingRetries = 10, timeout = 4) {
|
|
139
|
+
Logger.warn(`wrapWithRetries remainingRetries:${remainingRetries}, timeout:${timeout}`)
|
|
140
|
+
|
|
141
|
+
try {
|
|
142
|
+
const result = await func()
|
|
143
|
+
if (!result) {
|
|
144
|
+
throw new Error('wrapWithRetries returned false of undefined response')
|
|
145
|
+
}
|
|
146
|
+
return result
|
|
147
|
+
} catch (err) {
|
|
148
|
+
if (remainingRetries === 0) {
|
|
149
|
+
Logger.warn('wrapWithRetries ran out of retries')
|
|
150
|
+
throw err
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
await sleepPromise(2)
|
|
154
|
+
return wrapWithRetries(func, remainingRetries - 1, timeout)
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
function currentEventLoopEnd () {
|
|
159
|
+
return new Promise(resolve => setImmediate(resolve))
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
function getMessagePayloadOrThrow (message) {
|
|
163
|
+
try {
|
|
164
|
+
return message.value.content.payload
|
|
165
|
+
} catch (err) {
|
|
166
|
+
throw new Error('unwrapMessagePayloadOrThrow - malformed message')
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
138
170
|
module.exports = {
|
|
171
|
+
currentEventLoopEnd,
|
|
139
172
|
createRequest,
|
|
140
173
|
sleepPromise,
|
|
141
174
|
unwrapResponse,
|
|
142
|
-
waitFor
|
|
175
|
+
waitFor,
|
|
176
|
+
wrapWithRetries,
|
|
177
|
+
getMessagePayloadOrThrow
|
|
143
178
|
}
|
package/test/util/scripts/env.sh
CHANGED
|
@@ -1,22 +1,23 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
|
-
export KAFKA_ID=
|
|
2
|
+
export KAFKA_ID=cl_kafka
|
|
3
3
|
export MOCKSERVER_ID=mockserver
|
|
4
|
+
export MOCKSERVER_HOST=mockserver
|
|
5
|
+
export MOCKSERVER_PORT=1080
|
|
4
6
|
export MOCK_SIM_PORT=8444
|
|
5
|
-
export DB_ID=
|
|
7
|
+
export DB_ID=cl_mysql
|
|
6
8
|
export DBUSER=central_ledger
|
|
7
9
|
export DBPASS=password
|
|
8
10
|
export DBNAME=central_ledger
|
|
9
11
|
export DB_SLEEPTIME=15
|
|
10
|
-
export OBJ_ID=
|
|
12
|
+
export OBJ_ID=cl_objstore
|
|
11
13
|
export SLEEP_FACTOR_IN_SECONDS=5
|
|
12
14
|
export MESSAGES_BATCH_SIZE=1000
|
|
13
15
|
export SCRIPT_DIR=scripts
|
|
14
|
-
export FSPList=("dfsp1" "dfsp2" "payerfsp" "payeefsp")
|
|
16
|
+
export FSPList=("dfsp1" "dfsp2" "payerfsp" "payeefsp" "noresponsepayeefsp")
|
|
15
17
|
export DEFAULT_NET_DEBIT_CAP=1000
|
|
16
18
|
export CENTRAL_LEDGER_ADMIN_URI_PREFIX=http
|
|
17
19
|
export CENTRAL_LEDGER_ADMIN_HOST=localhost
|
|
18
20
|
export CENTRAL_LEDGER_ADMIN_PORT=3001
|
|
19
21
|
export CENTRAL_LEDGER_ADMIN_BASE=/
|
|
20
22
|
export CLEDG_DATABASE_URI=mysql://$DBUSER:$DBPASS@localhost:3306/central_ledger
|
|
21
|
-
export CLEDG_SIDECAR__DISABLED=true
|
|
22
23
|
export LOG_LEVEL=info
|