Skip to content

Commit

Permalink
more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kalinkrustev authored and sri-miriyala committed Apr 25, 2024
1 parent e051cb4 commit 5c0964f
Show file tree
Hide file tree
Showing 12 changed files with 118 additions and 21 deletions.
24 changes: 24 additions & 0 deletions docker-compose-perf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1015,6 +1015,9 @@ services:
interval: 30s

sim-perffsp1:
sysctls:
# websockets do not have keep-alive, resulting in many TIME_WAIT sockets
net.ipv4.tcp_tw_reuse: 1
image: mojaloop/callback-handler-svc:${TEST_CALLBACK_HAND_SVC_VERSION}
deploy:
mode: replicated
Expand Down Expand Up @@ -1051,6 +1054,9 @@ services:
- 8dfsp

sim-perffsp2:
sysctls:
# websockets do not have keep-alive, resulting in many TIME_WAIT sockets
net.ipv4.tcp_tw_reuse: 1
image: mojaloop/callback-handler-svc:${TEST_CALLBACK_HAND_SVC_VERSION}
# deploy:
# mode: replicated
Expand Down Expand Up @@ -1087,6 +1093,9 @@ services:
- 8dfsp

sim-perffsp3:
sysctls:
# websockets do not have keep-alive, resulting in many TIME_WAIT sockets
net.ipv4.tcp_tw_reuse: 1
image: mojaloop/callback-handler-svc:${TEST_CALLBACK_HAND_SVC_VERSION}
deploy:
mode: replicated
Expand Down Expand Up @@ -1119,6 +1128,9 @@ services:
- 8dfsp

sim-perffsp4:
sysctls:
# websockets do not have keep-alive, resulting in many TIME_WAIT sockets
net.ipv4.tcp_tw_reuse: 1
image: mojaloop/callback-handler-svc:${TEST_CALLBACK_HAND_SVC_VERSION}
deploy:
mode: replicated
Expand Down Expand Up @@ -1151,6 +1163,9 @@ services:
- 8dfsp

sim-perffsp5:
sysctls:
# websockets do not have keep-alive, resulting in many TIME_WAIT sockets
net.ipv4.tcp_tw_reuse: 1
image: mojaloop/callback-handler-svc:${TEST_CALLBACK_HAND_SVC_VERSION}
deploy:
mode: replicated
Expand Down Expand Up @@ -1182,6 +1197,9 @@ services:
- 8dfsp

sim-perffsp6:
sysctls:
# websockets do not have keep-alive, resulting in many TIME_WAIT sockets
net.ipv4.tcp_tw_reuse: 1
image: mojaloop/callback-handler-svc:${TEST_CALLBACK_HAND_SVC_VERSION}
deploy:
mode: replicated
Expand Down Expand Up @@ -1213,6 +1231,9 @@ services:
- 8dfsp

sim-perffsp7:
sysctls:
# websockets do not have keep-alive, resulting in many TIME_WAIT sockets
net.ipv4.tcp_tw_reuse: 1
image: mojaloop/callback-handler-svc:${TEST_CALLBACK_HAND_SVC_VERSION}
deploy:
mode: replicated
Expand Down Expand Up @@ -1244,6 +1265,9 @@ services:
- 8dfsp

sim-perffsp8:
sysctls:
# websockets do not have keep-alive, resulting in many TIME_WAIT sockets
net.ipv4.tcp_tw_reuse: 1
image: mojaloop/callback-handler-svc:${TEST_CALLBACK_HAND_SVC_VERSION}
deploy:
mode: replicated
Expand Down
3 changes: 3 additions & 0 deletions packages/k6-tests/common/uuid.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import { randomString } from 'https://jslib.k6.io/k6-utils/1.2.0/index.js';

const random = len => randomString(len, '0123456789abcdef')
// This is not a standard compliant UUID v7, as some of the services do not allow it.
// Additionally there are not UUID v7 modules that can be easily used in k6, so this simple iplementation
// is used instead
export function uuid() {
const t = Date.now().toString(16).padStart(12, 0);
return `${t.substring(0,8)}-${t.substring(8,12)}-4${random(3)}-9${random(3)}-${random(12)}`
Expand Down
4 changes: 2 additions & 2 deletions packages/k6-tests/config/fspiopDiscovery.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
"startVUs": 5,
"stages": [
{ "duration": "30s", "target": 600 },
{ "duration": "1m", "target": 1000 },
{ "duration": "2m", "target": 1000 }
{ "duration": "1m", "target": 5000 },
{ "duration": "1h", "target": 5000 }
]
}
},
Expand Down
19 changes: 12 additions & 7 deletions packages/k6-tests/config/fspiopDiscoveryRampingRate.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,25 @@
{
"scenarios": {
"fspiopTransfers": {
"fspiopDiscovery": {
"executor": "ramping-arrival-rate",
"exec": "fspiopDiscoveryScenarios",
"env": {
"UNIDIRECTIONAL": "false"
},
"preAllocatedVUs": 50,
"preAllocatedVUs": 1000,
"timeUnit": "1s",
"startRate": 10,
"stages": [
{ "target": 100, "duration": "30s" },
{ "target": 200, "duration": "30s" },
{ "target": 300, "duration": "30s" },
{ "target": 300, "duration": "5m" }

{ "target": 200, "duration": "15s" },
{ "target": 200, "duration": "3m" },
{ "target": 400, "duration": "15s" },
{ "target": 400, "duration": "3m" },
{ "target": 600, "duration": "15s" },
{ "target": 600, "duration": "3m" },
{ "target": 800, "duration": "15s" },
{ "target": 800, "duration": "3m" },
{ "target": 1000, "duration": "15s" },
{ "target": 1000, "duration": "3m" }
]
}
},
Expand Down
5 changes: 3 additions & 2 deletions packages/k6-tests/config/fspiopE2E.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@
},
"startVUs": 1,
"stages": [
{ "duration": "30s", "target": 30 },
{ "duration": "5m", "target": 30 }
{ "duration": "30s", "target": 600 },
{ "duration": "1m", "target": 5000 },
{ "duration": "2h", "target": 5000 }
]
}
},
Expand Down
31 changes: 31 additions & 0 deletions packages/k6-tests/config/fspiopQuotesRampingRate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"scenarios": {
"fspiopQuotes": {
"executor": "ramping-arrival-rate",
"exec": "fspiopQuotesScenarios",
"env": {
"UNIDIRECTIONAL": "false"
},
"preAllocatedVUs": 1000,
"timeUnit": "1s",
"startRate": 10,
"stages": [
{ "target": 200, "duration": "15s" },
{ "target": 200, "duration": "3m" },
{ "target": 400, "duration": "15s" },
{ "target": 400, "duration": "3m" },
{ "target": 600, "duration": "15s" },
{ "target": 600, "duration": "3m" },
{ "target": 800, "duration": "15s" },
{ "target": 800, "duration": "3m" },
{ "target": 1000, "duration": "15s" },
{ "target": 1000, "duration": "3m" }
]
}
},
"thresholds": {
"iteration_duration": [ "p(95)<1000" ],
"http_req_failed": [ "rate<0.01" ],
"http_req_duration": [ "p(95)<1000" ]
}
}
15 changes: 11 additions & 4 deletions packages/k6-tests/config/fspiopTransfersRampingRate.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,20 @@
"env": {
"UNIDIRECTIONAL": "false"
},
"preAllocatedVUs": 50,
"preAllocatedVUs": 1000,
"timeUnit": "1s",
"startRate": 10,
"stages": [
{ "target": 100, "duration": "5m" },
{ "target": 200, "duration": "5m" },
{ "target": 300, "duration": "10m" }
{ "target": 200, "duration": "15s" },
{ "target": 200, "duration": "3m" },
{ "target": 400, "duration": "15s" },
{ "target": 400, "duration": "3m" },
{ "target": 600, "duration": "15s" },
{ "target": 600, "duration": "3m" },
{ "target": 800, "duration": "15s" },
{ "target": 800, "duration": "3m" },
{ "target": 1000, "duration": "15s" },
{ "target": 1000, "duration": "3m" }
]
}
},
Expand Down
7 changes: 4 additions & 3 deletions patch.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#!/bin/sh
kubectl patch deployment --kubeconfig k8s.yaml --namespace mojaloop moja-centralledger-service --patch-file patch/ledger-service.yaml
sleep 10 # wait for schema creation
kubectl scale --kubeconfig k8s.yaml --namespace mojaloop deployment/moja-centralledger-service --replicas=8
# kubectl patch deployment --kubeconfig k8s.yaml --namespace mojaloop moja-centralledger-service --patch-file patch/ledger-service.yaml
# sleep 10 # wait for schema creation
# kubectl scale --kubeconfig k8s.yaml --namespace mojaloop deployment/moja-centralledger-service --replicas=8
kubectl patch deployment --kubeconfig k8s.yaml --namespace mojaloop moja-account-lookup-service --patch-file patch/account-service.yaml
kubectl patch deployment --kubeconfig k8s.yaml --namespace mojaloop moja-ml-api-adapter-service --patch-file patch/adapter-service.yaml
kubectl patch deployment --kubeconfig k8s.yaml --namespace mojaloop moja-ml-api-adapter-handler-notification --patch-file patch/adapter-handler.yaml
kubectl patch deployment --kubeconfig k8s.yaml --namespace mojaloop moja-centralledger-handler-admin-transfer --patch-file patch/transfer-admin.yaml
Expand Down
12 changes: 12 additions & 0 deletions patch/account-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
spec:
replicas: 12
template:
spec:
containers:
- name: account-lookup-service
image: mojaloop/account-lookup-service:v15.2.4
env:
- name: EVENT_SDK_LOG_FILTER
value: ''
- name: EVENT_SDK_SIDECAR_DISABLED
value: 'true'
2 changes: 1 addition & 1 deletion patch/quoting-handler.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ spec:
spec:
containers:
- name: quoting-service-handler
image: mojaloop/quoting-service:v15.7.1-snapshot.0
image: mojaloop/quoting-service:v15.7.1
env:
- name: EVENT_SDK_LOG_FILTER
value: ''
Expand Down
2 changes: 1 addition & 1 deletion patch/quoting-service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ spec:
spec:
containers:
- name: quoting-service
image: mojaloop/quoting-service:v15.7.1-snapshot.0
image: mojaloop/quoting-service:v15.7.1
env:
- name: EVENT_SDK_LOG_FILTER
value: ''
Expand Down
15 changes: 14 additions & 1 deletion test.sh → perf-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ discoveries)
echo "Testing account discoveries"
env K6_SCRIPT_CONFIG_FILE_NAME=fspiopDiscovery.json docker compose --project-name load -f docker-compose-load.yml up -d
;;
discoveriesrate)
echo "Testing account discoveries with constant rates"
env K6_SCRIPT_CONFIG_FILE_NAME=fspiopDiscoveryRampingRate.json docker compose --project-name load -f docker-compose-load.yml up -d
;;
quote)
echo "Testing single quote"
env K6_SCRIPT_CONFIG_FILE_NAME=fspiopSingleQuote.json docker compose --project-name load -f docker-compose-load.yml up
Expand All @@ -19,14 +23,22 @@ quotes)
echo "Testing quotes"
env K6_SCRIPT_CONFIG_FILE_NAME=fspiopQuotes.json docker compose --project-name load -f docker-compose-load.yml up -d
;;
quotesrate)
echo "Testing quotes"
env K6_SCRIPT_CONFIG_FILE_NAME=fspiopQuotesRampingRate.json docker compose --project-name load -f docker-compose-load.yml up -d
;;
transfer)
echo "Testing single transfer"
env K6_SCRIPT_CONFIG_FILE_NAME=fspiopSingleTransfer.json docker compose --project-name load -f docker-compose-load.yml up
;;
transfer)
transfers)
echo "Testing transfers"
env K6_SCRIPT_CONFIG_FILE_NAME=fspiopTransfers.json docker compose --project-name load -f docker-compose-load.yml up -d
;;
transfersrate)
echo "Testing transfers"
env K6_SCRIPT_CONFIG_FILE_NAME=fspiopTransfersRampingRate.json docker compose --project-name load -f docker-compose-load.yml up -d
;;
e2e)
echo "Testing multiple end to end"
env K6_SCRIPT_CONFIG_FILE_NAME=fspiopE2E.json docker compose --project-name load -f docker-compose-load.yml up -d
Expand All @@ -52,6 +64,7 @@ simrestart)
echo "Usage: "
echo " $0 discovery"
echo " $0 discoveries"
echo " $0 discoveries rate"
echo " $0 quote"
echo " $0 quotes"
echo " $0 transfer"
Expand Down

0 comments on commit 5c0964f

Please sign in to comment.