From 978ab2004449eabc1086c44d47803b57714ee99c Mon Sep 17 00:00:00 2001 From: Steven Oderayi Date: Thu, 23 Nov 2023 12:24:32 +0100 Subject: [PATCH 01/16] fix: bump delay for Fulfil Reserved 1.0 GET request from 16seconds to 24seconds --- .../transfer_negative_scenarios/fulfil-reserved-v1.0.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/collections/hub/golden_path/feature_tests/transfer_negative_scenarios/fulfil-reserved-v1.0.json b/collections/hub/golden_path/feature_tests/transfer_negative_scenarios/fulfil-reserved-v1.0.json index d2f5d25c..9cb5e913 100644 --- a/collections/hub/golden_path/feature_tests/transfer_negative_scenarios/fulfil-reserved-v1.0.json +++ b/collections/hub/golden_path/feature_tests/transfer_negative_scenarios/fulfil-reserved-v1.0.json @@ -456,7 +456,7 @@ "Content-Type": "{$inputs.contentTypeTransfers}" }, "scriptingEngine": "javascript", - "delay": "16000", + "delay": "24000", "tests": { "assertions": [ { From 2ab5a3ed1e2c37ca46eb3b19172c010bb6a22bc0 Mon Sep 17 00:00:00 2001 From: Steven Oderayi Date: Thu, 23 Nov 2023 18:14:24 +0100 Subject: [PATCH 02/16] fix: add delays for bulk tests --- .../other_tests/bulk_transfers/bulk-invalid-timestamp.json | 6 ++++-- .../bulk_transfers/bulk-transfer-timeout-scenario.json | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/collections/hub/other_tests/bulk_transfers/bulk-invalid-timestamp.json b/collections/hub/other_tests/bulk_transfers/bulk-invalid-timestamp.json index c0366396..586fad1f 100644 --- a/collections/hub/other_tests/bulk_transfers/bulk-invalid-timestamp.json +++ b/collections/hub/other_tests/bulk_transfers/bulk-invalid-timestamp.json @@ -438,7 +438,8 @@ ] } ] - } + }, + "delay": "10000" }, { "id": 8, @@ -475,7 +476,8 @@ ] } ] - } + }, + "delay": "10000" } ] } diff --git a/collections/hub/other_tests/bulk_transfers/bulk-transfer-timeout-scenario.json b/collections/hub/other_tests/bulk_transfers/bulk-transfer-timeout-scenario.json index d293536b..33808015 100644 --- a/collections/hub/other_tests/bulk_transfers/bulk-transfer-timeout-scenario.json +++ b/collections/hub/other_tests/bulk_transfers/bulk-transfer-timeout-scenario.json @@ -312,7 +312,8 @@ ] } ] - } + }, + "delay": "10000" }, { "id": 8, From 209de4ceb8d419795356d39c38219848a160bea7 Mon Sep 17 00:00:00 2001 From: Steven Oderayi Date: Mon, 27 Nov 2023 11:22:25 +0100 Subject: [PATCH 03/16] fix: Add retry logic to tests failing due to timing. Add delays to async tests not supporting retry --- .../fulfil-reserved-v1.0.json | 71 ++++++++++- collections/hub/master.json | 4 + .../bulk-invalid-timestamp.json | 120 ++++++++++++++++-- .../bulk-transfer-timeout-scenario.json | 106 ++++++++++++++-- .../adjust-participants-limits.json | 52 +++++++- .../hub/provisioning_dfsp/newdfsp.json | 6 +- .../hub/provisioning_thirdparty/README.md | 13 -- .../bulk/basic/bulk-happy-path.json | 10 +- .../bulk/basic/bulk-high-volume_dynamic.json | 5 +- .../bulk/basic/bulk-parties-error-cases.json | 30 +---- .../bulk/basic/bulk-quotes-error-cases.json | 35 +---- .../bulk/basic/bulk-sdk-warm-up.json | 10 +- .../basic/bulk-transfers-error-cases.json | 20 +-- 13 files changed, 350 insertions(+), 132 deletions(-) delete mode 100644 collections/hub/provisioning_thirdparty/README.md diff --git a/collections/hub/golden_path/feature_tests/transfer_negative_scenarios/fulfil-reserved-v1.0.json b/collections/hub/golden_path/feature_tests/transfer_negative_scenarios/fulfil-reserved-v1.0.json index 9cb5e913..cc72988d 100644 --- a/collections/hub/golden_path/feature_tests/transfer_negative_scenarios/fulfil-reserved-v1.0.json +++ b/collections/hub/golden_path/feature_tests/transfer_negative_scenarios/fulfil-reserved-v1.0.json @@ -106,7 +106,8 @@ "console.log(requestVariables.payeePostQuotes)" ] } - } + }, + "disabled": false }, { "id": 2, @@ -183,7 +184,8 @@ "console.log(requestVariables.payerPutQuotes)" ] } - } + }, + "disabled": false }, { "id": 3, @@ -253,7 +255,8 @@ "console.log(requestVariables.payeePostTransfer)" ] } - } + }, + "disabled": false }, { "id": 4, @@ -309,7 +312,8 @@ "" ] } - } + }, + "disabled": false }, { "id": 5, @@ -427,7 +431,8 @@ "// console.log(environment.newDateString)" ] } - } + }, + "disabled": false }, { "id": 6, @@ -455,8 +460,8 @@ "Authorization": "{$inputs.TTK_BEARER_TOKEN}", "Content-Type": "{$inputs.contentTypeTransfers}" }, + "delay": "15000", "scriptingEngine": "javascript", - "delay": "24000", "tests": { "assertions": [ { @@ -561,6 +566,60 @@ "exec": [ "" ] + }, + "postRequest": { + "exec": [ + "// const expectedTransferState = 'ABORTED'", + "", + "// // lets get retry config", + "// const maxRetryCount = Number.parseFloat(environment.RETRY_MAX_ATTEMPTS) || 20", + "// const maxRetryWait = Number.parseFloat(environment.RETRY_MAX_WAIT_IN_MS) || 250", + "", + "// async function main() {", + "// let jsonData = callback.body", + "", + "// for (let retryCount = 0 ; retryCount < maxRetryCount; retryCount++) {", + "// console.log(`retry-count=${retryCount+1}, max-count=${maxRetryCount}, max-wait=${maxRetryWait}`)", + " ", + "// const isOk = jsonData.transferState === expectedTransferState;", + " ", + "// if (isOk) {", + "// console.log(`Everything is OK, let's continue`)", + "// break;", + "// } else {", + "// console.log(`Everything is NOT OK, let's wait for ${maxRetryWait}ms, and try again...`)", + "// await custom.sleep(maxRetryWait);", + "// jsonData = (await makeRequest()).data", + "// console.log('jsonData: ', jsonData)", + "// }", + "// }", + "// }", + "", + "// async function makeRequest() {", + "// const reqParams = {", + "// method: 'get', ", + "// url: `{$inputs.HOST_ML_API_ADAPTER}/transfers/{$prev.3.request.body.transferId}`,", + "// headers: {", + "// 'Content-Type': `{$inputs.contentTypeTransfers}`,", + "// Accept: `{$inputs.acceptTransfers}`,", + "// Date: `{$function.generic.curDate}`,", + "// 'FSPIOP-Source': `{$inputs.fromFspId}`,", + "// Authorization: `{$inputs.TTK_BEARER_TOKEN}`", + "// }", + "// };", + " ", + "// /*", + "// const reqParams = {", + "// method: 'get',", + "// url: `{$environment.PAYERFSP_SDK_TESTAPI_URL}/callbacks/{$prev.3.request.body.transferId}`", + "// }", + "// */", + " ", + "// return axios.get(reqParams);", + "// }", + "", + "// await main()" + ] } } } diff --git a/collections/hub/master.json b/collections/hub/master.json index 08f9a68a..2c806858 100644 --- a/collections/hub/master.json +++ b/collections/hub/master.json @@ -35,6 +35,10 @@ { "name": "thirdparty", "type": "folder" + }, + { + "name": "provisioning_dfsp", + "type": "folder" } ] } \ No newline at end of file diff --git a/collections/hub/other_tests/bulk_transfers/bulk-invalid-timestamp.json b/collections/hub/other_tests/bulk_transfers/bulk-invalid-timestamp.json index 586fad1f..9b39dd45 100644 --- a/collections/hub/other_tests/bulk_transfers/bulk-invalid-timestamp.json +++ b/collections/hub/other_tests/bulk_transfers/bulk-invalid-timestamp.json @@ -47,7 +47,8 @@ "environment[\"payerfspPositionBeforePrepare\"] = response.body[0].value" ] } - } + }, + "disabled": false }, { "id": 2, @@ -85,7 +86,8 @@ "environment[\"payeefspPositionBeforePrepare\"] = response.body[0].value" ] } - } + }, + "disabled": false }, { "id": 3, @@ -184,7 +186,8 @@ "" ] } - } + }, + "disabled": false }, { "id": 4, @@ -228,7 +231,8 @@ "" ] } - } + }, + "disabled": false }, { "id": 9, @@ -303,7 +307,8 @@ "" ] } - } + }, + "disabled": false }, { "id": 6, @@ -400,7 +405,8 @@ "" ] } - } + }, + "disabled": false }, { "id": 7, @@ -427,19 +433,64 @@ "id": 1, "description": "Status code is 200", "exec": [ - "expect(response.status).to.equal(200)" + "expect(environment.participantsPositionResponse.code).to.equal(200)" ] }, { "id": 2, "description": "Payerfsp position after Payer ABORT should be same as position before prepare.", "exec": [ - "expect(response.body[0].value).to.equal(+environment.payerfspPositionBeforePrepare)" + "expect(environment.participantsPositionResponse.body[0].value).to.equal(+environment.payerfspPositionBeforePrepare)" ] } ] }, - "delay": "10000" + "scriptingEngine": "javascript", + "scripts": { + "postRequest": { + "exec": [ + "const expectedStatusCode = 200;", + "environment.participantsPositionResponse = null", + "", + "// lets get retry config", + "const maxRetryCount = Number.parseFloat(environment.RETRY_MAX_ATTEMPTS) || 20", + "const maxRetryWait = Number.parseFloat(environment.RETRY_MAX_WAIT_IN_MS) || 250", + "", + "async function main() {", + " let _response = response", + "", + " for (let retryCount = 0 ; retryCount < maxRetryCount; retryCount++) {", + " console.log(`retry-count=${retryCount+1}, max-count=${maxRetryCount}, max-wait=${maxRetryWait}`)", + " ", + " const isOk = _response.code === expectedStatusCode;", + " ", + " if (isOk) {", + " environment.participantsPositionResponse = _response", + " console.log(`Everything is OK, let's continue`)", + " break;", + " } else {", + " console.log(`Everything is NOT OK, let's wait for ${maxRetryWait}ms, and try again...`)", + " await custom.sleep(maxRetryWait);", + " const axiosRes = await makeRequest()", + " _response = { body: axiosRes.data, code: axiosRes.status }", + " }", + " }", + "}", + "", + "function makeRequest() {", + " const reqParams = {", + " method: 'get', ", + " url: `{$inputs.HOST_CENTRAL_LEDGER}/participants/{$inputs.fromFspId}/positions`", + " };", + " ", + " return axios(reqParams);", + "}", + "", + "await main()" + ] + } + }, + "disabled": false }, { "id": 8, @@ -465,19 +516,64 @@ "id": 1, "description": "Status code is 200", "exec": [ - "expect(response.status).to.equal(200)" + "expect(environment.participantsPositionResponse.code).to.equal(200)" ] }, { "id": 2, "description": "Payeefsp position after Payee ABORT should be same as position before prepare.", "exec": [ - "expect(response.body[0].value).to.equal(+environment.payeefspPositionBeforePrepare)" + "expect(environment.participantsPositionResponse.body[0].value).to.equal(+environment.payeefspPositionBeforePrepare)" ] } ] }, - "delay": "10000" + "scriptingEngine": "javascript", + "disabled": false, + "scripts": { + "postRequest": { + "exec": [ + "const expectedStatusCode = 200;", + "environment.participantsPositionResponse = null", + "", + "// lets get retry config", + "const maxRetryCount = Number.parseFloat(environment.RETRY_MAX_ATTEMPTS) || 20", + "const maxRetryWait = Number.parseFloat(environment.RETRY_MAX_WAIT_IN_MS) || 250", + "", + "async function main() {", + " let _response = response", + "", + " for (let retryCount = 0 ; retryCount < maxRetryCount; retryCount++) {", + " console.log(`retry-count=${retryCount+1}, max-count=${maxRetryCount}, max-wait=${maxRetryWait}`)", + " ", + " const isOk = _response.code === expectedStatusCode;", + " ", + " if (isOk) {", + " environment.participantsPositionResponse = _response", + " console.log(`Everything is OK, let's continue`)", + " break;", + " } else {", + " console.log(`Everything is NOT OK, let's wait for ${maxRetryWait}ms, and try again...`)", + " await custom.sleep(maxRetryWait);", + " const axiosRes = await makeRequest()", + " _response = { body: axiosRes.data, code: axiosRes.status }", + " }", + " }", + "}", + "", + "function makeRequest() {", + " const reqParams = {", + " method: 'get', ", + " url: `{$inputs.HOST_CENTRAL_LEDGER}/participants/{$inputs.NORESPONSE_NAME}/positions`", + " };", + " ", + " return axios(reqParams);", + "}", + "", + "await main()" + ] + } + } } ] } diff --git a/collections/hub/other_tests/bulk_transfers/bulk-transfer-timeout-scenario.json b/collections/hub/other_tests/bulk_transfers/bulk-transfer-timeout-scenario.json index 33808015..86cd72a7 100644 --- a/collections/hub/other_tests/bulk_transfers/bulk-transfer-timeout-scenario.json +++ b/collections/hub/other_tests/bulk_transfers/bulk-transfer-timeout-scenario.json @@ -265,8 +265,8 @@ "scripts": { "postRequest": { "exec": [ - "var jsonData = pm.response.body;", - "pm.environment.set(\"payerfspPositionAfterPrepare\", jsonData[0].value)" + "var jsonData = response.body", + "environment.payerfspPositionAfterPrepare = jsonData[0].value" ] }, "preRequest": { @@ -274,7 +274,8 @@ "" ] } - } + }, + "scriptingEngine": "javascript" }, { "id": 7, @@ -301,19 +302,63 @@ "id": 1, "description": "Status code is 200", "exec": [ - "expect(response.status).to.equal(200)" + "expect(environment.participantsPositionResponse.code).to.equal(200)" ] }, { "id": 2, "description": "Payerfsp position after (bulk) timeout should be same as position before prepare.", "exec": [ - "expect(response.body[0].value).to.equal(+environment.payerfspPositionBeforePrepare)" + "expect(environment.participantsPositionResponse.body[0].value).to.equal(+environment.payerfspPositionBeforePrepare)" ] } ] }, - "delay": "10000" + "scripts": { + "postRequest": { + "exec": [ + " const expectedStatusCode = 200;", + " environment.participantsPositionResponse = null", + " ", + " // lets get retry config", + " const maxRetryCount = Number.parseFloat(environment.RETRY_MAX_ATTEMPTS) || 20", + " const maxRetryWait = Number.parseFloat(environment.RETRY_MAX_WAIT_IN_MS) || 250", + " ", + " async function main() {", + " let _response = response", + " ", + " for (let retryCount = 0 ; retryCount < maxRetryCount; retryCount++) {", + " console.log(`retry-count=${retryCount+1}, max-count=${maxRetryCount}, max-wait=${maxRetryWait}`)", + " ", + " const isOk = _response.code === expectedStatusCode && _response.body[0].value === (+environment.payerfspPositionBeforePrepare)", + " ", + " if (isOk) {", + " environment.participantsPositionResponse = _response", + " console.log(`Everything is OK, let's continue`)", + " break;", + " } else {", + " console.log(`Everything is NOT OK, let's wait for ${maxRetryWait}ms, and try again...`)", + " await custom.sleep(maxRetryWait);", + " const axiosRes = await makeRequest()", + " _response = { body: axiosRes.data, code: axiosRes.status }", + " }", + " }", + " }", + " ", + " function makeRequest() {", + " const reqParams = {", + " method: 'get', ", + " url: `{$inputs.HOST_CENTRAL_LEDGER}/participants/{$inputs.fromFspId}/positions`", + " };", + " ", + " return axios(reqParams);", + " }", + " ", + " await main()" + ] + } + }, + "scriptingEngine": "javascript" }, { "id": 8, @@ -339,17 +384,62 @@ "id": 1, "description": "Status code is 200", "exec": [ - "expect(response.status).to.equal(200)" + "expect(environment.participantsPositionResponse.code).to.equal(200)" ] }, { "id": 2, "description": "Payeefsp position after timeout should be same as position before prepare.", "exec": [ - "expect(response.body[0].value).to.equal(+environment.payeefspPositionBeforePrepare)" + "expect(environment.participantsPositionResponse.body[0].value).to.equal(+environment.payeefspPositionBeforePrepare)" ] } ] + }, + "scriptingEngine": "javascript", + "scripts": { + "postRequest": { + "exec": [ + " const expectedStatusCode = 200;", + " environment.participantsPositionResponse = null", + " ", + " // lets get retry config", + " const maxRetryCount = Number.parseFloat(environment.RETRY_MAX_ATTEMPTS) || 20", + " const maxRetryWait = Number.parseFloat(environment.RETRY_MAX_WAIT_IN_MS) || 250", + " ", + " async function main() {", + " let _response = response", + " ", + " for (let retryCount = 0 ; retryCount < maxRetryCount; retryCount++) {", + " console.log(`retry-count=${retryCount+1}, max-count=${maxRetryCount}, max-wait=${maxRetryWait}`)", + " ", + " const isOk = _response.code === expectedStatusCode && _response.body[0].value === (+environment.payeefspPositionBeforePrepare)", + " ", + " if (isOk) {", + " environment.participantsPositionResponse = _response", + " console.log(`Everything is OK, let's continue`)", + " break;", + " } else {", + " console.log(`Everything is NOT OK, let's wait for ${maxRetryWait}ms, and try again...`)", + " await custom.sleep(maxRetryWait);", + " const axiosRes = await makeRequest()", + " _response = { body: axiosRes.data, code: axiosRes.status }", + " }", + " }", + " }", + " ", + " function makeRequest() {", + " const reqParams = {", + " method: 'get', ", + " url: `{$inputs.HOST_CENTRAL_LEDGER}/participants/{$inputs.NORESPONSE_NAME}/positions`", + " };", + " ", + " return axios(reqParams);", + " }", + " ", + " await main()" + ] + } } } ] diff --git a/collections/hub/provisioning/CGS_Specific/adjust-participants-limits.json b/collections/hub/provisioning/CGS_Specific/adjust-participants-limits.json index b4d3ac76..75606f6b 100644 --- a/collections/hub/provisioning/CGS_Specific/adjust-participants-limits.json +++ b/collections/hub/provisioning/CGS_Specific/adjust-participants-limits.json @@ -32,12 +32,60 @@ "id": 1, "description": "response code 200", "exec": [ - "expect(response.status).to.equal(200)" + "const statusCode = environment.participantLimitsResponseCode", + "expect(statusCode).to.equal(200)" ] } ] }, - "delay": "{$inputs.DELAY_CGS}" + "delay": "{$inputs.DELAY_CGS}", + "scriptingEngine": "javascript", + "scripts": { + "postRequest": { + "exec": [ + "const expectedStatusCode = 200;", + "environment.participantLimitsResponseCode = null", + "", + "// lets get retry config", + "const maxRetryCount = Number.parseFloat(environment.RETRY_MAX_ATTEMPTS) || 20", + "const maxRetryWait = Number.parseFloat(environment.RETRY_MAX_WAIT_IN_MS) || 250", + "", + "async function main() {", + " let statusCode = response.code", + "", + " for (let retryCount = 0 ; retryCount < maxRetryCount; retryCount++) {", + " console.log(`retry-count=${retryCount+1}, max-count=${maxRetryCount}, max-wait=${maxRetryWait}`)", + " ", + " const isOk = statusCode === expectedStatusCode;", + " ", + " if (isOk) {", + " environment.participantLimitsResponseCode = statusCode", + " console.log(`Everything is OK, let's continue`)", + " break;", + " } else {", + " console.log(`Everything is NOT OK, let's wait for ${maxRetryWait}ms, and try again...`)", + " await custom.sleep(maxRetryWait);", + " statusCode = (await makeRequest()).status", + " }", + " }", + "}", + "", + "function makeRequest() {", + " const reqParams = {", + " method: 'get', ", + " url: `{$inputs.HOST_CENTRAL_LEDGER}/participants/limits`,", + " headers: {", + " 'Content-Type': 'application/json',", + " }", + " };", + " ", + " return axios.get(reqParams);", + "}", + "", + "await main()" + ] + } + } }, { "id": 2, diff --git a/collections/hub/provisioning_dfsp/newdfsp.json b/collections/hub/provisioning_dfsp/newdfsp.json index d6eddb68..ed95901f 100644 --- a/collections/hub/provisioning_dfsp/newdfsp.json +++ b/collections/hub/provisioning_dfsp/newdfsp.json @@ -260,7 +260,7 @@ } ], "fileInfo": { - "path": "provisioning_dfsp/newdfsp.json" + "path": "hub/provisioning_dfsp/newdfsp.json" } }, { @@ -1094,7 +1094,7 @@ } ], "fileInfo": { - "path": "provisioning_dfsp/newdfsp.json" + "path": "hub/provisioning_dfsp/newdfsp.json" } }, { @@ -1220,7 +1220,7 @@ } ], "fileInfo": { - "path": "provisioning_dfsp/newdfsp.json" + "path": "hub/provisioning_dfsp/newdfsp.json" } } ] diff --git a/collections/hub/provisioning_thirdparty/README.md b/collections/hub/provisioning_thirdparty/README.md deleted file mode 100644 index bdf154cc..00000000 --- a/collections/hub/provisioning_thirdparty/README.md +++ /dev/null @@ -1,13 +0,0 @@ -# provisioning_thirdparty - -This collection configures the following participants: - -- `pispa` - a Payment Initiation Service Provider (PISP) -- `dfspa` - a DFSP that supports PISP account linking -- `dfpsb` - an ordinary DFSP that does not support account linking - -And the following parties: - -- dfpspa: `MSISDN/589408120` - Paolo Fernandez -- dfpspb: `MSISDN/329294234` - Daniel Rizal -- dfpspb: `MSISDN/32929124` - Alejandro Leon \ No newline at end of file diff --git a/collections/hub/sdk_scheme_adapter/bulk/basic/bulk-happy-path.json b/collections/hub/sdk_scheme_adapter/bulk/basic/bulk-happy-path.json index 1f93f7fa..ec3ec55e 100644 --- a/collections/hub/sdk_scheme_adapter/bulk/basic/bulk-happy-path.json +++ b/collections/hub/sdk_scheme_adapter/bulk/basic/bulk-happy-path.json @@ -5,10 +5,7 @@ "id": 1, "name": "TC-BHP1. When there are 4 transfers in the bulk request 2 of which that have the same receiver fsp id and the others has a different receiver fsp id and acceptParty is true for all the transfers, Then the PUT response should have details of all the 4 transfers.", "fileInfo": { - "path": "hub/sdk_scheme_adapter/bulk/basic/bulk-happy-path.json", - "labels": [ - "basic" - ] + "path": "hub/sdk_scheme_adapter/bulk/basic/bulk-happy-path.json" }, "requests": [ { @@ -596,10 +593,7 @@ "id": 2, "name": "TC-BHP3. When the incoming request has a format issue that fails schema validation, Then the return code should be 400 instead of 202", "fileInfo": { - "path": "hub/sdk_scheme_adapter/bulk/basic/bulk-happy-path.json", - "labels": [ - "basic" - ] + "path": "hub/sdk_scheme_adapter/bulk/basic/bulk-happy-path.json" }, "requests": [ { diff --git a/collections/hub/sdk_scheme_adapter/bulk/basic/bulk-high-volume_dynamic.json b/collections/hub/sdk_scheme_adapter/bulk/basic/bulk-high-volume_dynamic.json index 46c3e048..459ff935 100644 --- a/collections/hub/sdk_scheme_adapter/bulk/basic/bulk-high-volume_dynamic.json +++ b/collections/hub/sdk_scheme_adapter/bulk/basic/bulk-high-volume_dynamic.json @@ -405,10 +405,7 @@ } ], "fileInfo": { - "path": "hub/sdk_scheme_adapter/bulk/basic/bulk-high-volume_dynamic.json", - "labels": [ - "basic" - ] + "path": "hub/sdk_scheme_adapter/bulk/basic/bulk-high-volume_dynamic.json" } } ] diff --git a/collections/hub/sdk_scheme_adapter/bulk/basic/bulk-parties-error-cases.json b/collections/hub/sdk_scheme_adapter/bulk/basic/bulk-parties-error-cases.json index 6e5eafa1..f73e416f 100644 --- a/collections/hub/sdk_scheme_adapter/bulk/basic/bulk-parties-error-cases.json +++ b/collections/hub/sdk_scheme_adapter/bulk/basic/bulk-parties-error-cases.json @@ -5,10 +5,7 @@ "id": 1, "name": "TC-BP1. When the request has a receiver-id that does not exist in payee fsp, Then the payer fsp backend should receive an ID not found as error message in the PUT callback response.", "fileInfo": { - "path": "hub/sdk_scheme_adapter/bulk/basic/bulk-parties-error-cases.json", - "labels": [ - "basic" - ] + "path": "hub/sdk_scheme_adapter/bulk/basic/bulk-parties-error-cases.json" }, "requests": [ { @@ -107,10 +104,7 @@ "id": 2, "name": "TC-BP2. When the receiver fsp responds after the timeout elapses, Then the payer fsp should receive an timed-out as error message.", "fileInfo": { - "path": "hub/sdk_scheme_adapter/bulk/basic/bulk-parties-error-cases.json", - "labels": [ - "basic" - ] + "path": "hub/sdk_scheme_adapter/bulk/basic/bulk-parties-error-cases.json" }, "requests": [ { @@ -223,10 +217,7 @@ "id": 3, "name": "TC-BP3. Given skipPartyLookup is set to false, When the incoming request has receiver info already populated, Then party lookup should be skipped.", "fileInfo": { - "path": "hub/sdk_scheme_adapter/bulk/basic/bulk-parties-error-cases.json", - "labels": [ - "basic" - ] + "path": "hub/sdk_scheme_adapter/bulk/basic/bulk-parties-error-cases.json" }, "requests": [ { @@ -319,10 +310,7 @@ "id": 4, "name": "TC-BP4. Given there are 2 transfers in the bulk request, When one transfer has a succesful party lookup and the other has a failure, Then the PUT response should have details about both the transfers.", "fileInfo": { - "path": "hub/sdk_scheme_adapter/bulk/basic/bulk-parties-error-cases.json", - "labels": [ - "basic" - ] + "path": "hub/sdk_scheme_adapter/bulk/basic/bulk-parties-error-cases.json" }, "requests": [ { @@ -482,10 +470,7 @@ "id": 5, "name": "TC-BP5. Given there are 2 transfers in the bulk request, When one transfer has a succesful party lookup and the other has a timeout, Then the PUT response should have details about both the transfers.", "fileInfo": { - "path": "hub/sdk_scheme_adapter/bulk/basic/bulk-parties-error-cases.json", - "labels": [ - "basic" - ] + "path": "hub/sdk_scheme_adapter/bulk/basic/bulk-parties-error-cases.json" }, "requests": [ { @@ -646,10 +631,7 @@ "id": 6, "name": "TC-BP6. Given there are 2 transfers in the bulk request, When both the transfers have a timeout, Then the PUT response should have timeout details about both the transfers.", "fileInfo": { - "path": "hub/sdk_scheme_adapter/bulk/basic/bulk-parties-error-cases.json", - "labels": [ - "basic" - ] + "path": "hub/sdk_scheme_adapter/bulk/basic/bulk-parties-error-cases.json" }, "requests": [ { diff --git a/collections/hub/sdk_scheme_adapter/bulk/basic/bulk-quotes-error-cases.json b/collections/hub/sdk_scheme_adapter/bulk/basic/bulk-quotes-error-cases.json index 72c5ec97..84756624 100644 --- a/collections/hub/sdk_scheme_adapter/bulk/basic/bulk-quotes-error-cases.json +++ b/collections/hub/sdk_scheme_adapter/bulk/basic/bulk-quotes-error-cases.json @@ -5,10 +5,7 @@ "id": 1, "name": "TC-BQ1. Given party lookup is skipped and bulk quotes request is submitted, When receiver fsp fails the entire batch and sends the error, Then the PUT response should have error details about the transfer.", "fileInfo": { - "path": "hub/sdk_scheme_adapter/bulk/basic/bulk-quotes-error-cases.json", - "labels": [ - "basic" - ] + "path": "hub/sdk_scheme_adapter/bulk/basic/bulk-quotes-error-cases.json" }, "requests": [ { @@ -193,10 +190,7 @@ "id": 2, "name": "TC-BQ2. Given party lookup is skipped and bulk quotes request is submitted, When receiver fsp times out while sending bulk quotes reponse, Then the PUT response should have error details about timeout.", "fileInfo": { - "path": "hub/sdk_scheme_adapter/bulk/basic/bulk-quotes-error-cases.json", - "labels": [ - "basic" - ] + "path": "hub/sdk_scheme_adapter/bulk/basic/bulk-quotes-error-cases.json" }, "requests": [ { @@ -353,10 +347,7 @@ "id": 3, "name": "TC-BQ3. Given there are 2 transfers in the bulk request and acceptParty is true for both the transfers, When the receiver fsp sends success response for first quote and failure for the second quote, Then the PUT response should have details of success and failure for both the quotes.", "fileInfo": { - "path": "hub/sdk_scheme_adapter/bulk/basic/bulk-quotes-error-cases.json", - "labels": [ - "basic" - ] + "path": "hub/sdk_scheme_adapter/bulk/basic/bulk-quotes-error-cases.json" }, "requests": [ { @@ -568,10 +559,7 @@ "id": 5, "name": "TC-BQ5. Given there are 2 transfers in the bulk request, When the sender fsp sends the acceptParty:true for 1 transfer and acceptParty:false for the second transfer, Then the PUT response should have details of the 1 quote for which the acceptParty:true response was sent.", "fileInfo": { - "path": "hub/sdk_scheme_adapter/bulk/basic/bulk-quotes-error-cases.json", - "labels": [ - "basic" - ] + "path": "hub/sdk_scheme_adapter/bulk/basic/bulk-quotes-error-cases.json" }, "requests": [ { @@ -770,10 +758,7 @@ "id": 9, "name": "TC-BQ9. Given the transfers in the bulk request have 2 different receiver fsp ids, When one of the receivers sends an error, Then the PUT response should have details of the 2 transfers with success and failure details.", "fileInfo": { - "path": "hub/sdk_scheme_adapter/bulk/basic/bulk-quotes-error-cases.json", - "labels": [ - "basic" - ] + "path": "hub/sdk_scheme_adapter/bulk/basic/bulk-quotes-error-cases.json" }, "requests": [ { @@ -1000,10 +985,7 @@ "id": 10, "name": "TC-BQ10. Given the transfers in the bulk request have 2 different receiver fsp ids, When both of the receivers sends an error, Then the PUT response should have details of failure details of all the 4 transfers.", "fileInfo": { - "path": "hub/sdk_scheme_adapter/bulk/basic/bulk-quotes-error-cases.json", - "labels": [ - "basic" - ] + "path": "hub/sdk_scheme_adapter/bulk/basic/bulk-quotes-error-cases.json" }, "requests": [ { @@ -1269,10 +1251,7 @@ "id": 11, "name": "TC-BQ11. Given there are 2 transfers in the bulk request with different receiver fsp ids, When one of the receivers timesout, Then the PUT response should have details of the 2 transfers with success and timeout details.", "fileInfo": { - "path": "hub/sdk_scheme_adapter/bulk/basic/bulk-quotes-error-cases.json", - "labels": [ - "basic" - ] + "path": "hub/sdk_scheme_adapter/bulk/basic/bulk-quotes-error-cases.json" }, "requests": [ { diff --git a/collections/hub/sdk_scheme_adapter/bulk/basic/bulk-sdk-warm-up.json b/collections/hub/sdk_scheme_adapter/bulk/basic/bulk-sdk-warm-up.json index 0d264bbf..792968ee 100644 --- a/collections/hub/sdk_scheme_adapter/bulk/basic/bulk-sdk-warm-up.json +++ b/collections/hub/sdk_scheme_adapter/bulk/basic/bulk-sdk-warm-up.json @@ -217,10 +217,7 @@ } ], "fileInfo": { - "path": "hub/sdk_scheme_adapter/bulk/basic/bulk-sdk-warm-up.json", - "labels": [ - "basic" - ] + "path": "hub/sdk_scheme_adapter/bulk/basic/bulk-sdk-warm-up.json" } }, { @@ -439,10 +436,7 @@ } ], "fileInfo": { - "path": "hub/sdk_scheme_adapter/bulk/basic/bulk-sdk-warm-up.json", - "labels": [ - "basic" - ] + "path": "hub/sdk_scheme_adapter/bulk/basic/bulk-sdk-warm-up.json" } } ] diff --git a/collections/hub/sdk_scheme_adapter/bulk/basic/bulk-transfers-error-cases.json b/collections/hub/sdk_scheme_adapter/bulk/basic/bulk-transfers-error-cases.json index 8b46d896..78552774 100644 --- a/collections/hub/sdk_scheme_adapter/bulk/basic/bulk-transfers-error-cases.json +++ b/collections/hub/sdk_scheme_adapter/bulk/basic/bulk-transfers-error-cases.json @@ -5,10 +5,7 @@ "id": 1, "name": "TC-BT1. Given partyLookup is skipped And there are 2 transfers with the same receiver fspid in the request and acceptParty, acceptQuote is true for both the requests, When the receiver fsp fails the entire transfer batch, Then the callback response should have the party and quote results and a failure for transfer", "fileInfo": { - "path": "hub/sdk_scheme_adapter/bulk/basic/bulk-transfers-error-cases.json", - "labels": [ - "basic" - ] + "path": "hub/sdk_scheme_adapter/bulk/basic/bulk-transfers-error-cases.json" }, "requests": [ { @@ -312,10 +309,7 @@ "id": 2, "name": "TC-BT2. Given partyLookup is skipped And there are 2 transfers with the same receiver fspid in the request and acceptParty, acceptQuote is true for both the requests, When the receiver fsp times out the entire transfer batch, Then the callback response should have the party and quote results and time out failure for transfer", "fileInfo": { - "path": "hub/sdk_scheme_adapter/bulk/basic/bulk-transfers-error-cases.json", - "labels": [ - "basic" - ] + "path": "hub/sdk_scheme_adapter/bulk/basic/bulk-transfers-error-cases.json" }, "requests": [ { @@ -597,10 +591,7 @@ "id": 10, "name": "TC-BT10. Given partyLookup is skipped And there are 2 transfers with the different receiver fspid in the request and acceptParty, acceptQuote is true for both the requests, When one of the receiver fsp fails the entire transfer batch, while the other receiving fsp sends succesful reponse, Then the callback response should have the party, quote, transfer results for the batch that sends success response and only party and quote result for the batch that is failed.", "fileInfo": { - "path": "hub/sdk_scheme_adapter/bulk/basic/bulk-transfers-error-cases.json", - "labels": [ - "basic" - ] + "path": "hub/sdk_scheme_adapter/bulk/basic/bulk-transfers-error-cases.json" }, "requests": [ { @@ -901,10 +892,7 @@ "id": 11, "name": "TC-BT11. Given partyLookup is skipped And there are 2 transfers with the different receiver fspid in the request and acceptParty, acceptQuote is true for both the requests, When one of the receiver fsp fails the entire transfer batch, while the other receiving fsp sends succesful reponse, Then the callback response should have the party, quote, transfer results for the batch that sends success response and only party and quote result for the batch that is failed.", "fileInfo": { - "path": "hub/sdk_scheme_adapter/bulk/basic/bulk-transfers-error-cases.json", - "labels": [ - "basic" - ] + "path": "hub/sdk_scheme_adapter/bulk/basic/bulk-transfers-error-cases.json" }, "requests": [ { From d1aedeaa603eff6a77d4a21a3d6345842f29073b Mon Sep 17 00:00:00 2001 From: Steven Oderayi Date: Mon, 27 Nov 2023 11:44:56 +0100 Subject: [PATCH 04/16] chore: remove commented code --- .../fulfil-reserved-v1.0.json | 50 ------------------- 1 file changed, 50 deletions(-) diff --git a/collections/hub/golden_path/feature_tests/transfer_negative_scenarios/fulfil-reserved-v1.0.json b/collections/hub/golden_path/feature_tests/transfer_negative_scenarios/fulfil-reserved-v1.0.json index cc72988d..9c9a4428 100644 --- a/collections/hub/golden_path/feature_tests/transfer_negative_scenarios/fulfil-reserved-v1.0.json +++ b/collections/hub/golden_path/feature_tests/transfer_negative_scenarios/fulfil-reserved-v1.0.json @@ -569,56 +569,6 @@ }, "postRequest": { "exec": [ - "// const expectedTransferState = 'ABORTED'", - "", - "// // lets get retry config", - "// const maxRetryCount = Number.parseFloat(environment.RETRY_MAX_ATTEMPTS) || 20", - "// const maxRetryWait = Number.parseFloat(environment.RETRY_MAX_WAIT_IN_MS) || 250", - "", - "// async function main() {", - "// let jsonData = callback.body", - "", - "// for (let retryCount = 0 ; retryCount < maxRetryCount; retryCount++) {", - "// console.log(`retry-count=${retryCount+1}, max-count=${maxRetryCount}, max-wait=${maxRetryWait}`)", - " ", - "// const isOk = jsonData.transferState === expectedTransferState;", - " ", - "// if (isOk) {", - "// console.log(`Everything is OK, let's continue`)", - "// break;", - "// } else {", - "// console.log(`Everything is NOT OK, let's wait for ${maxRetryWait}ms, and try again...`)", - "// await custom.sleep(maxRetryWait);", - "// jsonData = (await makeRequest()).data", - "// console.log('jsonData: ', jsonData)", - "// }", - "// }", - "// }", - "", - "// async function makeRequest() {", - "// const reqParams = {", - "// method: 'get', ", - "// url: `{$inputs.HOST_ML_API_ADAPTER}/transfers/{$prev.3.request.body.transferId}`,", - "// headers: {", - "// 'Content-Type': `{$inputs.contentTypeTransfers}`,", - "// Accept: `{$inputs.acceptTransfers}`,", - "// Date: `{$function.generic.curDate}`,", - "// 'FSPIOP-Source': `{$inputs.fromFspId}`,", - "// Authorization: `{$inputs.TTK_BEARER_TOKEN}`", - "// }", - "// };", - " ", - "// /*", - "// const reqParams = {", - "// method: 'get',", - "// url: `{$environment.PAYERFSP_SDK_TESTAPI_URL}/callbacks/{$prev.3.request.body.transferId}`", - "// }", - "// */", - " ", - "// return axios.get(reqParams);", - "// }", - "", - "// await main()" ] } } From 1c3249cb8645927373e62a66a0c1d2d94a7df86d Mon Sep 17 00:00:00 2001 From: Steven Oderayi Date: Mon, 27 Nov 2023 11:47:37 +0100 Subject: [PATCH 05/16] fix: fix retry logic --- .../provisioning/CGS_Specific/adjust-participants-limits.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/collections/hub/provisioning/CGS_Specific/adjust-participants-limits.json b/collections/hub/provisioning/CGS_Specific/adjust-participants-limits.json index 75606f6b..bed6db14 100644 --- a/collections/hub/provisioning/CGS_Specific/adjust-participants-limits.json +++ b/collections/hub/provisioning/CGS_Specific/adjust-participants-limits.json @@ -79,7 +79,7 @@ " }", " };", " ", - " return axios.get(reqParams);", + " return axios(reqParams);", "}", "", "await main()" From 8f6144de9cc3a754e67ab4c97e8674686773a18e Mon Sep 17 00:00:00 2001 From: Steven Oderayi Date: Tue, 28 Nov 2023 12:03:29 +0100 Subject: [PATCH 06/16] fix: update retry logic with inboundEvent --- .../fulfil-reserved-v1.0.json | 84 +++++++++++++++---- .../bulk-invalid-timestamp.json | 75 ++++++++++++++--- .../adjust-participants-limits.json | 21 +++-- 3 files changed, 149 insertions(+), 31 deletions(-) diff --git a/collections/hub/golden_path/feature_tests/transfer_negative_scenarios/fulfil-reserved-v1.0.json b/collections/hub/golden_path/feature_tests/transfer_negative_scenarios/fulfil-reserved-v1.0.json index 9c9a4428..266f066f 100644 --- a/collections/hub/golden_path/feature_tests/transfer_negative_scenarios/fulfil-reserved-v1.0.json +++ b/collections/hub/golden_path/feature_tests/transfer_negative_scenarios/fulfil-reserved-v1.0.json @@ -460,7 +460,6 @@ "Authorization": "{$inputs.TTK_BEARER_TOKEN}", "Content-Type": "{$inputs.contentTypeTransfers}" }, - "delay": "15000", "scriptingEngine": "javascript", "tests": { "assertions": [ @@ -468,21 +467,21 @@ "id": 1, "description": "Response status to be 202", "exec": [ - "expect(response.status).to.equal(202)" + "expect(environment.transferResponse.code).to.equal(202)" ] }, { "id": 2, "description": "Response statusText be Accepted", "exec": [ - "expect(response.statusText).to.equal('Accepted')" + "expect(environment.transferResponse.status).to.equal('Accepted')" ] }, { "id": 12, "description": "Callback Header - fspiop-source is switch", "exec": [ - "expect(callback.headers['fspiop-source']).to.equal('switch')", + "expect(environment.transferCallback.headers['fspiop-source']).to.equal('switch')", "" ] }, @@ -490,7 +489,7 @@ "id": 13, "description": "Callback Header - fspiop-desination is fspiop-source in request", "exec": [ - "expect(callback.headers['fspiop-destination']).to.equal('{$inputs.fromFspId}')", + "expect(environment.transferCallback.headers['fspiop-destination']).to.equal('{$inputs.fromFspId}')", "" ] }, @@ -498,7 +497,7 @@ "id": 14, "description": "Callback Header - content-type", "exec": [ - "expect(callback.headers['content-type']).to.equal('application/vnd.interoperability.transfers+json;version={$inputs.expectedTransfersVersion}')", + "expect(environment.transferCallback.headers['content-type']).to.equal('application/vnd.interoperability.transfers+json;version={$inputs.expectedTransfersVersion}')", "" ] }, @@ -506,7 +505,7 @@ "id": 15, "description": "Callback Header - accept is empty", "exec": [ - "expect(callback.headers['accept']).to.equal(undefined)", + "expect(environment.transferCallback.headers['accept']).to.equal(undefined)", "" ] }, @@ -514,7 +513,7 @@ "id": 16, "description": "Callback Header - Date is not empty", "exec": [ - "expect(callback.headers['date']).to.not.equal(undefined)", + "expect(environment.transferCallback.headers['date']).to.not.equal(undefined)", "" ] }, @@ -522,7 +521,7 @@ "id": 17, "description": "Callback Header - fspiop-uri is /transfers/transferId", "exec": [ - "expect(callback.headers['fspiop-uri']).to.equal('/transfers/' + request.params.ID)", + "expect(environment.transferCallback.headers['fspiop-uri']).to.equal('/transfers/' + request.params.ID)", "" ] }, @@ -530,7 +529,7 @@ "id": 18, "description": "Callback Header - fspiop-http-method is PUT", "exec": [ - "expect(callback.headers['fspiop-http-method']).to.equal('PUT')", + "expect(environment.transferCallback.headers['fspiop-http-method']).to.equal('PUT')", "" ] }, @@ -538,7 +537,7 @@ "id": 21, "description": "Callback Body - transferState is ABORTED", "exec": [ - "expect(callback.body.transferState).to.equal('ABORTED')", + "expect(environment.transferCallback.body.transferState).to.equal('ABORTED')", "" ] }, @@ -547,10 +546,10 @@ "description": "Callback Body - error cause in extensionList", "exec": [ "", - "expect(callback.body).to.have.property('extensionList')", - "expect(callback.body.extensionList).to.have.property('extension')", + "expect(environment.transferCallback.body).to.have.property('extensionList')", + "expect(environment.transferCallback.body.extensionList).to.have.property('extension')", "", - "const filteredExtensionListForCause = callback.body.extensionList.extension.filter(ext => ext.key === \"cause\")", + "const filteredExtensionListForCause = environment.transferCallback.body.extensionList.extension.filter(ext => ext.key === \"cause\")", "", "expect(filteredExtensionListForCause.length).to.equal(1)", "", @@ -569,6 +568,63 @@ }, "postRequest": { "exec": [ + "environment.transferResponse = null", + "environment.transferCallback = null", + "const expectedTransferState = 'ABORTED'", + "", + "// lets get retry config", + "const maxRetryCount = Number.parseFloat(environment.RETRY_MAX_ATTEMPTS) || 20", + "const maxRetryWait = Number.parseFloat(environment.RETRY_MAX_WAIT_IN_MS) || 250", + "", + "async function main() {", + " let _response = response", + " let _callback = callback", + "", + " for (let retryCount = 0 ; retryCount < maxRetryCount; retryCount++) {", + " console.log(`retry-count=${retryCount+1}, max-count=${maxRetryCount}, max-wait=${maxRetryWait}`)", + " ", + " const isOk = _callback?.body?.transferState === expectedTransferState;", + " ", + " if (isOk) {", + " console.log(`Everything is OK, let's continue`)", + " environment.transferResponse = _response", + " environment.transferCallback = _callback", + " break;", + " } else {", + " console.log(`Everything is NOT OK, let's wait for ${maxRetryWait}ms, and try again...`)", + " if (retryCount == 0) {", + " const axiosRes = await makeRequest()", + " _response = { code: axiosRes.status, status: axiosRes.statusText }", + " }", + " await custom.sleep(maxRetryWait)", + " const callback_name = 'get-transfer'", + " _callback = await inboundEvent.getMessage(callback_name)", + " console.log(`${callback_name} callback result: `, _callback)", + " }", + " }", + "}", + "", + "async function makeRequest(callback_name) {", + " const reqParams = {", + " method: 'get', ", + " url: `{$inputs.HOST_ML_API_ADAPTER}/transfers/{$prev.3.request.body.transferId}`,", + " headers: {", + " 'Content-Type': `{$inputs.contentTypeTransfers}`,", + " Accept: `{$inputs.acceptTransfers}`,", + " Date: `{$function.generic.curDate}`,", + " 'FSPIOP-Source': `{$inputs.fromFspId}`,", + " Authorization: `{$inputs.TTK_BEARER_TOKEN}`", + " }", + " };", + " ", + " const callbackPath = `/transfers/{$prev.3.request.body.transferId}`", + " ", + " await inboundEvent.addListener(callback_name, reqParams.method, callbackPath)", + " ", + " return axios(reqParams);", + "}", + "", + "await main()" ] } } diff --git a/collections/hub/other_tests/bulk_transfers/bulk-invalid-timestamp.json b/collections/hub/other_tests/bulk_transfers/bulk-invalid-timestamp.json index 9b39dd45..af8cf780 100644 --- a/collections/hub/other_tests/bulk_transfers/bulk-invalid-timestamp.json +++ b/collections/hub/other_tests/bulk_transfers/bulk-invalid-timestamp.json @@ -343,61 +343,116 @@ "id": 1, "description": "Status code is 202", "exec": [ - "expect(response.status).to.equal(202)" + "expect(environment.bulkTransferResponse.code).to.equal(202)" ] }, { "id": 2, "description": "payerfsp callback - date header should be set", "exec": [ - "expect(callback.headers).to.have.property('date')" + "expect(environment.bulkTransferCallback.headers).to.have.property('date')" ] }, { "id": 3, "description": "payerfsp callback - fspiop-source should be switch", "exec": [ - "expect(callback.headers['fspiop-source']).to.equal('switch')" + "expect(environment.bulkTransferCallback.headers['fspiop-source']).to.equal('switch')" ] }, { "id": 4, "description": "payerfsp callback - fspiop-destination should be testingtoolkitdfsp", "exec": [ - "expect(callback.headers['fspiop-destination']).to.equal(environment.fromFspId)" + "expect(environment.bulkTransferCallback.headers['fspiop-destination']).to.equal(environment.fromFspId)" ] }, { "id": 5, "description": "payerfsp callback - fspiop-uri should be as expected", "exec": [ - "expect(callback.headers['fspiop-uri']).to.equal(`/testingtoolkitdfsp/bulkTransfers/${environment.bulkTransferId}`)" + "expect(environment.bulkTransferCallback.headers['fspiop-uri']).to.equal(`/testingtoolkitdfsp/bulkTransfers/${environment.bulkTransferId}`)" ] }, { "id": 6, "description": "payerfsp callback - fspiop-http-method should be PUT", "exec": [ - "expect(callback.headers['fspiop-http-method']).to.equal('PUT')" + "expect(environment.bulkTransferCallback.headers['fspiop-http-method']).to.equal('PUT')" ] }, { "id": 8, "description": "payerfsp callback - errorInformation should be set correctly", "exec": [ - "expect(callback.body).to.have.property(\"bulkTransferState\")", - "expect(callback.body.bulkTransferState).to.equal(\"REJECTED\")" + "expect(environment.bulkTransferCallback.body).to.have.property(\"bulkTransferState\")", + "expect(environment.bulkTransferCallback.body.bulkTransferState).to.equal(\"REJECTED\")" ] } ] }, "ignoreCallbacks": false, "scriptingEngine": "javascript", - "delay": "1000", "scripts": { "postRequest": { "exec": [ - "" + "environment.bulkTransferResponse = null", + "environment.bulkTransferCallback = null", + "const expectedBulkTransferState = 'REJECTED'", + "", + "// lets get retry config", + "const maxRetryCount = Number.parseFloat(environment.RETRY_MAX_ATTEMPTS) || 20", + "const maxRetryWait = Number.parseFloat(environment.RETRY_MAX_WAIT_IN_MS) || 250", + "", + "async function main() {", + " let _response = response", + " let _callback = callback", + "", + " for (let retryCount = 0 ; retryCount < maxRetryCount; retryCount++) {", + " console.log(`retry-count=${retryCount+1}, max-count=${maxRetryCount}, max-wait=${maxRetryWait}`)", + " ", + " const isOk = _callback?.body?.bulkTransferState === expectedBulkTransferState;", + " ", + " if (isOk) {", + " console.log(`Everything is OK, let's continue`)", + " environment.bulkTransferResponse = _response", + " environment.bulkTransferCallback = _callback", + " break;", + " } else {", + " console.log(`Everything is NOT OK, let's wait for ${maxRetryWait}ms, and try again...`)", + " if (retryCount == 0) {", + " const axiosRes = await makeRequest()", + " _response = { code: axiosRes.status, status: axiosRes.statusText }", + " }", + " await custom.sleep(maxRetryWait)", + " const callback_name = 'get-bulk-transfer'", + " _callback = await inboundEvent.getMessage(callback_name)", + " console.log(`${callback_name} callback result: `, _callback)", + " }", + " }", + "}", + "", + "async function makeRequest(callback_name) {", + " const reqParams = {", + " method: 'get', ", + " url: `{$inputs.HOST_BULK_ADAPTER}/bulkTransfers/{$environment.bulkTransferId}`,", + " headers: {", + " 'Content-Type': `{$inputs.contentBulkTransfers}`,", + " Accept: `{$inputs.acceptBulkTransfers}`,", + " Date: `{$environment.headerDate}`,", + " 'FSPIOP-Source': `{$inputs.fromFspId}`,", + " 'FSPIOP-Destination': 'switch'", + " }", + " };", + " ", + " const callbackPath = `/bulkTransfers/{$environment.bulkTransferId}`", + " ", + " await inboundEvent.addListener(callback_name, 'get', callbackPath)", + " ", + " return axios(reqParams)", + "}", + "", + "await main()" ] }, "preRequest": { diff --git a/collections/hub/provisioning/CGS_Specific/adjust-participants-limits.json b/collections/hub/provisioning/CGS_Specific/adjust-participants-limits.json index bed6db14..8fa3b82f 100644 --- a/collections/hub/provisioning/CGS_Specific/adjust-participants-limits.json +++ b/collections/hub/provisioning/CGS_Specific/adjust-participants-limits.json @@ -127,7 +127,8 @@ ] } ] - } + }, + "scriptingEngine": "javascript" }, { "id": 3, @@ -169,7 +170,8 @@ ] } ] - } + }, + "scriptingEngine": "javascript" }, { "id": 4, @@ -211,7 +213,8 @@ ] } ] - } + }, + "scriptingEngine": "javascript" }, { "id": 5, @@ -253,7 +256,8 @@ ] } ] - } + }, + "scriptingEngine": "javascript" }, { "id": 6, @@ -295,7 +299,8 @@ ] } ] - } + }, + "scriptingEngine": "javascript" }, { "id": 7, @@ -337,7 +342,8 @@ ] } ] - } + }, + "scriptingEngine": "javascript" }, { "id": 8, @@ -367,7 +373,8 @@ ] } ] - } + }, + "scriptingEngine": "javascript" } ], "fileInfo": { From 72de4e1705b2f25138bc52e503caee226f4132b4 Mon Sep 17 00:00:00 2001 From: Steven Oderayi Date: Tue, 28 Nov 2023 12:51:27 +0100 Subject: [PATCH 07/16] fix: add delay --- .../fulfil-reserved-v1.0.json | 52 +++++++++---------- .../bulk-invalid-timestamp.json | 18 +++---- 2 files changed, 33 insertions(+), 37 deletions(-) diff --git a/collections/hub/golden_path/feature_tests/transfer_negative_scenarios/fulfil-reserved-v1.0.json b/collections/hub/golden_path/feature_tests/transfer_negative_scenarios/fulfil-reserved-v1.0.json index 266f066f..9d4cabaa 100644 --- a/collections/hub/golden_path/feature_tests/transfer_negative_scenarios/fulfil-reserved-v1.0.json +++ b/collections/hub/golden_path/feature_tests/transfer_negative_scenarios/fulfil-reserved-v1.0.json @@ -576,6 +576,9 @@ "const maxRetryCount = Number.parseFloat(environment.RETRY_MAX_ATTEMPTS) || 20", "const maxRetryWait = Number.parseFloat(environment.RETRY_MAX_WAIT_IN_MS) || 250", "", + "const callbackName = 'put-transfer'", + "const callbackPath = `/transfers/{$prev.3.request.body.transferId}`", + "", "async function main() {", " let _response = response", " let _callback = callback", @@ -592,42 +595,39 @@ " break;", " } else {", " console.log(`Everything is NOT OK, let's wait for ${maxRetryWait}ms, and try again...`)", - " if (retryCount == 0) {", - " const axiosRes = await makeRequest()", - " _response = { code: axiosRes.status, status: axiosRes.statusText }", - " }", " await custom.sleep(maxRetryWait)", - " const callback_name = 'get-transfer'", - " _callback = await inboundEvent.getMessage(callback_name)", - " console.log(`${callback_name} callback result: `, _callback)", + " await inboundEvent.addListener(callbackName, 'put', callbackPath)", + " const axiosRes = await makeRequest()", + " _response = { code: axiosRes.status, status: axiosRes.statusText }", + " _callback = await inboundEvent.getMessage(callbackName)", + " console.log(`retryCount: ${retryCount+1} - ${callbackName} callback: `, _callback)", + " ", " }", " }", "}", "", - "async function makeRequest(callback_name) {", - " const reqParams = {", - " method: 'get', ", - " url: `{$inputs.HOST_ML_API_ADAPTER}/transfers/{$prev.3.request.body.transferId}`,", - " headers: {", - " 'Content-Type': `{$inputs.contentTypeTransfers}`,", - " Accept: `{$inputs.acceptTransfers}`,", - " Date: `{$function.generic.curDate}`,", - " 'FSPIOP-Source': `{$inputs.fromFspId}`,", - " Authorization: `{$inputs.TTK_BEARER_TOKEN}`", - " }", - " };", - " ", - " const callbackPath = `/transfers/{$prev.3.request.body.transferId}`", - " ", - " await inboundEvent.addListener(callback_name, reqParams.method, callbackPath)", - " ", - " return axios(reqParams);", + "async function makeRequest() {", + " const reqParams = {", + " method: 'get', ", + " url: `{$inputs.HOST_ML_API_ADAPTER}/transfers/{$prev.3.request.body.transferId}`,", + " headers: {", + " 'Content-Type': `{$inputs.contentTypeTransfers}`,", + " Accept: `{$inputs.acceptTransfers}`,", + " Date: `{$function.generic.curDate}`,", + " 'FSPIOP-Source': `{$inputs.fromFspId}`,", + " Authorization: `{$inputs.TTK_BEARER_TOKEN}`", + " }", + " };", + " ", + " return axios(reqParams);", "}", "", "await main()" ] } - } + }, + "ignoreCallbacks": false, + "delay": "1000" } ] } diff --git a/collections/hub/other_tests/bulk_transfers/bulk-invalid-timestamp.json b/collections/hub/other_tests/bulk_transfers/bulk-invalid-timestamp.json index af8cf780..b64cbb80 100644 --- a/collections/hub/other_tests/bulk_transfers/bulk-invalid-timestamp.json +++ b/collections/hub/other_tests/bulk_transfers/bulk-invalid-timestamp.json @@ -399,6 +399,8 @@ "environment.bulkTransferResponse = null", "environment.bulkTransferCallback = null", "const expectedBulkTransferState = 'REJECTED'", + "const callbackPath = `/bulkTransfers/{$environment.bulkTransferId}`", + "const callbackName = 'put-bulk-transfer'", "", "// lets get retry config", "const maxRetryCount = Number.parseFloat(environment.RETRY_MAX_ATTEMPTS) || 20", @@ -420,14 +422,12 @@ " break;", " } else {", " console.log(`Everything is NOT OK, let's wait for ${maxRetryWait}ms, and try again...`)", - " if (retryCount == 0) {", - " const axiosRes = await makeRequest()", - " _response = { code: axiosRes.status, status: axiosRes.statusText }", - " }", " await custom.sleep(maxRetryWait)", - " const callback_name = 'get-bulk-transfer'", - " _callback = await inboundEvent.getMessage(callback_name)", - " console.log(`${callback_name} callback result: `, _callback)", + " await inboundEvent.addListener(callbackName, 'put', callbackPath)", + " const axiosRes = await makeRequest()", + " _response = { code: axiosRes.status, status: axiosRes.statusText }", + " _callback = await inboundEvent.getMessage(callbackName)", + " console.log(`retryCount: ${retryCount+1} - ${callbackName} callback: `, _callback)", " }", " }", "}", @@ -445,10 +445,6 @@ " }", " };", " ", - " const callbackPath = `/bulkTransfers/{$environment.bulkTransferId}`", - " ", - " await inboundEvent.addListener(callback_name, 'get', callbackPath)", - " ", " return axios(reqParams)", "}", "", From 69827e6fc35c71a03ff106381b87685e3831973b Mon Sep 17 00:00:00 2001 From: Steven Oderayi Date: Tue, 28 Nov 2023 14:31:52 +0100 Subject: [PATCH 08/16] fix: update test case --- .../duplicate_handling/transfers/fulfill_commit.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/collections/hub/golden_path/feature_tests/duplicate_handling/transfers/fulfill_commit.json b/collections/hub/golden_path/feature_tests/duplicate_handling/transfers/fulfill_commit.json index 9c50abfd..7e35bf0e 100644 --- a/collections/hub/golden_path/feature_tests/duplicate_handling/transfers/fulfill_commit.json +++ b/collections/hub/golden_path/feature_tests/duplicate_handling/transfers/fulfill_commit.json @@ -343,7 +343,7 @@ "fulfilment": "{$inputs.validFulfillment}", "completedTimestamp": "{$environment.fulfillCompletedTimestamp}" }, - "ignoreCallbacks": true, + "ignoreCallbacks": false, "scriptingEngine": "javascript", "tests": { "assertions": [ @@ -382,7 +382,8 @@ "postRequest": { "exec": [ "requestVariables.payeeDuplicateCallback = await inboundEvent.getMessage('payeeDuplicateCallback')", - "console.log(requestVariables.payeeDuplicateCallback)" + "console.log(requestVariables.payeeDuplicateCallback)", + "" ] }, "preRequest": { From cfd420664e03033707981ec46d280c08e5071bf3 Mon Sep 17 00:00:00 2001 From: Steven Oderayi Date: Wed, 29 Nov 2023 13:46:41 +0100 Subject: [PATCH 09/16] fix: more retry fixes --- .../golden_path/settlement_cgs/newsetcgs.json | 131 ++++++++++++++++-- 1 file changed, 116 insertions(+), 15 deletions(-) diff --git a/collections/hub/golden_path/settlement_cgs/newsetcgs.json b/collections/hub/golden_path/settlement_cgs/newsetcgs.json index b97822df..1d8204c2 100644 --- a/collections/hub/golden_path/settlement_cgs/newsetcgs.json +++ b/collections/hub/golden_path/settlement_cgs/newsetcgs.json @@ -5417,14 +5417,14 @@ "id": 1, "description": "Status code is 200", "exec": [ - "expect(response.status).to.equal(200)" + "expect(requestVariables.scenarioResponse.status).to.equal(200)" ] }, { "id": 55, "description": "Transfer state is 'COMMITTED'", "exec": [ - "expect(response.body.scenario2.result.fulfil.body.transferState).to.equal('COMMITTED')" + "expect(requestVariables.scenarioResponse.body.scenario2.result.fulfil.body.transferState).to.equal('COMMITTED')" ] } ] @@ -5438,10 +5438,60 @@ " await websocket.connect(environment.PAYERFSP_SDK_TESTAPI_WS_URL + '/callbacks/{$inputs.SIMPAYEE_MSISDN}', 'payerCallback')", "}", "*/", - "requestVariables.expectedPayeeFirstName = \"PayeeFirst\"", - "requestVariables.expectedPayeeLastName = \"PayeeLast\"", - "requestVariables.expectedPayeeDOB = \"2010-10-10\"", - "requestVariables.payerName = \"PayerFirst PayerLast\"" + "// requestVariables.expectedPayeeFirstName = \"PayeeFirst\"", + "// requestVariables.expectedPayeeLastName = \"PayeeLast\"", + "// requestVariables.expectedPayeeDOB = \"2010-10-10\"", + "// requestVariables.payerName = \"PayerFirst PayerLast\"", + "", + "", + "", + "" + ] + }, + "postRequest": { + "exec": [ + "// lets get retry config", + " const maxRetryCount = Number.parseFloat(environment.RETRY_MAX_ATTEMPTS) || 20", + " const maxRetryWait = Number.parseFloat(environment.RETRY_MAX_WAIT_IN_MS) || 250", + " ", + " const expectedStatusCode = 200", + " requestVariables.scenarioResponse = null", + " ", + " async function main() {", + " let _response = response", + " ", + " for (let retryCount = 0 ; retryCount < maxRetryCount; retryCount++) {", + " console.log(`retry-count=${retryCount+1}, max-count=${maxRetryCount}, max-wait=${maxRetryWait}`)", + " ", + " const isOk = _response.status === expectedStatusCode;", + " ", + " if (isOk) {", + " requestVariables.scenarioResponse = _response", + " console.log(`Everything is OK, let's continue`)", + " break;", + " } else {", + " console.log(`Everything is NOT OK, let's wait for ${maxRetryWait}ms, and try again...`)", + " await custom.sleep(maxRetryWait);", + " const axiosRes = await makeRequest()", + " _response = { body: axiosRes.data, status: axiosRes.status }", + " }", + " }", + " }", + " ", + " function makeRequest() {", + " const reqParams = {", + " method: request.method, ", + " url: `${request.url}${request.path}`,", + " data: request.body,", + " headers: {", + " 'Content-Type': 'application/json',", + " }", + " };", + " ", + " return axios(reqParams);", + " }", + " ", + " await main()" ] } } @@ -5544,7 +5594,8 @@ "requestVariables.payerName = \"PayerFirst PayerLast\"" ] } - } + }, + "disabled": false }, { "id": 5, @@ -5644,7 +5695,8 @@ "requestVariables.payerName = \"PayerFirst PayerLast\"" ] } - } + }, + "disabled": false }, { "id": 6, @@ -5744,7 +5796,8 @@ "requestVariables.payerName = \"PayerFirst PayerLast\"" ] } - } + }, + "disabled": false } ] }, @@ -6241,14 +6294,14 @@ "id": 1, "description": "Status code is 200", "exec": [ - "expect(response.status).to.equal(200)" + "expect(requestVariables.scenarioResponse.status).to.equal(200)" ] }, { "id": 55, "description": "Transfer state is 'COMMITTED'", "exec": [ - "expect(response.body.scenario2.result.fulfil.body.transferState).to.equal('COMMITTED')" + "expect(requestVariables.scenarioResponse.body.scenario2.result.fulfil.body.transferState).to.equal('COMMITTED')" ] } ] @@ -6262,10 +6315,58 @@ " await websocket.connect(environment.PAYERFSP_SDK_TESTAPI_WS_URL + '/callbacks/{$inputs.SIMPAYEE_MSISDN}', 'payerCallback')", "}", "*/", - "requestVariables.expectedPayeeFirstName = \"PayeeFirst\"", - "requestVariables.expectedPayeeLastName = \"PayeeLast\"", - "requestVariables.expectedPayeeDOB = \"2010-10-10\"", - "requestVariables.payerName = \"PayerFirst PayerLast\"" + "// requestVariables.expectedPayeeFirstName = \"PayeeFirst\"", + "// requestVariables.expectedPayeeLastName = \"PayeeLast\"", + "// requestVariables.expectedPayeeDOB = \"2010-10-10\"", + "// requestVariables.payerName = \"PayerFirst PayerLast\"", + "", + "" + ] + }, + "postRequest": { + "exec": [ + " // lets get retry config", + " const maxRetryCount = Number.parseFloat(environment.RETRY_MAX_ATTEMPTS) || 20", + " const maxRetryWait = Number.parseFloat(environment.RETRY_MAX_WAIT_IN_MS) || 250", + " ", + " const expectedStatusCode = 200", + " requestVariables.scenarioResponse = null", + " ", + " async function main() {", + " let _response = response", + " ", + " for (let retryCount = 0 ; retryCount < maxRetryCount; retryCount++) {", + " console.log(`retry-count=${retryCount+1}, max-count=${maxRetryCount}, max-wait=${maxRetryWait}`)", + " ", + " const isOk = _response.status === expectedStatusCode;", + " ", + " if (isOk && retryCount > 1) {", + " requestVariables.scenarioResponse = _response", + " console.log(`Everything is OK, let's continue`)", + " break;", + " } else {", + " console.log(`Everything is NOT OK, let's wait for ${maxRetryWait}ms, and try again...`)", + " await custom.sleep(maxRetryWait);", + " const axiosRes = await makeRequest()", + " _response = { body: axiosRes.data, status: axiosRes.status }", + " }", + " }", + " }", + " ", + " function makeRequest() {", + " const reqParams = {", + " method: request.method, ", + " url: `${request.url}${request.path}`,", + " data: request.body,", + " headers: {", + " 'Content-Type': 'application/json',", + " }", + " };", + " ", + " return axios(reqParams);", + " }", + " ", + " await main()" ] } } From e44217ec7d76e61e4ab257e7c01816089bcae176 Mon Sep 17 00:00:00 2001 From: Steven Oderayi Date: Wed, 29 Nov 2023 14:18:38 +0100 Subject: [PATCH 10/16] fix: update retry logic --- collections/hub/golden_path/settlement_cgs/newsetcgs.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/collections/hub/golden_path/settlement_cgs/newsetcgs.json b/collections/hub/golden_path/settlement_cgs/newsetcgs.json index 1d8204c2..5d84dea0 100644 --- a/collections/hub/golden_path/settlement_cgs/newsetcgs.json +++ b/collections/hub/golden_path/settlement_cgs/newsetcgs.json @@ -6340,7 +6340,7 @@ " ", " const isOk = _response.status === expectedStatusCode;", " ", - " if (isOk && retryCount > 1) {", + " if (isOk) {", " requestVariables.scenarioResponse = _response", " console.log(`Everything is OK, let's continue`)", " break;", From bb8a5ac4dace587acd6d48a45c6ca5acf03454c1 Mon Sep 17 00:00:00 2001 From: Steven Oderayi Date: Wed, 29 Nov 2023 14:56:37 +0100 Subject: [PATCH 11/16] fix: fix retry logic for cgs --- .../golden_path/settlement_cgs/newsetcgs.json | 151 +++++++++--------- 1 file changed, 78 insertions(+), 73 deletions(-) diff --git a/collections/hub/golden_path/settlement_cgs/newsetcgs.json b/collections/hub/golden_path/settlement_cgs/newsetcgs.json index 5d84dea0..cd29f807 100644 --- a/collections/hub/golden_path/settlement_cgs/newsetcgs.json +++ b/collections/hub/golden_path/settlement_cgs/newsetcgs.json @@ -1902,7 +1902,7 @@ "FSPIOP-Source": "{$inputs.fromFspId}" }, "scriptingEngine": "javascript", - "disabled": true, + "disabled": false, "scripts": { "preRequest": { "exec": [ @@ -1973,7 +1973,7 @@ "FSPIOP-Source": "{$inputs.fromFspId}" }, "scriptingEngine": "javascript", - "disabled": true, + "disabled": false, "scripts": { "preRequest": { "exec": [ @@ -2042,7 +2042,7 @@ "FSPIOP-Source": "{$inputs.fromFspId}" }, "scriptingEngine": "javascript", - "disabled": true, + "disabled": false, "scripts": { "preRequest": { "exec": [ @@ -2112,7 +2112,7 @@ "FSPIOP-Source": "{$inputs.fromFspId}" }, "scriptingEngine": "javascript", - "disabled": true, + "disabled": false, "scripts": { "preRequest": { "exec": [ @@ -5417,7 +5417,7 @@ "id": 1, "description": "Status code is 200", "exec": [ - "expect(requestVariables.scenarioResponse.status).to.equal(200)" + "expect(requestVariables.scenarioResponse.code).to.equal(200)" ] }, { @@ -5450,48 +5450,50 @@ }, "postRequest": { "exec": [ + "// requestVariables.scenarioResponse = {...response, status: response.code}", + "", "// lets get retry config", - " const maxRetryCount = Number.parseFloat(environment.RETRY_MAX_ATTEMPTS) || 20", - " const maxRetryWait = Number.parseFloat(environment.RETRY_MAX_WAIT_IN_MS) || 250", + "const maxRetryCount = Number.parseFloat(environment.RETRY_MAX_ATTEMPTS) || 20", + "const maxRetryWait = Number.parseFloat(environment.RETRY_MAX_WAIT_IN_MS) || 250", " ", - " const expectedStatusCode = 200", - " requestVariables.scenarioResponse = null", + "const expectedStatusCode = 200", + "requestVariables.scenarioResponse = null", " ", - " async function main() {", - " let _response = response", + "async function main() {", + " let _response = response", " ", - " for (let retryCount = 0 ; retryCount < maxRetryCount; retryCount++) {", - " console.log(`retry-count=${retryCount+1}, max-count=${maxRetryCount}, max-wait=${maxRetryWait}`)", + " for (let retryCount = 0 ; retryCount < maxRetryCount; retryCount++) {", + " console.log(`retry-count=${retryCount+1}, max-count=${maxRetryCount}, max-wait=${maxRetryWait}`)", " ", - " const isOk = _response.status === expectedStatusCode;", + " const isOk = _response.code === expectedStatusCode;", " ", - " if (isOk) {", - " requestVariables.scenarioResponse = _response", - " console.log(`Everything is OK, let's continue`)", - " break;", - " } else {", - " console.log(`Everything is NOT OK, let's wait for ${maxRetryWait}ms, and try again...`)", - " await custom.sleep(maxRetryWait);", - " const axiosRes = await makeRequest()", - " _response = { body: axiosRes.data, status: axiosRes.status }", - " }", - " }", - " }", + " if (isOk) {", + " requestVariables.scenarioResponse = _response", + " console.log(`Everything is OK, let's continue`)", + " break;", + " } else {", + " console.log(`Everything is NOT OK, let's wait for ${maxRetryWait}ms, and try again...`)", + " await custom.sleep(maxRetryWait);", + " const axiosRes = await makeRequest()", + " _response = { body: axiosRes.data, code: axiosRes.status }", + " }", + " }", + "}", " ", - " function makeRequest() {", - " const reqParams = {", - " method: request.method, ", - " url: `${request.url}${request.path}`,", - " data: request.body,", - " headers: {", - " 'Content-Type': 'application/json',", - " }", - " };", + "function makeRequest() {", + " const reqParams = {", + " method: request.method, ", + " url: `${request.url}${request.path}`,", + " data: request.body,", + " headers: {", + " 'Content-Type': 'application/json',", + " }", + " };", " ", - " return axios(reqParams);", - " }", + " return axios(reqParams);", + "}", " ", - " await main()" + "await main()" ] } } @@ -6294,7 +6296,7 @@ "id": 1, "description": "Status code is 200", "exec": [ - "expect(requestVariables.scenarioResponse.status).to.equal(200)" + "expect(requestVariables.scenarioResponse.code).to.equal(200)" ] }, { @@ -6325,48 +6327,51 @@ }, "postRequest": { "exec": [ - " // lets get retry config", - " const maxRetryCount = Number.parseFloat(environment.RETRY_MAX_ATTEMPTS) || 20", - " const maxRetryWait = Number.parseFloat(environment.RETRY_MAX_WAIT_IN_MS) || 250", + "// requestVariables.scenarioResponse = {...response, status: response.code}", + "// console.log(requestVariables.scenarioResponse)", + "", + "// lets get retry config", + "const maxRetryCount = Number.parseFloat(environment.RETRY_MAX_ATTEMPTS) || 20", + "const maxRetryWait = Number.parseFloat(environment.RETRY_MAX_WAIT_IN_MS) || 250", " ", - " const expectedStatusCode = 200", - " requestVariables.scenarioResponse = null", + "const expectedStatusCode = 200", + "requestVariables.scenarioResponse = null", " ", - " async function main() {", - " let _response = response", + "async function main() {", + " let _response = response", " ", - " for (let retryCount = 0 ; retryCount < maxRetryCount; retryCount++) {", - " console.log(`retry-count=${retryCount+1}, max-count=${maxRetryCount}, max-wait=${maxRetryWait}`)", + " for (let retryCount = 0 ; retryCount < maxRetryCount; retryCount++) {", + " console.log(`retry-count=${retryCount+1}, max-count=${maxRetryCount}, max-wait=${maxRetryWait}`)", " ", - " const isOk = _response.status === expectedStatusCode;", + " const isOk = _response.code === expectedStatusCode;", " ", - " if (isOk) {", - " requestVariables.scenarioResponse = _response", - " console.log(`Everything is OK, let's continue`)", - " break;", - " } else {", - " console.log(`Everything is NOT OK, let's wait for ${maxRetryWait}ms, and try again...`)", - " await custom.sleep(maxRetryWait);", - " const axiosRes = await makeRequest()", - " _response = { body: axiosRes.data, status: axiosRes.status }", - " }", - " }", - " }", + " if (isOk) {", + " requestVariables.scenarioResponse = _response", + " console.log(`Everything is OK, let's continue`)", + " break;", + " } else {", + " console.log(`Everything is NOT OK, let's wait for ${maxRetryWait}ms, and try again...`)", + " await custom.sleep(maxRetryWait);", + " const axiosRes = await makeRequest()", + " _response = { body: axiosRes.data, code: axiosRes.status }", + " }", + " }", + "}", " ", - " function makeRequest() {", - " const reqParams = {", - " method: request.method, ", - " url: `${request.url}${request.path}`,", - " data: request.body,", - " headers: {", - " 'Content-Type': 'application/json',", - " }", - " };", + "function makeRequest() {", + " const reqParams = {", + " method: request.method, ", + " url: `${request.url}${request.path}`,", + " data: request.body,", + " headers: {", + " 'Content-Type': 'application/json',", + " }", + " };", " ", - " return axios(reqParams);", - " }", + " return axios(reqParams);", + "}", " ", - " await main()" + "await main()" ] } } From 2133c76889b671d8e70ce2f437d00c491ffd18b0 Mon Sep 17 00:00:00 2001 From: Steven Oderayi Date: Thu, 30 Nov 2023 10:03:30 +0100 Subject: [PATCH 12/16] fix: add delay --- .../hub/other_tests/bulk_transfers/bulk-invalid-timestamp.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/collections/hub/other_tests/bulk_transfers/bulk-invalid-timestamp.json b/collections/hub/other_tests/bulk_transfers/bulk-invalid-timestamp.json index b64cbb80..c9ab13dd 100644 --- a/collections/hub/other_tests/bulk_transfers/bulk-invalid-timestamp.json +++ b/collections/hub/other_tests/bulk_transfers/bulk-invalid-timestamp.json @@ -457,7 +457,8 @@ ] } }, - "disabled": false + "disabled": false, + "delay": "1000" }, { "id": 7, From a3c3fc3c35193850e52617c7267ca9ed3871729f Mon Sep 17 00:00:00 2001 From: Steven Oderayi Date: Thu, 30 Nov 2023 12:34:30 +0100 Subject: [PATCH 13/16] fix: use HTTP endpoint for test --- .../fspiop_protocol_validation.json | 28 +++++++++++-------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/collections/hub/golden_path/feature_tests/backward_compatibility/fspiop_protocol_validation.json b/collections/hub/golden_path/feature_tests/backward_compatibility/fspiop_protocol_validation.json index 7f12b1d2..10b30f20 100644 --- a/collections/hub/golden_path/feature_tests/backward_compatibility/fspiop_protocol_validation.json +++ b/collections/hub/golden_path/feature_tests/backward_compatibility/fspiop_protocol_validation.json @@ -436,16 +436,18 @@ "scripts": { "preRequest": { "exec": [ - "if (environment.ENABLE_WS_ASSERTIONS===true) {", - " await websocket.connect(environment.PAYEEFSP_SDK_TESTAPI_WS_URL + '/requests/{$inputs.toIdValue}', 'payeeRequest')", - "}" + "// if (environment.ENABLE_WS_ASSERTIONS===true) {", + "// await websocket.connect(environment.PAYEEFSP_SDK_TESTAPI_WS_URL + '/requests/{$inputs.toIdValue}', 'payeeRequest')", + "// }" ] }, "postRequest": { "exec": [ - "if (environment.ENABLE_WS_ASSERTIONS===true) {", - " environment.payeeRequest = await websocket.getMessage('payeeRequest', environment.WS_ASSERTION_TIMEOUT)", - "}" + "// if (environment.ENABLE_WS_ASSERTIONS===true) {", + "// environment.payeeRequest = await websocket.getMessage('payeeRequest', environment.WS_ASSERTION_TIMEOUT)", + "// }", + "", + "environment.payeeRequest = (await axios.get(environment.PAYEEFSP_SDK_TESTAPI_URL + '/requests/{$inputs.toIdValue}')).data" ] } } @@ -636,16 +638,18 @@ "scripts": { "preRequest": { "exec": [ - "if (environment.ENABLE_WS_ASSERTIONS===true) {", - " await websocket.connect(environment.PAYEEFSP_SDK_TESTAPI_WS_URL + '/requests/{$request.body.quoteId}', 'payeeRequest')", - "}" + "// if (environment.ENABLE_WS_ASSERTIONS===true) {", + "// await websocket.connect(environment.PAYEEFSP_SDK_TESTAPI_WS_URL + '/requests/{$request.body.quoteId}', 'payeeRequest')", + "// }" ] }, "postRequest": { "exec": [ - "if (environment.ENABLE_WS_ASSERTIONS===true) {", - " environment.payeeRequest = await websocket.getMessage('payeeRequest', environment.WS_ASSERTION_TIMEOUT)", - "}" + "// if (environment.ENABLE_WS_ASSERTIONS===true) {", + "// environment.payeeRequest = await websocket.getMessage('payeeRequest', environment.WS_ASSERTION_TIMEOUT)", + "// }", + "", + "environment.payeeRequest = (await axios.get(environment.PAYEEFSP_SDK_TESTAPI_URL + '/requests/{$request.body.quoteId}')).data" ] } } From ae593f8d8d395a505cfb781dad603a445b265ac4 Mon Sep 17 00:00:00 2001 From: Steven Oderayi Date: Mon, 11 Dec 2023 11:12:36 +0100 Subject: [PATCH 14/16] doc: add comment for disbaling WS --- .../backward_compatibility/fspiop_protocol_validation.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/collections/hub/golden_path/feature_tests/backward_compatibility/fspiop_protocol_validation.json b/collections/hub/golden_path/feature_tests/backward_compatibility/fspiop_protocol_validation.json index 10b30f20..b6176f8a 100644 --- a/collections/hub/golden_path/feature_tests/backward_compatibility/fspiop_protocol_validation.json +++ b/collections/hub/golden_path/feature_tests/backward_compatibility/fspiop_protocol_validation.json @@ -436,6 +436,7 @@ "scripts": { "preRequest": { "exec": [ + "// NOTE: This has been commented out due to the WS issue https://github.com/mojaloop/project/issues/3164, with a work-around to call the HTTP equivalent API on the postRequest instead until it can be resolved.", "// if (environment.ENABLE_WS_ASSERTIONS===true) {", "// await websocket.connect(environment.PAYEEFSP_SDK_TESTAPI_WS_URL + '/requests/{$inputs.toIdValue}', 'payeeRequest')", "// }" @@ -443,6 +444,7 @@ }, "postRequest": { "exec": [ + "// NOTE: This has been commented out due to the WS issue https://github.com/mojaloop/project/issues/3164, with a work-around to call the HTTP equivalent API instead until it can be resolved.", "// if (environment.ENABLE_WS_ASSERTIONS===true) {", "// environment.payeeRequest = await websocket.getMessage('payeeRequest', environment.WS_ASSERTION_TIMEOUT)", "// }", @@ -638,6 +640,7 @@ "scripts": { "preRequest": { "exec": [ + "// NOTE: This has been commented out due to the WS issue https://github.com/mojaloop/project/issues/3164, with a work-around to call the HTTP equivalent API on the postRequest instead until it can be resolved.", "// if (environment.ENABLE_WS_ASSERTIONS===true) {", "// await websocket.connect(environment.PAYEEFSP_SDK_TESTAPI_WS_URL + '/requests/{$request.body.quoteId}', 'payeeRequest')", "// }" @@ -645,6 +648,7 @@ }, "postRequest": { "exec": [ + "// NOTE: This has been commented out due to the WS issue https://github.com/mojaloop/project/issues/3164, with a work-around to call the HTTP equivalent API instead until it can be resolved.", "// if (environment.ENABLE_WS_ASSERTIONS===true) {", "// environment.payeeRequest = await websocket.getMessage('payeeRequest', environment.WS_ASSERTION_TIMEOUT)", "// }", From 432cf1ee5f3db518bd6ef1637987171eb22090c2 Mon Sep 17 00:00:00 2001 From: Steven Oderayi Date: Mon, 11 Dec 2023 11:30:15 +0100 Subject: [PATCH 15/16] feat: use requestVariables where appropriate --- .../fulfil-reserved-v1.0.json | 34 ++++++++-------- .../bulk-invalid-timestamp.json | 40 +++++++++---------- .../bulk-transfer-timeout-scenario.json | 16 ++++---- .../adjust-participants-limits.json | 6 +-- 4 files changed, 48 insertions(+), 48 deletions(-) diff --git a/collections/hub/golden_path/feature_tests/transfer_negative_scenarios/fulfil-reserved-v1.0.json b/collections/hub/golden_path/feature_tests/transfer_negative_scenarios/fulfil-reserved-v1.0.json index 9d4cabaa..1f2e2639 100644 --- a/collections/hub/golden_path/feature_tests/transfer_negative_scenarios/fulfil-reserved-v1.0.json +++ b/collections/hub/golden_path/feature_tests/transfer_negative_scenarios/fulfil-reserved-v1.0.json @@ -467,21 +467,21 @@ "id": 1, "description": "Response status to be 202", "exec": [ - "expect(environment.transferResponse.code).to.equal(202)" + "expect(requestVariables.transferResponse.code).to.equal(202)" ] }, { "id": 2, "description": "Response statusText be Accepted", "exec": [ - "expect(environment.transferResponse.status).to.equal('Accepted')" + "expect(requestVariables.transferResponse.status).to.equal('Accepted')" ] }, { "id": 12, "description": "Callback Header - fspiop-source is switch", "exec": [ - "expect(environment.transferCallback.headers['fspiop-source']).to.equal('switch')", + "expect(requestVariables.transferCallback.headers['fspiop-source']).to.equal('switch')", "" ] }, @@ -489,7 +489,7 @@ "id": 13, "description": "Callback Header - fspiop-desination is fspiop-source in request", "exec": [ - "expect(environment.transferCallback.headers['fspiop-destination']).to.equal('{$inputs.fromFspId}')", + "expect(requestVariables.transferCallback.headers['fspiop-destination']).to.equal('{$inputs.fromFspId}')", "" ] }, @@ -497,7 +497,7 @@ "id": 14, "description": "Callback Header - content-type", "exec": [ - "expect(environment.transferCallback.headers['content-type']).to.equal('application/vnd.interoperability.transfers+json;version={$inputs.expectedTransfersVersion}')", + "expect(requestVariables.transferCallback.headers['content-type']).to.equal('application/vnd.interoperability.transfers+json;version={$inputs.expectedTransfersVersion}')", "" ] }, @@ -505,7 +505,7 @@ "id": 15, "description": "Callback Header - accept is empty", "exec": [ - "expect(environment.transferCallback.headers['accept']).to.equal(undefined)", + "expect(requestVariables.transferCallback.headers['accept']).to.equal(undefined)", "" ] }, @@ -513,7 +513,7 @@ "id": 16, "description": "Callback Header - Date is not empty", "exec": [ - "expect(environment.transferCallback.headers['date']).to.not.equal(undefined)", + "expect(requestVariables.transferCallback.headers['date']).to.not.equal(undefined)", "" ] }, @@ -521,7 +521,7 @@ "id": 17, "description": "Callback Header - fspiop-uri is /transfers/transferId", "exec": [ - "expect(environment.transferCallback.headers['fspiop-uri']).to.equal('/transfers/' + request.params.ID)", + "expect(requestVariables.transferCallback.headers['fspiop-uri']).to.equal('/transfers/' + request.params.ID)", "" ] }, @@ -529,7 +529,7 @@ "id": 18, "description": "Callback Header - fspiop-http-method is PUT", "exec": [ - "expect(environment.transferCallback.headers['fspiop-http-method']).to.equal('PUT')", + "expect(requestVariables.transferCallback.headers['fspiop-http-method']).to.equal('PUT')", "" ] }, @@ -537,7 +537,7 @@ "id": 21, "description": "Callback Body - transferState is ABORTED", "exec": [ - "expect(environment.transferCallback.body.transferState).to.equal('ABORTED')", + "expect(requestVariables.transferCallback.body.transferState).to.equal('ABORTED')", "" ] }, @@ -546,10 +546,10 @@ "description": "Callback Body - error cause in extensionList", "exec": [ "", - "expect(environment.transferCallback.body).to.have.property('extensionList')", - "expect(environment.transferCallback.body.extensionList).to.have.property('extension')", + "expect(requestVariables.transferCallback.body).to.have.property('extensionList')", + "expect(requestVariables.transferCallback.body.extensionList).to.have.property('extension')", "", - "const filteredExtensionListForCause = environment.transferCallback.body.extensionList.extension.filter(ext => ext.key === \"cause\")", + "const filteredExtensionListForCause = requestVariables.transferCallback.body.extensionList.extension.filter(ext => ext.key === \"cause\")", "", "expect(filteredExtensionListForCause.length).to.equal(1)", "", @@ -568,8 +568,8 @@ }, "postRequest": { "exec": [ - "environment.transferResponse = null", - "environment.transferCallback = null", + "requestVariables.transferResponse = null", + "requestVariables.transferCallback = null", "const expectedTransferState = 'ABORTED'", "", "// lets get retry config", @@ -590,8 +590,8 @@ " ", " if (isOk) {", " console.log(`Everything is OK, let's continue`)", - " environment.transferResponse = _response", - " environment.transferCallback = _callback", + " requestVariables.transferResponse = _response", + " requestVariables.transferCallback = _callback", " break;", " } else {", " console.log(`Everything is NOT OK, let's wait for ${maxRetryWait}ms, and try again...`)", diff --git a/collections/hub/other_tests/bulk_transfers/bulk-invalid-timestamp.json b/collections/hub/other_tests/bulk_transfers/bulk-invalid-timestamp.json index c9ab13dd..a0d848a2 100644 --- a/collections/hub/other_tests/bulk_transfers/bulk-invalid-timestamp.json +++ b/collections/hub/other_tests/bulk_transfers/bulk-invalid-timestamp.json @@ -343,50 +343,50 @@ "id": 1, "description": "Status code is 202", "exec": [ - "expect(environment.bulkTransferResponse.code).to.equal(202)" + "expect(requestVariables.bulkTransferResponse.code).to.equal(202)" ] }, { "id": 2, "description": "payerfsp callback - date header should be set", "exec": [ - "expect(environment.bulkTransferCallback.headers).to.have.property('date')" + "expect(requestVariables.bulkTransferCallback.headers).to.have.property('date')" ] }, { "id": 3, "description": "payerfsp callback - fspiop-source should be switch", "exec": [ - "expect(environment.bulkTransferCallback.headers['fspiop-source']).to.equal('switch')" + "expect(requestVariables.bulkTransferCallback.headers['fspiop-source']).to.equal('switch')" ] }, { "id": 4, "description": "payerfsp callback - fspiop-destination should be testingtoolkitdfsp", "exec": [ - "expect(environment.bulkTransferCallback.headers['fspiop-destination']).to.equal(environment.fromFspId)" + "expect(requestVariables.bulkTransferCallback.headers['fspiop-destination']).to.equal(environment.fromFspId)" ] }, { "id": 5, "description": "payerfsp callback - fspiop-uri should be as expected", "exec": [ - "expect(environment.bulkTransferCallback.headers['fspiop-uri']).to.equal(`/testingtoolkitdfsp/bulkTransfers/${environment.bulkTransferId}`)" + "expect(requestVariables.bulkTransferCallback.headers['fspiop-uri']).to.equal(`/testingtoolkitdfsp/bulkTransfers/${environment.bulkTransferId}`)" ] }, { "id": 6, "description": "payerfsp callback - fspiop-http-method should be PUT", "exec": [ - "expect(environment.bulkTransferCallback.headers['fspiop-http-method']).to.equal('PUT')" + "expect(requestVariables.bulkTransferCallback.headers['fspiop-http-method']).to.equal('PUT')" ] }, { "id": 8, "description": "payerfsp callback - errorInformation should be set correctly", "exec": [ - "expect(environment.bulkTransferCallback.body).to.have.property(\"bulkTransferState\")", - "expect(environment.bulkTransferCallback.body.bulkTransferState).to.equal(\"REJECTED\")" + "expect(requestVariables.bulkTransferCallback.body).to.have.property(\"bulkTransferState\")", + "expect(requestVariables.bulkTransferCallback.body.bulkTransferState).to.equal(\"REJECTED\")" ] } ] @@ -396,8 +396,8 @@ "scripts": { "postRequest": { "exec": [ - "environment.bulkTransferResponse = null", - "environment.bulkTransferCallback = null", + "requestVariables.bulkTransferResponse = null", + "requestVariables.bulkTransferCallback = null", "const expectedBulkTransferState = 'REJECTED'", "const callbackPath = `/bulkTransfers/{$environment.bulkTransferId}`", "const callbackName = 'put-bulk-transfer'", @@ -417,8 +417,8 @@ " ", " if (isOk) {", " console.log(`Everything is OK, let's continue`)", - " environment.bulkTransferResponse = _response", - " environment.bulkTransferCallback = _callback", + " requestVariables.bulkTransferResponse = _response", + " requestVariables.bulkTransferCallback = _callback", " break;", " } else {", " console.log(`Everything is NOT OK, let's wait for ${maxRetryWait}ms, and try again...`)", @@ -485,14 +485,14 @@ "id": 1, "description": "Status code is 200", "exec": [ - "expect(environment.participantsPositionResponse.code).to.equal(200)" + "expect(requestVariables.participantsPositionResponse.code).to.equal(200)" ] }, { "id": 2, "description": "Payerfsp position after Payer ABORT should be same as position before prepare.", "exec": [ - "expect(environment.participantsPositionResponse.body[0].value).to.equal(+environment.payerfspPositionBeforePrepare)" + "expect(requestVariables.participantsPositionResponse.body[0].value).to.equal(+environment.payerfspPositionBeforePrepare)" ] } ] @@ -502,7 +502,7 @@ "postRequest": { "exec": [ "const expectedStatusCode = 200;", - "environment.participantsPositionResponse = null", + "requestVariables.participantsPositionResponse = null", "", "// lets get retry config", "const maxRetryCount = Number.parseFloat(environment.RETRY_MAX_ATTEMPTS) || 20", @@ -517,7 +517,7 @@ " const isOk = _response.code === expectedStatusCode;", " ", " if (isOk) {", - " environment.participantsPositionResponse = _response", + " requestVariables.participantsPositionResponse = _response", " console.log(`Everything is OK, let's continue`)", " break;", " } else {", @@ -568,14 +568,14 @@ "id": 1, "description": "Status code is 200", "exec": [ - "expect(environment.participantsPositionResponse.code).to.equal(200)" + "expect(requestVariables.participantsPositionResponse.code).to.equal(200)" ] }, { "id": 2, "description": "Payeefsp position after Payee ABORT should be same as position before prepare.", "exec": [ - "expect(environment.participantsPositionResponse.body[0].value).to.equal(+environment.payeefspPositionBeforePrepare)" + "expect(requestVariables.participantsPositionResponse.body[0].value).to.equal(+environment.payeefspPositionBeforePrepare)" ] } ] @@ -586,7 +586,7 @@ "postRequest": { "exec": [ "const expectedStatusCode = 200;", - "environment.participantsPositionResponse = null", + "requestVariables.participantsPositionResponse = null", "", "// lets get retry config", "const maxRetryCount = Number.parseFloat(environment.RETRY_MAX_ATTEMPTS) || 20", @@ -601,7 +601,7 @@ " const isOk = _response.code === expectedStatusCode;", " ", " if (isOk) {", - " environment.participantsPositionResponse = _response", + " requestVariables.participantsPositionResponse = _response", " console.log(`Everything is OK, let's continue`)", " break;", " } else {", diff --git a/collections/hub/other_tests/bulk_transfers/bulk-transfer-timeout-scenario.json b/collections/hub/other_tests/bulk_transfers/bulk-transfer-timeout-scenario.json index 86cd72a7..20c61446 100644 --- a/collections/hub/other_tests/bulk_transfers/bulk-transfer-timeout-scenario.json +++ b/collections/hub/other_tests/bulk_transfers/bulk-transfer-timeout-scenario.json @@ -302,14 +302,14 @@ "id": 1, "description": "Status code is 200", "exec": [ - "expect(environment.participantsPositionResponse.code).to.equal(200)" + "expect(requestVariables.participantsPositionResponse.code).to.equal(200)" ] }, { "id": 2, "description": "Payerfsp position after (bulk) timeout should be same as position before prepare.", "exec": [ - "expect(environment.participantsPositionResponse.body[0].value).to.equal(+environment.payerfspPositionBeforePrepare)" + "expect(requestVariables.participantsPositionResponse.body[0].value).to.equal(+environment.payerfspPositionBeforePrepare)" ] } ] @@ -318,7 +318,7 @@ "postRequest": { "exec": [ " const expectedStatusCode = 200;", - " environment.participantsPositionResponse = null", + " requestVariables.participantsPositionResponse = null", " ", " // lets get retry config", " const maxRetryCount = Number.parseFloat(environment.RETRY_MAX_ATTEMPTS) || 20", @@ -333,7 +333,7 @@ " const isOk = _response.code === expectedStatusCode && _response.body[0].value === (+environment.payerfspPositionBeforePrepare)", " ", " if (isOk) {", - " environment.participantsPositionResponse = _response", + " requestVariables.participantsPositionResponse = _response", " console.log(`Everything is OK, let's continue`)", " break;", " } else {", @@ -384,14 +384,14 @@ "id": 1, "description": "Status code is 200", "exec": [ - "expect(environment.participantsPositionResponse.code).to.equal(200)" + "expect(requestVariables.participantsPositionResponse.code).to.equal(200)" ] }, { "id": 2, "description": "Payeefsp position after timeout should be same as position before prepare.", "exec": [ - "expect(environment.participantsPositionResponse.body[0].value).to.equal(+environment.payeefspPositionBeforePrepare)" + "expect(requestVariables.participantsPositionResponse.body[0].value).to.equal(+environment.payeefspPositionBeforePrepare)" ] } ] @@ -401,7 +401,7 @@ "postRequest": { "exec": [ " const expectedStatusCode = 200;", - " environment.participantsPositionResponse = null", + " requestVariables.participantsPositionResponse = null", " ", " // lets get retry config", " const maxRetryCount = Number.parseFloat(environment.RETRY_MAX_ATTEMPTS) || 20", @@ -416,7 +416,7 @@ " const isOk = _response.code === expectedStatusCode && _response.body[0].value === (+environment.payeefspPositionBeforePrepare)", " ", " if (isOk) {", - " environment.participantsPositionResponse = _response", + " requestVariables.participantsPositionResponse = _response", " console.log(`Everything is OK, let's continue`)", " break;", " } else {", diff --git a/collections/hub/provisioning/CGS_Specific/adjust-participants-limits.json b/collections/hub/provisioning/CGS_Specific/adjust-participants-limits.json index 8fa3b82f..7cac5a30 100644 --- a/collections/hub/provisioning/CGS_Specific/adjust-participants-limits.json +++ b/collections/hub/provisioning/CGS_Specific/adjust-participants-limits.json @@ -32,7 +32,7 @@ "id": 1, "description": "response code 200", "exec": [ - "const statusCode = environment.participantLimitsResponseCode", + "const statusCode = requestVariables.participantLimitsResponseCode", "expect(statusCode).to.equal(200)" ] } @@ -44,7 +44,7 @@ "postRequest": { "exec": [ "const expectedStatusCode = 200;", - "environment.participantLimitsResponseCode = null", + "requestVariables.participantLimitsResponseCode = null", "", "// lets get retry config", "const maxRetryCount = Number.parseFloat(environment.RETRY_MAX_ATTEMPTS) || 20", @@ -59,7 +59,7 @@ " const isOk = statusCode === expectedStatusCode;", " ", " if (isOk) {", - " environment.participantLimitsResponseCode = statusCode", + " requestVariables.participantLimitsResponseCode = statusCode", " console.log(`Everything is OK, let's continue`)", " break;", " } else {", From 25b5fcfb66205c2465391fc1176fbd46011f8c23 Mon Sep 17 00:00:00 2001 From: Steven Oderayi Date: Mon, 11 Dec 2023 14:22:19 +0100 Subject: [PATCH 16/16] fix: revert labels --- .../bulk/basic/bulk-happy-path.json | 10 ++++-- .../bulk/basic/bulk-high-volume_dynamic.json | 5 ++- .../bulk/basic/bulk-parties-error-cases.json | 30 ++++++++++++---- .../bulk/basic/bulk-quotes-error-cases.json | 35 +++++++++++++++---- .../bulk/basic/bulk-sdk-warm-up.json | 10 ++++-- .../basic/bulk-transfers-error-cases.json | 20 ++++++++--- 6 files changed, 88 insertions(+), 22 deletions(-) diff --git a/collections/hub/sdk_scheme_adapter/bulk/basic/bulk-happy-path.json b/collections/hub/sdk_scheme_adapter/bulk/basic/bulk-happy-path.json index ec3ec55e..1f93f7fa 100644 --- a/collections/hub/sdk_scheme_adapter/bulk/basic/bulk-happy-path.json +++ b/collections/hub/sdk_scheme_adapter/bulk/basic/bulk-happy-path.json @@ -5,7 +5,10 @@ "id": 1, "name": "TC-BHP1. When there are 4 transfers in the bulk request 2 of which that have the same receiver fsp id and the others has a different receiver fsp id and acceptParty is true for all the transfers, Then the PUT response should have details of all the 4 transfers.", "fileInfo": { - "path": "hub/sdk_scheme_adapter/bulk/basic/bulk-happy-path.json" + "path": "hub/sdk_scheme_adapter/bulk/basic/bulk-happy-path.json", + "labels": [ + "basic" + ] }, "requests": [ { @@ -593,7 +596,10 @@ "id": 2, "name": "TC-BHP3. When the incoming request has a format issue that fails schema validation, Then the return code should be 400 instead of 202", "fileInfo": { - "path": "hub/sdk_scheme_adapter/bulk/basic/bulk-happy-path.json" + "path": "hub/sdk_scheme_adapter/bulk/basic/bulk-happy-path.json", + "labels": [ + "basic" + ] }, "requests": [ { diff --git a/collections/hub/sdk_scheme_adapter/bulk/basic/bulk-high-volume_dynamic.json b/collections/hub/sdk_scheme_adapter/bulk/basic/bulk-high-volume_dynamic.json index 459ff935..46c3e048 100644 --- a/collections/hub/sdk_scheme_adapter/bulk/basic/bulk-high-volume_dynamic.json +++ b/collections/hub/sdk_scheme_adapter/bulk/basic/bulk-high-volume_dynamic.json @@ -405,7 +405,10 @@ } ], "fileInfo": { - "path": "hub/sdk_scheme_adapter/bulk/basic/bulk-high-volume_dynamic.json" + "path": "hub/sdk_scheme_adapter/bulk/basic/bulk-high-volume_dynamic.json", + "labels": [ + "basic" + ] } } ] diff --git a/collections/hub/sdk_scheme_adapter/bulk/basic/bulk-parties-error-cases.json b/collections/hub/sdk_scheme_adapter/bulk/basic/bulk-parties-error-cases.json index f73e416f..6e5eafa1 100644 --- a/collections/hub/sdk_scheme_adapter/bulk/basic/bulk-parties-error-cases.json +++ b/collections/hub/sdk_scheme_adapter/bulk/basic/bulk-parties-error-cases.json @@ -5,7 +5,10 @@ "id": 1, "name": "TC-BP1. When the request has a receiver-id that does not exist in payee fsp, Then the payer fsp backend should receive an ID not found as error message in the PUT callback response.", "fileInfo": { - "path": "hub/sdk_scheme_adapter/bulk/basic/bulk-parties-error-cases.json" + "path": "hub/sdk_scheme_adapter/bulk/basic/bulk-parties-error-cases.json", + "labels": [ + "basic" + ] }, "requests": [ { @@ -104,7 +107,10 @@ "id": 2, "name": "TC-BP2. When the receiver fsp responds after the timeout elapses, Then the payer fsp should receive an timed-out as error message.", "fileInfo": { - "path": "hub/sdk_scheme_adapter/bulk/basic/bulk-parties-error-cases.json" + "path": "hub/sdk_scheme_adapter/bulk/basic/bulk-parties-error-cases.json", + "labels": [ + "basic" + ] }, "requests": [ { @@ -217,7 +223,10 @@ "id": 3, "name": "TC-BP3. Given skipPartyLookup is set to false, When the incoming request has receiver info already populated, Then party lookup should be skipped.", "fileInfo": { - "path": "hub/sdk_scheme_adapter/bulk/basic/bulk-parties-error-cases.json" + "path": "hub/sdk_scheme_adapter/bulk/basic/bulk-parties-error-cases.json", + "labels": [ + "basic" + ] }, "requests": [ { @@ -310,7 +319,10 @@ "id": 4, "name": "TC-BP4. Given there are 2 transfers in the bulk request, When one transfer has a succesful party lookup and the other has a failure, Then the PUT response should have details about both the transfers.", "fileInfo": { - "path": "hub/sdk_scheme_adapter/bulk/basic/bulk-parties-error-cases.json" + "path": "hub/sdk_scheme_adapter/bulk/basic/bulk-parties-error-cases.json", + "labels": [ + "basic" + ] }, "requests": [ { @@ -470,7 +482,10 @@ "id": 5, "name": "TC-BP5. Given there are 2 transfers in the bulk request, When one transfer has a succesful party lookup and the other has a timeout, Then the PUT response should have details about both the transfers.", "fileInfo": { - "path": "hub/sdk_scheme_adapter/bulk/basic/bulk-parties-error-cases.json" + "path": "hub/sdk_scheme_adapter/bulk/basic/bulk-parties-error-cases.json", + "labels": [ + "basic" + ] }, "requests": [ { @@ -631,7 +646,10 @@ "id": 6, "name": "TC-BP6. Given there are 2 transfers in the bulk request, When both the transfers have a timeout, Then the PUT response should have timeout details about both the transfers.", "fileInfo": { - "path": "hub/sdk_scheme_adapter/bulk/basic/bulk-parties-error-cases.json" + "path": "hub/sdk_scheme_adapter/bulk/basic/bulk-parties-error-cases.json", + "labels": [ + "basic" + ] }, "requests": [ { diff --git a/collections/hub/sdk_scheme_adapter/bulk/basic/bulk-quotes-error-cases.json b/collections/hub/sdk_scheme_adapter/bulk/basic/bulk-quotes-error-cases.json index 84756624..72c5ec97 100644 --- a/collections/hub/sdk_scheme_adapter/bulk/basic/bulk-quotes-error-cases.json +++ b/collections/hub/sdk_scheme_adapter/bulk/basic/bulk-quotes-error-cases.json @@ -5,7 +5,10 @@ "id": 1, "name": "TC-BQ1. Given party lookup is skipped and bulk quotes request is submitted, When receiver fsp fails the entire batch and sends the error, Then the PUT response should have error details about the transfer.", "fileInfo": { - "path": "hub/sdk_scheme_adapter/bulk/basic/bulk-quotes-error-cases.json" + "path": "hub/sdk_scheme_adapter/bulk/basic/bulk-quotes-error-cases.json", + "labels": [ + "basic" + ] }, "requests": [ { @@ -190,7 +193,10 @@ "id": 2, "name": "TC-BQ2. Given party lookup is skipped and bulk quotes request is submitted, When receiver fsp times out while sending bulk quotes reponse, Then the PUT response should have error details about timeout.", "fileInfo": { - "path": "hub/sdk_scheme_adapter/bulk/basic/bulk-quotes-error-cases.json" + "path": "hub/sdk_scheme_adapter/bulk/basic/bulk-quotes-error-cases.json", + "labels": [ + "basic" + ] }, "requests": [ { @@ -347,7 +353,10 @@ "id": 3, "name": "TC-BQ3. Given there are 2 transfers in the bulk request and acceptParty is true for both the transfers, When the receiver fsp sends success response for first quote and failure for the second quote, Then the PUT response should have details of success and failure for both the quotes.", "fileInfo": { - "path": "hub/sdk_scheme_adapter/bulk/basic/bulk-quotes-error-cases.json" + "path": "hub/sdk_scheme_adapter/bulk/basic/bulk-quotes-error-cases.json", + "labels": [ + "basic" + ] }, "requests": [ { @@ -559,7 +568,10 @@ "id": 5, "name": "TC-BQ5. Given there are 2 transfers in the bulk request, When the sender fsp sends the acceptParty:true for 1 transfer and acceptParty:false for the second transfer, Then the PUT response should have details of the 1 quote for which the acceptParty:true response was sent.", "fileInfo": { - "path": "hub/sdk_scheme_adapter/bulk/basic/bulk-quotes-error-cases.json" + "path": "hub/sdk_scheme_adapter/bulk/basic/bulk-quotes-error-cases.json", + "labels": [ + "basic" + ] }, "requests": [ { @@ -758,7 +770,10 @@ "id": 9, "name": "TC-BQ9. Given the transfers in the bulk request have 2 different receiver fsp ids, When one of the receivers sends an error, Then the PUT response should have details of the 2 transfers with success and failure details.", "fileInfo": { - "path": "hub/sdk_scheme_adapter/bulk/basic/bulk-quotes-error-cases.json" + "path": "hub/sdk_scheme_adapter/bulk/basic/bulk-quotes-error-cases.json", + "labels": [ + "basic" + ] }, "requests": [ { @@ -985,7 +1000,10 @@ "id": 10, "name": "TC-BQ10. Given the transfers in the bulk request have 2 different receiver fsp ids, When both of the receivers sends an error, Then the PUT response should have details of failure details of all the 4 transfers.", "fileInfo": { - "path": "hub/sdk_scheme_adapter/bulk/basic/bulk-quotes-error-cases.json" + "path": "hub/sdk_scheme_adapter/bulk/basic/bulk-quotes-error-cases.json", + "labels": [ + "basic" + ] }, "requests": [ { @@ -1251,7 +1269,10 @@ "id": 11, "name": "TC-BQ11. Given there are 2 transfers in the bulk request with different receiver fsp ids, When one of the receivers timesout, Then the PUT response should have details of the 2 transfers with success and timeout details.", "fileInfo": { - "path": "hub/sdk_scheme_adapter/bulk/basic/bulk-quotes-error-cases.json" + "path": "hub/sdk_scheme_adapter/bulk/basic/bulk-quotes-error-cases.json", + "labels": [ + "basic" + ] }, "requests": [ { diff --git a/collections/hub/sdk_scheme_adapter/bulk/basic/bulk-sdk-warm-up.json b/collections/hub/sdk_scheme_adapter/bulk/basic/bulk-sdk-warm-up.json index 792968ee..0d264bbf 100644 --- a/collections/hub/sdk_scheme_adapter/bulk/basic/bulk-sdk-warm-up.json +++ b/collections/hub/sdk_scheme_adapter/bulk/basic/bulk-sdk-warm-up.json @@ -217,7 +217,10 @@ } ], "fileInfo": { - "path": "hub/sdk_scheme_adapter/bulk/basic/bulk-sdk-warm-up.json" + "path": "hub/sdk_scheme_adapter/bulk/basic/bulk-sdk-warm-up.json", + "labels": [ + "basic" + ] } }, { @@ -436,7 +439,10 @@ } ], "fileInfo": { - "path": "hub/sdk_scheme_adapter/bulk/basic/bulk-sdk-warm-up.json" + "path": "hub/sdk_scheme_adapter/bulk/basic/bulk-sdk-warm-up.json", + "labels": [ + "basic" + ] } } ] diff --git a/collections/hub/sdk_scheme_adapter/bulk/basic/bulk-transfers-error-cases.json b/collections/hub/sdk_scheme_adapter/bulk/basic/bulk-transfers-error-cases.json index 78552774..8b46d896 100644 --- a/collections/hub/sdk_scheme_adapter/bulk/basic/bulk-transfers-error-cases.json +++ b/collections/hub/sdk_scheme_adapter/bulk/basic/bulk-transfers-error-cases.json @@ -5,7 +5,10 @@ "id": 1, "name": "TC-BT1. Given partyLookup is skipped And there are 2 transfers with the same receiver fspid in the request and acceptParty, acceptQuote is true for both the requests, When the receiver fsp fails the entire transfer batch, Then the callback response should have the party and quote results and a failure for transfer", "fileInfo": { - "path": "hub/sdk_scheme_adapter/bulk/basic/bulk-transfers-error-cases.json" + "path": "hub/sdk_scheme_adapter/bulk/basic/bulk-transfers-error-cases.json", + "labels": [ + "basic" + ] }, "requests": [ { @@ -309,7 +312,10 @@ "id": 2, "name": "TC-BT2. Given partyLookup is skipped And there are 2 transfers with the same receiver fspid in the request and acceptParty, acceptQuote is true for both the requests, When the receiver fsp times out the entire transfer batch, Then the callback response should have the party and quote results and time out failure for transfer", "fileInfo": { - "path": "hub/sdk_scheme_adapter/bulk/basic/bulk-transfers-error-cases.json" + "path": "hub/sdk_scheme_adapter/bulk/basic/bulk-transfers-error-cases.json", + "labels": [ + "basic" + ] }, "requests": [ { @@ -591,7 +597,10 @@ "id": 10, "name": "TC-BT10. Given partyLookup is skipped And there are 2 transfers with the different receiver fspid in the request and acceptParty, acceptQuote is true for both the requests, When one of the receiver fsp fails the entire transfer batch, while the other receiving fsp sends succesful reponse, Then the callback response should have the party, quote, transfer results for the batch that sends success response and only party and quote result for the batch that is failed.", "fileInfo": { - "path": "hub/sdk_scheme_adapter/bulk/basic/bulk-transfers-error-cases.json" + "path": "hub/sdk_scheme_adapter/bulk/basic/bulk-transfers-error-cases.json", + "labels": [ + "basic" + ] }, "requests": [ { @@ -892,7 +901,10 @@ "id": 11, "name": "TC-BT11. Given partyLookup is skipped And there are 2 transfers with the different receiver fspid in the request and acceptParty, acceptQuote is true for both the requests, When one of the receiver fsp fails the entire transfer batch, while the other receiving fsp sends succesful reponse, Then the callback response should have the party, quote, transfer results for the batch that sends success response and only party and quote result for the batch that is failed.", "fileInfo": { - "path": "hub/sdk_scheme_adapter/bulk/basic/bulk-transfers-error-cases.json" + "path": "hub/sdk_scheme_adapter/bulk/basic/bulk-transfers-error-cases.json", + "labels": [ + "basic" + ] }, "requests": [ {