Skip to content

Feat/#csi 318 timeout test #159

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: feat/fx-impl
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
"Accept": "application/vnd.interoperability.parties+json;version=1.0",
"Content-Type": "application/vnd.interoperability.parties+json;version=1.0",
"Date": "{$function.generic.curDate}",
"FSPIOP-Source": "nonexistentpayerfsp",
"FSPIOP-Proxy": "{$inputs.PROXY1_NAME}",
"FSPIOP-Source": "{$inputs.PROXY_PAYERFSP_ID}",
"FSPIOP-Proxy": "{$inputs.PROXY_HEADER}",
"Authorization": "{$inputs.TTK_BEARER_TOKEN}"
},
"tests": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"amount": "{$inputs.PROXY_PAYEE_DFSP_ERROR_AMOUNT_5XXX}",
"currency": "{$inputs.PROXY_AMOUNT_CURRENCY}"
},
"expiration": "{$inputs.expiration}",
"expiration": "{$environment.transferExpiration}",
"ilpPacket": "{$inputs.ilpPacket}",
"condition": "{$inputs.condition}"
},
Expand All @@ -50,24 +50,105 @@
"exec": [
"expect(response.status).to.equal(202)"
]
},
{
"id": 2,
"description": "Check error code",
"exec": [
"expect(callback.body.errorInformation.errorCode).to.equal('5201')"
]
},
{
"id": 3,
"description": "Check error description",
"exec": [
"expect(callback.body.errorInformation.errorDescription).to.equal('Timeout in Payee DFSP')"
]
}
]
},
"path": "/quotes",

"scripts": {
"preRequest": {
"exec": [
"if (environment.ENABLE_WS_ASSERTIONS===true) {",
" await websocket.connect(environment.PAYEEFSP_SDK_TESTAPI_WS_URL + '/requests/{$request.body.quoteId}', 'payeeRequest')",
"}"
"environment.transferExpiration = new Date(new Date().getTime() + 10000).toISOString();"
]
}
},
"path": "/transfers"
}
]
},
{
"id": 2,
"name": "Proxy Transfers Service when payee dfsp responds after timeout in payee scheme",
"requests": [
{
"id": 1,
"meta": {
"info": "Test Case for scenario when there is an error in payee dfsp"
},
"description": "Send transfer",
"apiVersion": {
"minorVersion": 1,
"majorVersion": 1,
"type": "fspiop",
"asynchronous": true
},
"url": "{$inputs.HOST_TRANSFERS_SERVICE}",
"operationPath": "/transfers",
"method": "post",
"headers": {
"Accept": "application/vnd.interoperability.transfers+json;version=1.0",
"Content-Type": "application/vnd.interoperability.transfers+json;version=1.0",
"Date": "{$function.generic.curDate}",
"FSPIOP-Source": "{$inputs.PROXY_PAYERFSP_ID}",
"Authorization": "{$inputs.TTK_BEARER_TOKEN}",
"FSPIOP-Destination": "{$inputs.PROXY_PAYEEFSP_ID}",
"FSPIOP-Proxy": "{$inputs.PROXY_HEADER}"
},
"body": {
"transferId": "{$function.generic.generateUUID}",
"payerFsp": "{$inputs.PROXY_PAYERFSP_ID}",
"payeeFsp": "{$inputs.PROXY_PAYEEFSP_ID}",
"amount": {
"amount": "{$inputs.PROXY_PAYEE_DFSP_ERROR_AMOUNT_PAYEE_SCHEME_TIMEOUT}",
"currency": "{$inputs.PROXY_AMOUNT_CURRENCY}"
},
"postRequest": {
"expiration": "{$environment.transferExpiration}",
"ilpPacket": "{$inputs.ilpPacket}",
"condition": "{$inputs.condition}"
},
"scriptingEngine": "javascript",
"tests": {
"assertions": [
{
"id": 1,
"description": "Response status to be 202",
"exec": [
"expect(response.status).to.equal(202)"
]
},
{
"id": 2,
"description": "Check error code",
"exec": [
"expect(callback.body.errorInformation.errorCode).to.equal('{$inputs.PROXY_PAYEE_DFSP_ERROR_CODE_PAYEE_SCHEME_TIMEOUT}')"
]
},
{
"id": 3,
"description": "Check error description",
"exec": [
"expect(callback.body.errorInformation.errorDescription).to.equal('{$inputs.PROXY_PAYEE_DFSP_ERROR_DESCRIPTION_PAYEE_SCHEME_TIMEOUT}')"
]
}
]
},
"path": "/transfers",
"scripts": {
"preRequest": {
"exec": [
"if (environment.ENABLE_WS_ASSERTIONS===true) {",
" environment.payeeRequest = await websocket.getMessage('payeeRequest', environment.WS_ASSERTION_TIMEOUT)",
"}"
"environment.transferExpiration = new Date(new Date().getTime() + 2000).toISOString();"
]
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,20 @@
"exec": [
"expect(response.status).to.equal(202)"
]
},
{
"id": 2,
"description": "Check error code",
"exec": [
"expect(callback.errorInformation.errorCode).to.equal('{$inputs.PROXY_PAYEEFSP_PARTY_ID_ERROR_IN_PROXY_ERROR_CODE}')"
]
},
{
"id": 3,
"description": "Check error description",
"exec": [
"expect(callback.errorInformation.errorDescription).to.equal('{$inputs.PROXY_PAYEEFSP_PARTY_ID_ERROR_IN_PROXY_ERROR_DESCRIPTION}')"
]
}
]
},
Expand Down Expand Up @@ -127,6 +141,20 @@
"exec": [
"expect(response.status).to.equal(202)"
]
},
{
"id": 2,
"description": "Check error code",
"exec": [
"expect(callback.errorInformation.errorCode).to.equal('{$inputs.PROXY_PAYEEFSP_PARTY_ID_ERROR_IN_PROXY_ERROR_CODE}')"
]
},
{
"id": 3,
"description": "Check error description",
"exec": [
"expect(callback.errorInformation.errorDescription).to.equal('{$inputs.PROXY_PAYEEFSP_PARTY_ID_ERROR_IN_PROXY_ERROR_DESCRIPTION}')"
]
}
]
},
Expand Down
65 changes: 63 additions & 2 deletions rules/hub/rules_validation/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -1082,6 +1082,67 @@
{
"ruleId": 19,
"priority": 1,
"description": "post /transfers - Testing Payee Scheme with Payer side Proxy as TTK - Negative Scenarios - Payee Scheme timesout before Payee dfsp responds",
"apiVersion": {
"minorVersion": 0,
"majorVersion": 2,
"type": "fspiop",
"asynchronous": true,
"specFile": "spec_files/api_definitions/fspiop_2.0/api_spec.yaml",
"callbackMapFile": "spec_files/api_definitions/fspiop_2.0/callback_map.json",
"responseMapFile": "spec_files/api_definitions/fspiop_2.0/response_map.json",
"jsfRefFile": "spec_files/api_definitions/fspiop_2.0/mockRef.json",
"triggerTemplatesFolder": "spec_files/api_definitions/fspiop_2.0/trigger_templates"
},
"conditions": {
"all": [
{
"fact": "body",
"operator": "numericEqual",
"value": "5202",
"path": "amount.amount"
},
{
"fact": "operationPath",
"operator": "equal",
"value": "/transfers"
},
{
"fact": "method",
"operator": "equal",
"value": "post"
}
]
},
"event": {
"method": "put",
"path": "/transfers/{ID}/error",
"params": {
"scripts": {
"scriptingEngine": "postman"
},
"headers": {
"Content-Type": "application/vnd.interoperability.transfers+json;version=1.0",
"Date": "Tue, 23 Jul 2024 02:05:53 GMT",
"FSPIOP-Source": "ttkpayeefsp",
"FSPIOP-Destination": "nonexistentpayerfsp"
},
"body": {
"errorInformation": {
"errorCode": "5202",
"errorDescription": "Generic Error in Payee DFSP after Payee Scheme timesout"
}
},
"delay": 5000
},
"type": "FIXED_ERROR_CALLBACK"
},
"type": "validation",
"version": 1
},
{
"ruleId": 20,
"priority": 1,
"description": "FxQuotes generic error",
"apiVersion": {
"minorVersion": 0,
Expand Down Expand Up @@ -1140,7 +1201,7 @@
"version": 1
},
{
"ruleId": 20,
"ruleId": 21,
"priority": 1,
"description": "fxTransfers generic error",
"apiVersion": {
Expand Down Expand Up @@ -1200,7 +1261,7 @@
"version": 1
},
{
"ruleId": 21,
"ruleId": 22,
"priority": 1,
"description": "transfers generic error",
"apiVersion": {
Expand Down