From 60820f5b599f71d0b7106e8cece87b0565cea7df Mon Sep 17 00:00:00 2001 From: Kevin Leyow Date: Fri, 27 Oct 2023 12:28:00 -0500 Subject: [PATCH] feat(mojaloop/#3591): add setup for e2e testing (#41) * chore: add setup for e2e testing * chore: remove collection * chore: fix timestamps --- README.md | 26 ++ docker-compose-perf.yml | 25 ++ .../collections/provisioning/hub_setup.json | 2 +- .../test-cases/environments/perf-e2e-env.json | 75 +++++ packages/k6-tests/config/fspiopE2E.json | 21 ++ packages/k6-tests/index.js | 1 + packages/k6-tests/scenarios/fspiopE2E.js | 6 + packages/k6-tests/scripts/E2E.js | 279 ++++++++++++++++++ perf.env | 5 + 9 files changed, 439 insertions(+), 1 deletion(-) create mode 100644 docker/ml-testing-toolkit/test-cases/environments/perf-e2e-env.json create mode 100644 packages/k6-tests/config/fspiopE2E.json create mode 100644 packages/k6-tests/scenarios/fspiopE2E.js create mode 100644 packages/k6-tests/scripts/E2E.js diff --git a/README.md b/README.md index 76a7f130..8ddfb227 100644 --- a/README.md +++ b/README.md @@ -226,6 +226,23 @@ docker compose --project-name ml-core -f docker-compose-perf.yml --profile quote > NOTE: `-v` argument is optional, and it will delete any volume data created by the monitoring docker compose +### Running Services for Full E2E (Discovery+Agreement+Transfers) characterization + +- Set `ALS_SWITCH_ENDPOINT` to "http://central-ledger:3001" in perf.env +- Set `QS_SWITCH_ENDPOINT` to "http://central-ledger:3001" in perf.env + +```bash +docker compose --project-name ml-core -f docker-compose-perf.yml --profile all-services --profile 8dfsp --profile ttk-provisioning-e2e up -d +``` + +Stop Services + +```bash +docker compose --project-name ml-core -f docker-compose-perf.yml --profile all-services --profile 8dfsp down -v +``` + +> NOTE: `-v` argument is optional, and it will delete any volume data created by the monitoring docker compose + ### Configuration for Transfers with batch support - Set CENTRAL_LEDGER_POSITION_BATCH_REPLICAS to desired count in `.env` file - Enable line `CLEDG_KAFKA__EVENT_TYPE_ACTION_TOPIC_MAP__POSITION__PREPARE=topic-transfer-position-batch` in `perf.env` file @@ -270,6 +287,13 @@ docker compose --project-name monitoring --profile quotes-test -f docker-compose since the quoting service uses the central ledger database. +Start monitoring with all exporters + +```bash +docker compose --project-name monitoring --profile als-test --profile quotes-test --profile transfers-test -f docker-compose-monitoring.yml up -d +``` + + > NOTE: `-v` argument is optional, and it will delete any volume data created by the monitoring docker compose TODO: @@ -313,6 +337,8 @@ env K6_SCRIPT_CONFIG_FILE_NAME=fspiopTransfersUnidirectional.json docker compose env K6_SCRIPT_CONFIG_FILE_NAME=fspiopDiscovery.json docker compose --project-name load -f docker-compose-load.yml up ( or ) env K6_SCRIPT_CONFIG_FILE_NAME=fspiopQuotes.json docker compose --project-name load -f docker-compose-load.yml up +( or ) +env K6_SCRIPT_CONFIG_FILE_NAME=fspiopE2E.json docker compose --project-name load -f docker-compose-load.yml up ``` Cleanup tests diff --git a/docker-compose-perf.yml b/docker-compose-perf.yml index 72fa88fd..f7596f5e 100644 --- a/docker-compose-perf.yml +++ b/docker-compose-perf.yml @@ -499,6 +499,7 @@ services: interval: 15s user: root profiles: + - all-services - quotes-test # objstore: @@ -846,6 +847,30 @@ services: profiles: - ttk-provisioning-quotes + ttk-provisioning-e2e: + image: mojaloop/ml-testing-toolkit-client-lib:${TEST_TTK_CLI_VERSION} + env_file: + - .env + - perf.env + volumes: + - "./docker/ml-testing-toolkit/test-cases/collections:/opt/app/collections" + - "./docker/ml-testing-toolkit/test-cases/environments:/opt/app/environments" + - "./reports:/opt/app/reports" + depends_on: + mojaloop-testing-toolkit: + condition: service_healthy + central-ledger: + condition: service_healthy + networks: + - mojaloop-net + command: + - sh + - -c + - "npm run cli -- -u http://mojaloop-testing-toolkit:5050 -l 2 -i collections/provisioning -e environments/perf-e2e-env.json --save-report --report-format html --report-target file://reports/ttk-provisioning-report.html" + user: root + profiles: + - ttk-provisioning-e2e + callback-handler-svc-oracle-sim: image: mojaloop/callback-handler-svc:${TEST_CALLBACK_HAND_SVC_VERSION} deploy: diff --git a/docker/ml-testing-toolkit/test-cases/collections/provisioning/hub_setup.json b/docker/ml-testing-toolkit/test-cases/collections/provisioning/hub_setup.json index 6c7474f1..a5d91e5f 100644 --- a/docker/ml-testing-toolkit/test-cases/collections/provisioning/hub_setup.json +++ b/docker/ml-testing-toolkit/test-cases/collections/provisioning/hub_setup.json @@ -699,4 +699,4 @@ ] } ] -} \ No newline at end of file +} diff --git a/docker/ml-testing-toolkit/test-cases/environments/perf-e2e-env.json b/docker/ml-testing-toolkit/test-cases/environments/perf-e2e-env.json new file mode 100644 index 00000000..2c03e8ca --- /dev/null +++ b/docker/ml-testing-toolkit/test-cases/environments/perf-e2e-env.json @@ -0,0 +1,75 @@ +{ + "inputValues": { + "CALLBACK_ENDPOINT_BASE_URL": "http://mojaloop-testing-toolkit:4040", + "HOST_ACCOUNT_LOOKUP_ADMIN": "http://account-lookup-service:4001", + "HOST_ACCOUNT_LOOKUP_SERVICE": "http://account-lookup-service:4002", + "HOST_CENTRAL_LEDGER": "http://central-ledger:3001", + "HOST_ML_API_ADAPTER": "http://ml-api-adapter:3000", + "HOST_QUOTING_SERVICE": "http://quoting-service:3002", + "HOST_SIMULATOR": "http://callback-handler-svc-oracle-sim:3001", + "ENABLE_WS_ASSERTIONS": true, + "WS_ASSERTION_TIMEOUT": 5000, + "accept": "application/vnd.interoperability.parties+json;version=1.0", + "acceptParticipants": "application/vnd.interoperability.participants+json;version=1.0", + "acceptQuotes": "application/vnd.interoperability.quotes+json;version=1.0", + "acceptTransfers": "application/vnd.interoperability.transfers+json;version=1.0", + "amount": "100", + "condition": "n2cwS3w4ekGlvNYoXg2uBAqssu3FCoXjADE2mziU5jU", + "contentType": "application/vnd.interoperability.parties+json;version=1.0", + "contentTypeParticipants": "application/vnd.interoperability.participants+json;version=1.0", + "contentTypeQuotes": "application/vnd.interoperability.quotes+json;version=1.0", + "currency": "USD", + "currency2": "BGN", + "cgscurrency": "INR", + "fromDOB": "1984-01-01", + "fromFirstName": "Firstname-Test", + "fromFspId": "pinkbankfsp", + "fromIdType": "MSISDN", + "fromIdValue": "44123456789", + "fromLastName": "Lastname-Test", + "hubEmail": "some.email@gmail.com", + "hub_operator": "NOT_APPLICABLE", + "ilpPacket": "AYIDBQAAAAAAACcQJGcucGF5ZWVmc3AubXNpc2RuLnt7cmVjZWl2ZXJtc2lzZG59fYIC1GV5SjBjbUZ1YzJGamRHbHZia2xrSWpvaVptVXhNREU0Wm1NdE1EaGxZeTAwWWpJM0xUbGpZalF0TnpjMk9URTFNR00zT1dKaklpd2ljWFZ2ZEdWSlpDSTZJbVpsTVRBeE9HWmpMVEE0WldNdE5HSXlOeTA1WTJJMExUYzNOamt4TlRCak56bGlZeUlzSW5CaGVXVmxJanA3SW5CaGNuUjVTV1JKYm1adklqcDdJbkJoY25SNVNXUlVlWEJsSWpvaVRWTkpVMFJPSWl3aWNHRnlkSGxKWkdWdWRHbG1hV1Z5SWpvaWUzdHlaV05sYVhabGNrMVRTVk5FVG4xOUlpd2labk53U1dRaU9pSndZWGxsWldaemNDSjlmU3dpY0dGNVpYSWlPbnNpY0dGeWRIbEpaRWx1Wm04aU9uc2ljR0Z5ZEhsSlpGUjVjR1VpT2lKTlUwbFRSRTRpTENKd1lYSjBlVWxrWlc1MGFXWnBaWElpT2lJeU56Y3hNemd3TXprd05TSXNJbVp6Y0Vsa0lqb2ljR0Y1WlhKbWMzQWlmU3dpY0dWeWMyOXVZV3hKYm1adklqcDdJbU52YlhCc1pYaE9ZVzFsSWpwN0ltWnBjbk4wVG1GdFpTSTZJazFoZEhNaUxDSnNZWE4wVG1GdFpTSTZJa2hoWjIxaGJpSjlMQ0prWVhSbFQyWkNhWEowYUNJNklqRTVPRE10TVRBdE1qVWlmWDBzSW1GdGIzVnVkQ0k2ZXlKaGJXOTFiblFpT2lJeE1EQWlMQ0pqZFhKeVpXNWplU0k2SWxWVFJDSjlMQ0owY21GdWMyRmpkR2x2YmxSNWNHVWlPbnNpYzJObGJtRnlhVzhpT2lKVVVrRk9VMFpGVWlJc0ltbHVhWFJwWVhSdmNpSTZJbEJCV1VWU0lpd2lhVzVwZEdsaGRHOXlWSGx3WlNJNklrTlBUbE5WVFVWU0luMTkA", + "note": "test", + "payeefsp": "greenbankfsp", + "payerfsp": "pinkbankfsp", + "toFspId": "greenbankfsp", + "toIdType": "MSISDN", + "toIdValue": "27713803912", + "mobileSimPayerFsp": "pinkbankfsp", + "mobileSimPayeeFsp": "greenbankfsp", + "expectedPartiesVersion": "1.0", + "expectedParticipantsVersion": "1.0", + "expectedQuotesVersion": "1.0", + "expectedTransfersVersion": "1.0", + "acceptParties": "application/vnd.interoperability.parties+json;version=1.1", + "contentTypeTransfers": "application/vnd.interoperability.transfers+json;version=1.1", + "contentTypeParties": "application/vnd.interoperability.parties+json;version=1.1", + "NET_DEBIT_CAP": "50000000", + "PERF_FSP1_ID": "perffsp1", + "PERF_FSP2_ID": "perffsp2", + "PERF_FSP3_ID": "perffsp3", + "PERF_FSP4_ID": "perffsp4", + "PERF_FSP5_ID": "perffsp5", + "PERF_FSP6_ID": "perffsp6", + "PERF_FSP7_ID": "perffsp7", + "PERF_FSP8_ID": "perffsp8", + "PERF_FSP1_MSISDN": "19012345001", + "PERF_FSP2_MSISDN": "19012345002", + "PERF_FSP3_MSISDN": "19012345003", + "PERF_FSP4_MSISDN": "19012345004", + "PERF_FSP5_MSISDN": "19012345005", + "PERF_FSP6_MSISDN": "19012345006", + "PERF_FSP7_MSISDN": "19012345007", + "PERF_FSP8_MSISDN": "19012345008", + "PERF_FSP1_CALLBACK_ENDPOINT_BASE_URL": "http://sim-perffsp1:3001/fspiop", + "PERF_FSP2_CALLBACK_ENDPOINT_BASE_URL": "http://sim-perffsp2:3001/fspiop", + "PERF_FSP3_CALLBACK_ENDPOINT_BASE_URL": "http://sim-perffsp3:3001/fspiop", + "PERF_FSP4_CALLBACK_ENDPOINT_BASE_URL": "http://sim-perffsp4:3001/fspiop", + "PERF_FSP5_CALLBACK_ENDPOINT_BASE_URL": "http://sim-perffsp5:3001/fspiop", + "PERF_FSP6_CALLBACK_ENDPOINT_BASE_URL": "http://sim-perffsp6:3001/fspiop", + "PERF_FSP7_CALLBACK_ENDPOINT_BASE_URL": "http://sim-perffsp7:3001/fspiop", + "PERF_FSP8_CALLBACK_ENDPOINT_BASE_URL": "http://sim-perffsp8:3001/fspiop", + "PERF_ORACLE_ENDPOINT_BASE_URL": "http://callback-handler-svc-oracle-sim:3001/oracle" + } +} diff --git a/packages/k6-tests/config/fspiopE2E.json b/packages/k6-tests/config/fspiopE2E.json new file mode 100644 index 00000000..ebc432be --- /dev/null +++ b/packages/k6-tests/config/fspiopE2E.json @@ -0,0 +1,21 @@ +{ + "scenarios": { + "fspiopE2E": { + "executor": "ramping-vus", + "exec": "fspiopE2EScenarios", + "env": { + "UNIDIRECTIONAL": "false" + }, + "startVUs": 1, + "stages": [ + { "duration": "30s", "target": 30 }, + { "duration": "5m", "target": 30 } + ] + } + }, + "thresholds": { + "iteration_duration": [ "p(95)<1000" ], + "http_req_failed": [ "rate<0.01" ], + "http_req_duration": [ "p(95)<1000" ] + } +} diff --git a/packages/k6-tests/index.js b/packages/k6-tests/index.js index b5a51388..8ac741c0 100644 --- a/packages/k6-tests/index.js +++ b/packages/k6-tests/index.js @@ -3,6 +3,7 @@ export { fspiopTransfersScenarios } from './scenarios/fspiopTransfers.js'; export { fspiopTransfersNoCallbackScenarios } from './scenarios/fspiopTransfersNoCallback.js'; export { fspiopQuotesScenarios } from './scenarios/fspiopQuotes.js'; export { fspiopQuotesPersonalInfoExtensionsScenarios } from './scenarios/fspiopQuotesPersonalInfoExtensions.js'; +export { fspiopE2EScenarios } from './scenarios/fspiopE2E.js'; const configFile = __ENV.K6_SCRIPT_CONFIG_FILE_NAME ? './config/' + __ENV.K6_SCRIPT_CONFIG_FILE_NAME : './config/test.json'; const testConfig = JSON.parse(open(configFile)); diff --git a/packages/k6-tests/scenarios/fspiopE2E.js b/packages/k6-tests/scenarios/fspiopE2E.js new file mode 100644 index 00000000..a01b3d7c --- /dev/null +++ b/packages/k6-tests/scenarios/fspiopE2E.js @@ -0,0 +1,6 @@ +import { E2E } from "../scripts/E2E.js"; + + +export function fspiopE2EScenarios() { + E2E(); +} diff --git a/packages/k6-tests/scripts/E2E.js b/packages/k6-tests/scripts/E2E.js new file mode 100644 index 00000000..e5113901 --- /dev/null +++ b/packages/k6-tests/scripts/E2E.js @@ -0,0 +1,279 @@ +import http from 'k6/http'; +import { check, group } from 'k6'; +import { crypto } from "k6/experimental/webcrypto"; +import { WebSocket } from 'k6/experimental/websockets'; +import { setTimeout, clearTimeout } from 'k6/experimental/timers'; +import { Trace } from "../common/trace.js"; +import { getTwoItemsFromArray } from "../common/utils.js"; +import exec from 'k6/execution'; + +console.log(`Env Vars --> + K6_SCRIPT_WS_TIMEOUT_MS=${__ENV.K6_SCRIPT_WS_TIMEOUT_MS}, + K6_SCRIPT_FSPIOP_ALS_ENDPOINT_URL=${__ENV.K6_SCRIPT_FSPIOP_ALS_ENDPOINT_URL}, + K6_SCRIPT_ADMIN_ENDPOINT_URL=${__ENV.K6_SCRIPT_ADMIN_ENDPOINT_URL}, + K6_SCRIPT_ORACLE_ENDPOINT_URL=${__ENV.K6_SCRIPT_ORACLE_ENDPOINT_URL}, + K6_SCRIPT_FSPIOP_FSP_POOL=${__ENV.K6_SCRIPT_FSPIOP_FSP_PAYER_POOL} +`); + +const fspList = JSON.parse(__ENV.K6_SCRIPT_FSPIOP_FSP_POOL) +const ilpPacket = __ENV.K6_SCRIPT_FSPIOP_TRANSFERS_ILPPACKET +const condition = __ENV.K6_SCRIPT_FSPIOP_TRANSFERS_CONDITION +const amount = __ENV.K6_SCRIPT_FSPIOP_TRANSFERS_AMOUNT.toString() +const currency = __ENV.K6_SCRIPT_FSPIOP_TRANSFERS_CURRENCY +const abortOnError = (__ENV.K6_SCRIPT_ABORT_ON_ERROR && __ENV.K6_SCRIPT_ABORT_ON_ERROR.toLowerCase() === 'true') ? true : false + +export function E2E() { + group("E2E", function () { + let payerFsp + let payeeFsp + + if (__ENV.UNIDIRECTIONAL === "true" || __ENV.UNIDIRECTIONAL === "TRUE") { + payerFsp = fspList[0] + payeeFsp = fspList[1] + } else { + const selectedFsps = getTwoItemsFromArray(fspList) + payerFsp = selectedFsps[0] + payeeFsp = selectedFsps[1] + } + + const startTsParties = Date.now(); + const payeeId = payeeFsp['partyId']; + const payerFspId = payerFsp['fspId']; + const payeeFspId = payeeFsp['fspId']; + const wsUrl = payerFsp['wsUrl']; + const traceParent = Trace(); + const traceId = traceParent.traceId; + const wsTimeoutMs = Number(__ENV.K6_SCRIPT_WS_TIMEOUT_MS) || 2000; // user session between 5s and 1m + + const wsChannelParties = `${traceParent.traceId}/PUT/parties/MSISDN/${payeeId}`; + const wsURLParties = `${wsUrl}/${wsChannelParties}` + const wsParties = new WebSocket(wsURLParties); + + var wsTimeoutId = null; + + const clearTimersParties = () => { + if (wsTimeoutId) { clearTimeout(wsTimeoutId); wsTimeoutId=null } + } + + wsParties.onclose(() => { + clearTimersParties(); + }); + + wsParties.onerror((err) => { + console.error(traceId, err); + check(err, { 'ALS_E2E_FSPIOP_GET_PARTIES_SUCCESS': (cbMessage) => false }); + clearTimersParties(); + wsParties.close(); + }); + + wsParties.onmessage = (event) => { + console.info(traceId, `WS message received [${wsChannelParties}]: ${event.data}`); + check(event.data, { 'ALS_E2E_FSPIOP_GET_PARTIES_SUCCESS': (cbMessage) => cbMessage == 'SUCCESS_CALLBACK_RECEIVED' }); + clearTimersParties(); + wsParties.close(); + + const startTsQuotes = Date.now(); + const quoteId = crypto.randomUUID(); + const transactionId = crypto.randomUUID(); + const wsChannelQuotes = `${traceParent.traceId}/PUT/quotes/${quoteId}`; + const wsURLQuotes = `${wsUrl}/${wsChannelQuotes}` + const wsQuotes = new WebSocket(wsURLQuotes); + + var wsTimeoutId = null; + + const clearTimersQuotes = () => { + if (wsTimeoutId) { clearTimeout(wsTimeoutId); wsTimeoutId=null } + } + + wsQuotes.onclose(() => { + clearTimersQuotes(); + }); + + wsQuotes.onerror((err) => { + console.error(traceId, err); + check(err, { 'QUOTES_E2E_FSPIOP_POST_QUOTES_SUCCESS': (cbMessage) => false }); + clearTimersQuotes(); + wsQuotes.close(); + }); + + wsQuotes.onmessage = (event) => { + console.info(traceId, `WS message received [${wsChannelQuotes}]: ${event.data}`); + check(event.data, { 'QUOTES_E2E_FSPIOP_POST_QUOTES_SUCCESS': (cbMessage) => cbMessage == 'SUCCESS_CALLBACK_RECEIVED' }); + clearTimersQuotes(); + wsQuotes.close(); + + const startTsTransfers = Date.now(); + const transferId = crypto.randomUUID(); + const wsChannelTransfers = `${traceParent.traceId}/PUT/transfers/${transferId}`; + const wsURLTransfers = `${wsUrl}/${wsChannelTransfers}` + const wsTransfers = new WebSocket(wsURLTransfers); + + var wsTimeoutId = null; + + const clearTimersTransfers = () => { + if (wsTimeoutId) { clearTimeout(wsTimeoutId); wsTimeoutId=null } + } + + wsTransfers.onclose(() => { + clearTimersTransfers(); + }); + + wsTransfers.onerror((err) => { + console.error(traceId, err); + check(err, { 'TRANSFERS_E2E_FSPIOP_POST_TRANSFERS_SUCCESS': (cbMessage) => false }); + clearTimersTransfers(); + wsTransfers.close(); + }); + + wsTransfers.onmessage = (event) => { + console.info(traceId, `WS message received [${wsChannelTransfers}]: ${event.data}`); + check(event.data, { 'TRANSFERS_E2E_FSPIOP_POST_TRANSFERS_SUCCESS': (cbMessage) => cbMessage == 'SUCCESS_CALLBACK_RECEIVED' }); + clearTimersTransfers(); + wsTransfers.close(); + }; + + wsTransfers.onopen = () => { + console.info(traceId, `WS open on URL: ${wsUrl}`); + const params = { + tags: { + payerFspId, + payeeFspId + }, + headers: { + 'Accept': 'application/vnd.interoperability.transfers+json;version=1.1', + 'Content-Type': 'application/vnd.interoperability.transfers+json;version=1.1', + 'FSPIOP-Source': payerFspId, + 'FSPIOP-Destination': payeeFspId, + 'Date': (new Date()).toUTCString(), + 'traceparent': traceParent.toString(), + 'tracestate': `tx_end2end_start_ts=${startTsTransfers}` + }, + }; + + const body = { + "transferId": transferId, + "payerFsp": payerFspId, + "payeeFsp": payeeFspId, + "amount": { + amount, + currency + }, + "expiration": "2030-01-01T00:00:00.000Z", + ilpPacket, + condition + } + + // Lets send the FSPIOP POST /transfers request + const res = http.post(`${__ENV.K6_SCRIPT_FSPIOP_TRANSFERS_ENDPOINT_URL}/transfers`, JSON.stringify(body), params); + check(res, { 'TRANSFERS_FSPIOP_POST_TRANSFERS_RESPONSE_IS_202' : (r) => r.status == 202 }); + + if (abortOnError && res.status != 202) { + // Abort the entire k6 test execution runner + console.error(traceId, `FSPIOP POST /transfers returned status: ${res.status}`); + wsTransfers.close(); + exec.test.abort() + } + + wsTimeoutId = setTimeout(() => { + const errorMsg = `WS timed-out on URL: ${wsURLTransfers}` + console.error(traceId, errorMsg); + check(res, { 'TRANSFERS_E2E_FSPIOP_POST_TRANSFERS_SUCCESS': (cbMessage) => false }); + wsTransfers.close(); + if (abortOnError) { + // Abort the entire k6 test execution runner + console.error(traceId, 'Aborting k6 test execution!') + exec.test.abort() + } + }, wsTimeoutMs); + }; + }; + + wsQuotes.onopen = () => { + console.info(traceId, `WS open on URL: ${wsURLQuotes}`); + const params = { + tags: { + payerFspId, + payeeFspId + }, + headers: { + 'accept': 'application/vnd.interoperability.quotes+json;version=1.0', + 'Content-Type': 'application/vnd.interoperability.quotes+json;version=1.0', + 'FSPIOP-Source': payerFspId, + 'FSPIOP-Destination': payeeFspId, + 'Date': (new Date()).toUTCString(), + 'traceparent': traceParent.toString(), + 'tracestate': `tx_end2end_start_ts=${startTsQuotes}` + }, + }; + + const body = { + "quoteId": quoteId, + "transactionId": transactionId, + "payer": { + "partyIdInfo": { + "partyIdType": "MSISDN", + "partyIdentifier": `${payerFsp['partyId']}`, + "fspId": payerFspId + } + }, + "payee": { + "partyIdInfo": { + "partyIdType": "MSISDN", + "partyIdentifier": `${payeeFsp['partyId']}`, + "fspId": payeeFspId + } + }, + "amountType": "SEND", + "amount": { + "amount": `${amount}`, + "currency": `${currency}` + }, + "transactionType": { + "scenario": "TRANSFER", + "initiator": "PAYER", + "initiatorType": "CONSUMER" + } + } + + // Lets send the FSPIOP POST /quotes request + const res = http.post(`${__ENV.K6_SCRIPT_FSPIOP_QUOTES_ENDPOINT_URL}/quotes`, JSON.stringify(body), params); + check(res, { 'QUOTES_FSPIOP_POST_QUOTES_RESPONSE_IS_202' : (r) => r.status == 202 }); + + wsTimeoutId = setTimeout(() => { + const errorMsg = `WS timed-out on URL: ${wsURLQuotes}` + console.error(traceId, errorMsg); + check(res, { 'QUOTES_E2E_FSPIOP_POST_QUOTES_SUCCESS': (cbMessage) => false }); + wsQuotes.close(); + }, wsTimeoutMs); + }; + }; + + wsParties.onopen = () => { + console.info(traceId, `WS open on URL: ${wsURLParties}`); + const params = { + tags: { + payerFspId, + payeeFspId + }, + headers: { + 'Accept': 'application/vnd.interoperability.parties+json;version=1.1', + 'Content-Type': 'application/vnd.interoperability.parties+json;version=1.1', + 'FSPIOP-Source': payerFspId, + 'Date': (new Date()).toUTCString(), + 'traceparent': traceParent.toString(), + 'tracestate': `tx_end2end_start_ts=${startTsParties}` + }, + }; + + const res = http.get(`${__ENV.K6_SCRIPT_FSPIOP_ALS_ENDPOINT_URL}/parties/MSISDN/${payeeId}`, params); + check(res, { 'ALS_FSPIOP_GET_PARTIES_RESPONSE_IS_202' : (r) => r.status == 202 }); + + wsTimeoutId = setTimeout(() => { + const errorMsg = `WS timed-out on URL: ${wsURLParties}` + console.error(traceId, errorMsg); + check(res, { 'ALS_E2E_FSPIOP_GET_PARTIES_SUCCESS': (cbMessage) => false }); + wsParties.close(); + }, wsTimeoutMs); + }; + }); +} diff --git a/perf.env b/perf.env index 6592bde3..30a5ed75 100644 --- a/perf.env +++ b/perf.env @@ -115,4 +115,9 @@ CONF_CL_HANDLER_ADMIN=central-handlers.js QS_CACHE__ENUM_DATA_EXPIRES_IN_MS=4170000 QS_CACHE__PARTICIPANT_DATA_EXPIRES_IN_MS=60000 QS_SWITCH_ENDPOINT="http://callback-handler-svc-cl-sim:3001/admin" +# Use this for E2E testing +# QS_SWITCH_ENDPOINT="http://central-ledger:3001" QS_SIMPLE_ROUTING_MODE=false + +# Use this for E2E testing +# ALS_SWITCH_ENDPOINT="http://central-ledger:3001"