diff --git a/.env b/.env index 67390ad3..75d23f1e 100644 --- a/.env +++ b/.env @@ -41,7 +41,7 @@ KAFKA_EXPORTER_VERSION=latest CADVISER_VERSION=latest ## Load Docker Image Versions -K6_VERSION=0.47.0 +K6_VERSION=0.50.0 ## Performance Testing Replicas QS_REPLICAS=1 diff --git a/.gitignore b/.gitignore index 9ba8ee25..c70abfa8 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,6 @@ **/reports/** automate_perf.env +perf.override.env +perf-on-prem.env +k8s.yaml \ No newline at end of file diff --git a/README.md b/README.md index 038bb128..462a0182 100644 --- a/README.md +++ b/README.md @@ -419,3 +419,37 @@ To capture results without running tests, use the following command ```bash ./automate_perf.sh -c -f -t ``` + +### Testing Performance of Remote Mojaloop Deployment + +For executing performance test scenarios against a Mojaloop deployment, follow the steps below: + +1. **Set Environment Variables:** + - Set `perf.override.env` with the proper endpoints of the Mojaloop services. + +2. **Customize Configurations:** + - Edit the file `docker/ml-testing-toolkit/test-cases/environments/remote-k8s-env.json` to customize currencies and MSISDNs according to your requirements. + +3. **Run Simulators and TTK Provisioning:** + ```bash + docker compose --project-name simulators -f docker-compose-perf.yml --profile 8dfsp --profile testing-toolkit --profile ttk-provisioning-remote-k8s --profile oracle up -d + ``` + +4. **Run Monitoring Services:** + ```bash + docker compose --project-name monitoring --profile transfers-test -f docker-compose-monitoring.yml up -d + ``` + +5. **Execute Single Transfer Test Case:** + ```bash + env K6_SCRIPT_CONFIG_FILE_NAME=fspiopSingleTransfer.json docker compose --project-name load -f docker-compose-load.yml up + ``` + +6. **Stop Services:** + ```bash + docker compose --project-name simulators -f docker-compose-perf.yml --profile 8dfsp --profile testing-toolkit --profile ttk-provisioning-remote-k8s down -v + docker compose --project-name monitoring --profile transfers-test -f docker-compose-monitoring.yml down -v + ``` + +> **Note:** The `-v` argument is optional and will delete any volume data created by the monitoring Docker Compose. + diff --git a/docker-compose-load.yml b/docker-compose-load.yml index 20471ef1..1902988c 100644 --- a/docker-compose-load.yml +++ b/docker-compose-load.yml @@ -16,12 +16,17 @@ networks: services: k6: image: grafana/k6:${K6_VERSION} + sysctls: + # websockets do not have keep-alive, resulting in many TIME_WAIT sockets + net.ipv4.tcp_tw_reuse: 1 env_file: - .env - perf.env + - perf.override.env command: - run # - '--help' ## Useful to list run options + # - '--http-debug=full' - '--include-system-env-vars' - '/scripts/index.js' networks: @@ -29,9 +34,10 @@ services: - monitoring-net - mojaloop-net ports: - - "6565:6565" + - "5665:5665" environment: - K6_SCRIPT_CONFIG_FILE_NAME=${K6_SCRIPT_CONFIG_FILE_NAME:-test.json} + - K6_WEB_DASHBOARD=true # - K6_PROMETHEUS_RW_SERVER_URL=http://prometheus:9090/api/v1/write # Ref: https://k6.io/docs/results-output/real-time/prometheus-remote-write/#options # - K6_PROMETHEUS_RW_TREND_AS_NATIVE_HISTOGRAM=true # Ref: https://k6.io/docs/results-output/real-time/prometheus-remote-write/#options # - K6_OUT=experimental-prometheus-rw # Ref: https://k6.io/docs/results-output/real-time/prometheus-remote-write/ diff --git a/docker-compose-perf.yml b/docker-compose-perf.yml index 947d90e9..717439e5 100644 --- a/docker-compose-perf.yml +++ b/docker-compose-perf.yml @@ -826,6 +826,29 @@ services: profiles: - ttk-provisioning-transfers + ttk-provisioning-remote-k8s: + image: mojaloop/ml-testing-toolkit-client-lib:${TEST_TTK_CLI_VERSION} + env_file: + - .env + - perf.env + - perf.override.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 + networks: + - mojaloop-net + command: + - sh + - -c + - 'sed -e "s~K6_CALLBACK_FQDN~$$K6_CALLBACK_FQDN~g" -e "s~K6_SCRIPT_ADMIN_ENDPOINT_URL~$$K6_SCRIPT_ADMIN_ENDPOINT_URL~g" -e "s~K6_SCRIPT_ALS_ADMIN_ENDPOINT_URL~$$K6_SCRIPT_ALS_ADMIN_ENDPOINT_URL~g" -e "s~K6_SCRIPT_FSPIOP_ALS_ENDPOINT_URL~$$K6_SCRIPT_FSPIOP_ALS_ENDPOINT_URL~g" -e "s~K6_SCRIPT_FSPIOP_QUOTES_ENDPOINT_URL~$$K6_SCRIPT_FSPIOP_QUOTES_ENDPOINT_URL~g" -e "s~K6_SCRIPT_ORACLE_ENDPOINT_URL~$$K6_SCRIPT_ORACLE_ENDPOINT_URL~g" environments/remote-k8s-env.json > /tmp/env.json && npm run cli -- -u http://mojaloop-testing-toolkit:5050 -l 2 -i collections/provisioning -e /tmp/env.json --report-format html --report-target file://reports/ttk-provisioning-report.html' + user: root + profiles: + - ttk-provisioning-remote-k8s + ttk-provisioning-quotes: image: mojaloop/ml-testing-toolkit-client-lib:${TEST_TTK_CLI_VERSION} env_file: @@ -886,8 +909,8 @@ services: context: ./packages/callback-handler-svc cache_from: - mojaloop/callback-handler-svc:${TEST_CALLBACK_HAND_SVC_VERSION} - # ports: - # - "3001:3001" + ports: + - "30000:3001" networks: - mojaloop-net volumes: @@ -906,6 +929,7 @@ services: - callback-handler - all-services - als-test + - oracle sdk-scheme-adapter-api-svc: image: mojaloop/sdk-scheme-adapter:${SDK_SCHEME_ADAPTER_VERSION} @@ -991,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 @@ -998,12 +1025,13 @@ services: env_file: - .env - ./envs/perffsp1.env + - perf.override.env build: context: ./packages/callback-handler-svc cache_from: - mojaloop/callback-handler-svc:${TEST_CALLBACK_HAND_SVC_VERSION} - # ports: - # - "3001:3001" + ports: + - "25001:3001" networks: - mojaloop-net volumes: @@ -1026,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 @@ -1033,12 +1064,13 @@ services: env_file: - .env - ./envs/perffsp2.env + - perf.override.env build: context: ./packages/callback-handler-svc cache_from: - mojaloop/callback-handler-svc:${TEST_CALLBACK_HAND_SVC_VERSION} - # ports: - # - "3001:3001" + ports: + - "25002:3001" networks: - mojaloop-net volumes: @@ -1061,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 @@ -1068,12 +1103,13 @@ services: env_file: - .env - ./envs/perffsp3.env + - perf.override.env build: context: ./packages/callback-handler-svc cache_from: - mojaloop/callback-handler-svc:${TEST_CALLBACK_HAND_SVC_VERSION} - # ports: - # - "3001:3001" + ports: + - "25003:3001" networks: - mojaloop-net volumes: @@ -1092,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 @@ -1099,12 +1138,13 @@ services: env_file: - .env - ./envs/perffsp4.env + - perf.override.env build: context: ./packages/callback-handler-svc cache_from: - mojaloop/callback-handler-svc:${TEST_CALLBACK_HAND_SVC_VERSION} - # ports: - # - "3001:3001" + ports: + - "25004:3001" networks: - mojaloop-net volumes: @@ -1123,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 @@ -1130,12 +1173,13 @@ services: env_file: - .env - ./envs/perffsp5.env + - perf.override.env build: context: ./packages/callback-handler-svc cache_from: - mojaloop/callback-handler-svc:${TEST_CALLBACK_HAND_SVC_VERSION} - # ports: - # - "3001:3001" + ports: + - "25005:3001" networks: - mojaloop-net volumes: @@ -1153,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 @@ -1160,12 +1207,13 @@ services: env_file: - .env - ./envs/perffsp6.env + - perf.override.env build: context: ./packages/callback-handler-svc cache_from: - mojaloop/callback-handler-svc:${TEST_CALLBACK_HAND_SVC_VERSION} - # ports: - # - "3001:3001" + ports: + - "25006:3001" networks: - mojaloop-net volumes: @@ -1183,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 @@ -1190,12 +1241,13 @@ services: env_file: - .env - ./envs/perffsp7.env + - perf.override.env build: context: ./packages/callback-handler-svc cache_from: - mojaloop/callback-handler-svc:${TEST_CALLBACK_HAND_SVC_VERSION} - # ports: - # - "3001:3001" + ports: + - "25007:3001" networks: - mojaloop-net volumes: @@ -1213,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 @@ -1220,12 +1275,13 @@ services: env_file: - .env - ./envs/perffsp8.env + - perf.override.env build: context: ./packages/callback-handler-svc cache_from: - mojaloop/callback-handler-svc:${TEST_CALLBACK_HAND_SVC_VERSION} - # ports: - # - "3001:3001" + ports: + - "25008:3001" networks: - mojaloop-net volumes: diff --git a/docker/ml-testing-toolkit/test-cases/collections/de-provisioning-perf-als/oracle.json b/docker/ml-testing-toolkit/test-cases/collections/de-provisioning-perf-als/oracle.json new file mode 100644 index 00000000..9d9e0341 --- /dev/null +++ b/docker/ml-testing-toolkit/test-cases/collections/de-provisioning-perf-als/oracle.json @@ -0,0 +1,54 @@ +{ + "options": {}, + "name": "collections_tests_oracle", + "test_cases": [ + { + "id": 1, + "name": "Add MSISDN Oracle", + "meta": { + "info": "Add MSISDN Oracle." + }, + "fileInfo": { + "path": "collections/de-provisioning-perf-als/oracle.json" + }, + "requests": [ + { + "id": 6, + "description": "Add Oracle for MSISDN", + "params": { + "ID": "", + "Type": "" + }, + "apiVersion": { + "minorVersion": 1, + "majorVersion": 1, + "type": "als_admin", + "specFile": "spec_files/api_definitions/als_admin_1.1/api_spec.yaml", + "callbackMapFile": "spec_files/api_definitions/als_admin_1.1/callback_map.json", + "responseMapFile": "spec_files/api_definitions/als_admin_1.1/response_map.json", + "jsfRefFile": "spec_files/api_definitions/als_admin_1.1/mockRef.json", + "triggerTemplatesFolder": "spec_files/api_definitions/als_admin_1.1/trigger_templates" + }, + "operationPath": "/oracles", + "path": "/oracles", + "method": "post", + "url": "{$inputs.HOST_ACCOUNT_LOOKUP_ADMIN}", + "headers": { + "content-type": "application/vnd.interoperability.oracles+json;version=1.1", + "date": "", + "accept": "application/vnd.interoperability.oracles+json;version=1.1" + }, + "body": { + "oracleIdType": "MSISDN", + "endpoint": { + "value": "{$inputs.PERF_ORACLE_ENDPOINT_BASE_URL}", + "endpointType": "URL" + }, + "currency": "{$inputs.currency}" + }, + "disabled": false + } + ] + } + ] +} \ No newline at end of file diff --git a/docker/ml-testing-toolkit/test-cases/environments/remote-k8s-env.json b/docker/ml-testing-toolkit/test-cases/environments/remote-k8s-env.json new file mode 100644 index 00000000..a762ac45 --- /dev/null +++ b/docker/ml-testing-toolkit/test-cases/environments/remote-k8s-env.json @@ -0,0 +1,47 @@ +{ + "inputValues": { + "HOST_ACCOUNT_LOOKUP_SERVICE": "K6_SCRIPT_FSPIOP_ALS_ENDPOINT_URL", + "HOST_ACCOUNT_LOOKUP_ADMIN": "K6_SCRIPT_ALS_ADMIN_ENDPOINT_URL", + "HOST_CENTRAL_LEDGER": "K6_SCRIPT_ADMIN_ENDPOINT_URL", + "HOST_QUOTING_SERVICE": "K6_SCRIPT_FSPIOP_QUOTES_ENDPOINT_URL", + "HOST_SIMULATOR": "K6_SCRIPT_ORACLE_ENDPOINT_URL", + "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", + "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", + "hubEmail": "some.email@gmail.com", + "hub_operator": "NOT_APPLICABLE", + "toIdType": "MSISDN", + "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://K6_CALLBACK_FQDN:25001/fspiop", + "PERF_FSP2_CALLBACK_ENDPOINT_BASE_URL": "http://K6_CALLBACK_FQDN:25002/fspiop", + "PERF_FSP3_CALLBACK_ENDPOINT_BASE_URL": "http://K6_CALLBACK_FQDN:25003/fspiop", + "PERF_FSP4_CALLBACK_ENDPOINT_BASE_URL": "http://K6_CALLBACK_FQDN:25004/fspiop", + "PERF_FSP5_CALLBACK_ENDPOINT_BASE_URL": "http://K6_CALLBACK_FQDN:25005/fspiop", + "PERF_FSP6_CALLBACK_ENDPOINT_BASE_URL": "http://K6_CALLBACK_FQDN:25006/fspiop", + "PERF_FSP7_CALLBACK_ENDPOINT_BASE_URL": "http://K6_CALLBACK_FQDN:25007/fspiop", + "PERF_FSP8_CALLBACK_ENDPOINT_BASE_URL": "http://K6_CALLBACK_FQDN:25008/fspiop" + } +} diff --git a/k8s-mojaloop-perf-tuning/account-service.yaml b/k8s-mojaloop-perf-tuning/account-service.yaml new file mode 100644 index 00000000..651842e6 --- /dev/null +++ b/k8s-mojaloop-perf-tuning/account-service.yaml @@ -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' diff --git a/k8s-mojaloop-perf-tuning/adapter-handler.yaml b/k8s-mojaloop-perf-tuning/adapter-handler.yaml new file mode 100644 index 00000000..7625a14c --- /dev/null +++ b/k8s-mojaloop-perf-tuning/adapter-handler.yaml @@ -0,0 +1,12 @@ +spec: + replicas: 12 + template: + spec: + containers: + - name: ml-api-adapter-handler-notification + # image: mojaloop/ml-api-adapter:v14.0.5 + env: + - name: EVENT_SDK_LOG_FILTER + value: '' + - name: EVENT_SDK_SIDECAR_DISABLED + value: 'true' diff --git a/k8s-mojaloop-perf-tuning/adapter-service.yaml b/k8s-mojaloop-perf-tuning/adapter-service.yaml new file mode 100644 index 00000000..29a887a9 --- /dev/null +++ b/k8s-mojaloop-perf-tuning/adapter-service.yaml @@ -0,0 +1,12 @@ +spec: + replicas: 12 + template: + spec: + containers: + - name: ml-api-adapter-service + # image: mojaloop/ml-api-adapter:v14.0.5 + env: + - name: EVENT_SDK_LOG_FILTER + value: '' + - name: EVENT_SDK_SIDECAR_DISABLED + value: 'true' diff --git a/k8s-mojaloop-perf-tuning/job-gp.yaml b/k8s-mojaloop-perf-tuning/job-gp.yaml new file mode 100644 index 00000000..c3c266cf --- /dev/null +++ b/k8s-mojaloop-perf-tuning/job-gp.yaml @@ -0,0 +1,89 @@ +apiVersion: batch/v1 +kind: Job +metadata: + name: moja-ml-ttk-test-val-gp + namespace: mojaloop + labels: + argocd.argoproj.io/instance: moja + annotations: + argocd.argoproj.io/hook: PostSync +spec: + backoffLimit: 0 + template: + metadata: + labels: + app.kubernetes.io/instance: moja + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/name: ml-ttk-test-val-gp + app.kubernetes.io/version: 15.6.0 + batch.kubernetes.io/job-name: moja-ml-ttk-test-val-gp + helm.sh/chart: ml-ttk-test-val-gp-15.6.0 + job-name: moja-ml-ttk-test-val-gp + sidecar.istio.io/inject: 'false' + spec: + volumes: + - name: moja-ml-ttk-test-val-gp-conf + configMap: + name: moja-ml-ttk-test-val-gp-conf + items: + - key: cli-default-config.json + path: cli-default-config.json + defaultMode: 420 + - name: moja-ml-ttk-test-val-gp-env + configMap: + name: moja-ml-ttk-test-val-gp-env + items: + - key: cli-testcase-environment.json + path: cli-testcase-environment.json + defaultMode: 420 + containers: + - name: ml-ttk-test-val-gp + image: mojaloop/ml-testing-toolkit-client-lib:v1.2.2 + command: + - /bin/sh + - '-c' + args: + - > + echo "Downloading the test collection..."; + + wget + https://github.com/mojaloop/testing-toolkit-test-cases/archive/v16.0.0.zip + -O downloaded-test-collections.zip; + + mkdir tmp_test_cases; + + unzip -d tmp_test_cases -o downloaded-test-collections.zip; + + npm run cli -- \ + -c cli-default-config.json \ + -e cli-testcase-environment.json \ + -i tmp_test_cases/testing-toolkit-test-cases-16.0.0/collections/hub/golden_path \ + -u http://moja-ml-testing-toolkit-backend:5050 \ + --report-format html \ + --report-auto-filename-enable true \ + --extra-summary-information="Test Suite:GP Tests,Environment:dev1.devbaremetal1.moja-onprem.net" \ + --save-report true \ + --report-name gp_tests \ + --save-report-base-url http://ttkbackend.dev1.devbaremetal1.moja-onprem.net; + export TEST_RUNNER_EXIT_CODE="$?"; + + echo "Test Runner finished with exit code: + $TEST_RUNNER_EXIT_CODE"; + + exit $TEST_RUNNER_EXIT_CODE; + envFrom: + - secretRef: + name: moja-ml-ttk-test-val-gp-aws-creds + resources: {} + volumeMounts: + - name: moja-ml-ttk-test-val-gp-env + mountPath: /opt/app/cli-testcase-environment.json + subPath: cli-testcase-environment.json + - name: moja-ml-ttk-test-val-gp-conf + mountPath: /opt/app/cli-default-config.json + subPath: cli-default-config.json + terminationMessagePath: /dev/termination-log + terminationMessagePolicy: File + imagePullPolicy: IfNotPresent + restartPolicy: Never + terminationGracePeriodSeconds: 30 diff --git a/k8s-mojaloop-perf-tuning/job-setup.yaml b/k8s-mojaloop-perf-tuning/job-setup.yaml new file mode 100644 index 00000000..0e8b067a --- /dev/null +++ b/k8s-mojaloop-perf-tuning/job-setup.yaml @@ -0,0 +1,89 @@ +apiVersion: batch/v1 +kind: Job +metadata: + name: moja-ml-ttk-test-setup + namespace: mojaloop + labels: + argocd.argoproj.io/instance: moja + annotations: + argocd.argoproj.io/hook: PostSync +spec: + backoffLimit: 0 + template: + metadata: + labels: + app.kubernetes.io/instance: moja + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/name: ml-ttk-test-setup + app.kubernetes.io/version: 15.6.0 + batch.kubernetes.io/job-name: moja-ml-ttk-test-setup + helm.sh/chart: ml-ttk-test-setup-15.6.0 + job-name: moja-ml-ttk-test-setup + sidecar.istio.io/inject: 'false' + spec: + volumes: + - name: moja-ml-ttk-test-setup-conf + configMap: + name: moja-ml-ttk-test-setup-conf + items: + - key: cli-default-config.json + path: cli-default-config.json + defaultMode: 420 + - name: moja-ml-ttk-test-setup-env + configMap: + name: moja-ml-ttk-test-setup-env + items: + - key: cli-testcase-environment.json + path: cli-testcase-environment.json + defaultMode: 420 + containers: + - name: ml-ttk-test-setup + image: mojaloop/ml-testing-toolkit-client-lib:v1.2.2 + command: + - /bin/sh + - '-c' + args: + - > + echo "Downloading the test collection..."; + + wget + https://github.com/mojaloop/testing-toolkit-test-cases/archive/v16.0.0.zip + -O downloaded-test-collections.zip; + + mkdir tmp_test_cases; + + unzip -d tmp_test_cases -o downloaded-test-collections.zip; + + npm run cli -- \ + -c cli-default-config.json \ + -e cli-testcase-environment.json \ + -i tmp_test_cases/testing-toolkit-test-cases-16.0.0/collections/hub/provisioning \ + -u http://moja-ml-testing-toolkit-backend:5050 \ + --report-format html \ + --report-auto-filename-enable true \ + --extra-summary-information="Test Suite:Provisioning,Environment:dev1.devbaremetal1.moja-onprem.net" \ + --save-report true \ + --report-name standard_provisioning_collection \ + --save-report-base-url http://ttkbackend.dev1.devbaremetal1.moja-onprem.net; + export TEST_RUNNER_EXIT_CODE="$?"; + + echo "Test Runner finished with exit code: + $TEST_RUNNER_EXIT_CODE"; + + exit $TEST_RUNNER_EXIT_CODE; + envFrom: + - secretRef: + name: moja-ml-ttk-test-setup-aws-creds + resources: {} + volumeMounts: + - name: moja-ml-ttk-test-setup-env + mountPath: /opt/app/cli-testcase-environment.json + subPath: cli-testcase-environment.json + - name: moja-ml-ttk-test-setup-conf + mountPath: /opt/app/cli-default-config.json + subPath: cli-default-config.json + terminationMessagePath: /dev/termination-log + terminationMessagePolicy: File + imagePullPolicy: IfNotPresent + restartPolicy: Never + terminationGracePeriodSeconds: 30 diff --git a/k8s-mojaloop-perf-tuning/ledger-service.yaml b/k8s-mojaloop-perf-tuning/ledger-service.yaml new file mode 100644 index 00000000..25a1b648 --- /dev/null +++ b/k8s-mojaloop-perf-tuning/ledger-service.yaml @@ -0,0 +1,12 @@ +spec: + replicas: 1 + template: + spec: + initContainers: + - name: run-migration + image: mojaloop/central-ledger:v17.6.1 + # image: mojaloop/central-ledger:v17.5.9-snapshot.0 + containers: + - name: centralledger-service + image: mojaloop/central-ledger:v17.6.1 + # image: mojaloop/central-ledger:v17.5.9-snapshot.0 diff --git a/k8s-mojaloop-perf-tuning/patch.sh b/k8s-mojaloop-perf-tuning/patch.sh new file mode 100755 index 00000000..5e5672f5 --- /dev/null +++ b/k8s-mojaloop-perf-tuning/patch.sh @@ -0,0 +1,17 @@ +#!/bin/sh +DIR=`dirname $(readlink -f "$0" 2> /dev/null)` + +kubectl patch deployment --kubeconfig k8s.yaml --namespace mojaloop moja-centralledger-service --patch-file $DIR/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 $DIR/account-service.yaml +kubectl patch deployment --kubeconfig k8s.yaml --namespace mojaloop moja-ml-api-adapter-service --patch-file $DIR/adapter-service.yaml +kubectl patch deployment --kubeconfig k8s.yaml --namespace mojaloop moja-ml-api-adapter-handler-notification --patch-file $DIR/adapter-handler.yaml +kubectl patch deployment --kubeconfig k8s.yaml --namespace mojaloop moja-centralledger-handler-admin-transfer --patch-file $DIR/transfer-admin.yaml +kubectl patch deployment --kubeconfig k8s.yaml --namespace mojaloop moja-centralledger-handler-transfer-get --patch-file $DIR/transfer-get.yaml +kubectl patch deployment --kubeconfig k8s.yaml --namespace mojaloop moja-centralledger-handler-transfer-prepare --patch-file $DIR/transfer-prepare.yaml +kubectl patch deployment --kubeconfig k8s.yaml --namespace mojaloop moja-centralledger-handler-transfer-fulfil --patch-file $DIR/transfer-fulfil.yaml +kubectl patch deployment --kubeconfig k8s.yaml --namespace mojaloop moja-handler-pos-batch --patch-file $DIR/transfer-position.yaml +kubectl patch deployment --kubeconfig k8s.yaml --namespace mojaloop moja-centralledger-handler-timeout --patch-file $DIR/transfer-timeout.yaml +kubectl patch deployment --kubeconfig k8s.yaml --namespace mojaloop moja-quoting-service --patch-file $DIR/quoting-service.yaml +kubectl patch deployment --kubeconfig k8s.yaml --namespace mojaloop moja-quoting-service-handler --patch-file $DIR/quoting-handler.yaml diff --git a/k8s-mojaloop-perf-tuning/quoting-handler.yaml b/k8s-mojaloop-perf-tuning/quoting-handler.yaml new file mode 100644 index 00000000..17f301b2 --- /dev/null +++ b/k8s-mojaloop-perf-tuning/quoting-handler.yaml @@ -0,0 +1,12 @@ +spec: + replicas: 12 + template: + spec: + containers: + - name: quoting-service-handler + image: mojaloop/quoting-service:v15.7.1 + env: + - name: EVENT_SDK_LOG_FILTER + value: '' + - name: EVENT_SDK_SIDECAR_DISABLED + value: 'true' diff --git a/k8s-mojaloop-perf-tuning/quoting-service.yaml b/k8s-mojaloop-perf-tuning/quoting-service.yaml new file mode 100644 index 00000000..3b6b4f1a --- /dev/null +++ b/k8s-mojaloop-perf-tuning/quoting-service.yaml @@ -0,0 +1,12 @@ +spec: + replicas: 4 + template: + spec: + containers: + - name: quoting-service + image: mojaloop/quoting-service:v15.7.1 + env: + - name: EVENT_SDK_LOG_FILTER + value: '' + - name: EVENT_SDK_SIDECAR_DISABLED + value: 'true' diff --git a/k8s-mojaloop-perf-tuning/transfer-admin.yaml b/k8s-mojaloop-perf-tuning/transfer-admin.yaml new file mode 100644 index 00000000..24d4ce56 --- /dev/null +++ b/k8s-mojaloop-perf-tuning/transfer-admin.yaml @@ -0,0 +1,7 @@ +spec: + template: + spec: + containers: + - name: centralledger-handler-admin-transfer + image: mojaloop/central-ledger:v17.6.1 + # image: mojaloop/central-ledger:v17.5.9-snapshot.0 diff --git a/k8s-mojaloop-perf-tuning/transfer-fulfil.yaml b/k8s-mojaloop-perf-tuning/transfer-fulfil.yaml new file mode 100644 index 00000000..b0df9b13 --- /dev/null +++ b/k8s-mojaloop-perf-tuning/transfer-fulfil.yaml @@ -0,0 +1,13 @@ +spec: + replicas: 12 + template: + spec: + containers: + - name: centralledger-handler-transfer-fulfil + image: mojaloop/central-ledger:v17.6.1 + # image: mojaloop/central-ledger:v17.5.9-snapshot.0 + env: + - name: EVENT_SDK_LOG_FILTER + value: '' + - name: EVENT_SDK_SIDECAR_DISABLED + value: 'true' diff --git a/k8s-mojaloop-perf-tuning/transfer-get.yaml b/k8s-mojaloop-perf-tuning/transfer-get.yaml new file mode 100644 index 00000000..538789e0 --- /dev/null +++ b/k8s-mojaloop-perf-tuning/transfer-get.yaml @@ -0,0 +1,7 @@ +spec: + template: + spec: + containers: + - name: centralledger-handler-transfer-get + image: mojaloop/central-ledger:v17.6.1 + # image: mojaloop/central-ledger:v17.5.9-snapshot.0 diff --git a/k8s-mojaloop-perf-tuning/transfer-position.yaml b/k8s-mojaloop-perf-tuning/transfer-position.yaml new file mode 100644 index 00000000..3b98e0be --- /dev/null +++ b/k8s-mojaloop-perf-tuning/transfer-position.yaml @@ -0,0 +1,13 @@ +spec: + replicas: 12 + template: + spec: + containers: + - name: handler-pos-batch + image: mojaloop/central-ledger:v17.6.1 + # image: mojaloop/central-ledger:v17.5.9-snapshot.0 + env: + - name: EVENT_SDK_LOG_FILTER + value: '' + - name: EVENT_SDK_SIDECAR_DISABLED + value: 'true' diff --git a/k8s-mojaloop-perf-tuning/transfer-prepare.yaml b/k8s-mojaloop-perf-tuning/transfer-prepare.yaml new file mode 100644 index 00000000..d71095d5 --- /dev/null +++ b/k8s-mojaloop-perf-tuning/transfer-prepare.yaml @@ -0,0 +1,13 @@ +spec: + replicas: 12 + template: + spec: + containers: + - name: centralledger-handler-transfer-prepare + image: mojaloop/central-ledger:v17.6.1 + # image: mojaloop/central-ledger:v17.5.9-snapshot.0 + env: + - name: EVENT_SDK_LOG_FILTER + value: '' + - name: EVENT_SDK_SIDECAR_DISABLED + value: 'true' diff --git a/k8s-mojaloop-perf-tuning/transfer-timeout.yaml b/k8s-mojaloop-perf-tuning/transfer-timeout.yaml new file mode 100644 index 00000000..1126803d --- /dev/null +++ b/k8s-mojaloop-perf-tuning/transfer-timeout.yaml @@ -0,0 +1,7 @@ +spec: + template: + spec: + containers: + - name: centralledger-handler-timeout + image: mojaloop/central-ledger:v17.6.1 + # image: mojaloop/central-ledger:v17.5.9-snapshot.0 diff --git a/packages/k6-tests/common/uuid.js b/packages/k6-tests/common/uuid.js new file mode 100644 index 00000000..7e346459 --- /dev/null +++ b/packages/k6-tests/common/uuid.js @@ -0,0 +1,11 @@ +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)}` +} + diff --git a/packages/k6-tests/config-k8s/fspiopDiscovery.json b/packages/k6-tests/config-k8s/fspiopDiscovery.json new file mode 100644 index 00000000..1039368b --- /dev/null +++ b/packages/k6-tests/config-k8s/fspiopDiscovery.json @@ -0,0 +1,22 @@ +{ + "scenarios": { + "fspiopDiscovery": { + "executor": "ramping-vus", + "exec": "fspiopDiscoveryScenarios", + "env": { + "UNIDIRECTIONAL": "false" + }, + "startVUs": 5, + "stages": [ + { "duration": "30s", "target": 600 }, + { "duration": "1m", "target": 5000 }, + { "duration": "1h", "target": 5000 } + ] + } + }, + "thresholds": { + "iteration_duration": [ "p(95)<1000" ], + "http_req_failed": [ "rate<0.01" ], + "http_req_duration": [ "p(95)<1000" ] + } +} diff --git a/packages/k6-tests/config-k8s/fspiopDiscoveryNoCallbackConstantRate.json b/packages/k6-tests/config-k8s/fspiopDiscoveryNoCallbackConstantRate.json new file mode 100644 index 00000000..8582be78 --- /dev/null +++ b/packages/k6-tests/config-k8s/fspiopDiscoveryNoCallbackConstantRate.json @@ -0,0 +1,20 @@ +{ + "scenarios": { + "fspiopDiscoveryConstantRate": { + "executor": "constant-arrival-rate", + "exec": "fspiopDiscoveryNoCallbackScenarios", + "env": { + "UNIDIRECTIONAL": "false" + }, + "preAllocatedVUs": 50, + "timeUnit": "1s", + "duration": "1m", + "rate": 200 + } + }, + "thresholds": { + "iteration_duration": [ "p(95)<1000" ], + "http_req_failed": [ "rate<0.01" ], + "http_req_duration": [ "p(95)<1000" ] + } + } \ No newline at end of file diff --git a/packages/k6-tests/config-k8s/fspiopDiscoveryRampingRate.json b/packages/k6-tests/config-k8s/fspiopDiscoveryRampingRate.json new file mode 100644 index 00000000..dd560128 --- /dev/null +++ b/packages/k6-tests/config-k8s/fspiopDiscoveryRampingRate.json @@ -0,0 +1,31 @@ +{ + "scenarios": { + "fspiopDiscovery": { + "executor": "ramping-arrival-rate", + "exec": "fspiopDiscoveryScenarios", + "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" ] + } +} diff --git a/packages/k6-tests/config-k8s/fspiopDiscoverySingle.json b/packages/k6-tests/config-k8s/fspiopDiscoverySingle.json new file mode 100644 index 00000000..3e46e5b0 --- /dev/null +++ b/packages/k6-tests/config-k8s/fspiopDiscoverySingle.json @@ -0,0 +1,19 @@ +{ + "scenarios": { + "fspiopDiscovery": { + "executor": "shared-iterations", + "exec": "fspiopDiscoveryScenarios", + "env": { + "UNIDIRECTIONAL": "true" + }, + "vus": 1, + "iterations": 1 + } + }, + "thresholds": { + "iteration_duration": [ "p(95)<1000" ], + "http_req_failed": [ "rate<0.01" ], + "http_req_duration": [ "p(95)<1000" ] + } + } + \ No newline at end of file diff --git a/packages/k6-tests/config-k8s/fspiopE2E.json b/packages/k6-tests/config-k8s/fspiopE2E.json new file mode 100644 index 00000000..45d8685c --- /dev/null +++ b/packages/k6-tests/config-k8s/fspiopE2E.json @@ -0,0 +1,22 @@ +{ + "scenarios": { + "fspiopE2E": { + "executor": "ramping-vus", + "exec": "fspiopE2EScenarios", + "env": { + "UNIDIRECTIONAL": "false" + }, + "startVUs": 1, + "stages": [ + { "duration": "30s", "target": 600 }, + { "duration": "1m", "target": 5000 }, + { "duration": "2h", "target": 5000 } + ] + } + }, + "thresholds": { + "iteration_duration": [ "p(95)<1000" ], + "http_req_failed": [ "rate<0.01" ], + "http_req_duration": [ "p(95)<1000" ] + } +} diff --git a/packages/k6-tests/config-k8s/fspiopE2Esingle.json b/packages/k6-tests/config-k8s/fspiopE2Esingle.json new file mode 100644 index 00000000..69d806fa --- /dev/null +++ b/packages/k6-tests/config-k8s/fspiopE2Esingle.json @@ -0,0 +1,18 @@ +{ + "scenarios": { + "fspiopE2E": { + "executor": "shared-iterations", + "exec": "fspiopE2EScenarios", + "env": { + "UNIDIRECTIONAL": "false" + }, + "vus": 1, + "iterations": 1 + } + }, + "thresholds": { + "iteration_duration": [ "p(95)<1000" ], + "http_req_failed": [ "rate<0.01" ], + "http_req_duration": [ "p(95)<1000" ] + } +} diff --git a/packages/k6-tests/config-k8s/fspiopParallel.json b/packages/k6-tests/config-k8s/fspiopParallel.json new file mode 100644 index 00000000..08e17c5a --- /dev/null +++ b/packages/k6-tests/config-k8s/fspiopParallel.json @@ -0,0 +1,21 @@ +{ + "scenarios": { + "fspiopParallel": { + "executor": "ramping-vus", + "exec": "fspiopParallelScenarios", + "env": { + "UNIDIRECTIONAL": "false" + }, + "startVUs": 1, + "stages": [ + { "duration": "30s", "target": 1 }, + { "duration": "5m", "target": 1 } + ] + } + }, + "thresholds": { + "iteration_duration": [ "p(95)<1000" ], + "http_req_failed": [ "rate<0.01" ], + "http_req_duration": [ "p(95)<1000" ] + } +} diff --git a/packages/k6-tests/config-k8s/fspiopQuotes.json b/packages/k6-tests/config-k8s/fspiopQuotes.json new file mode 100644 index 00000000..25301dd3 --- /dev/null +++ b/packages/k6-tests/config-k8s/fspiopQuotes.json @@ -0,0 +1,22 @@ +{ + "scenarios": { + "fspiopQuotes": { + "executor": "ramping-vus", + "exec": "fspiopQuotesScenarios", + "env": { + "UNIDIRECTIONAL": "false" + }, + "startVUs": 5, + "stages": [ + { "duration": "30s", "target": 600 }, + { "duration": "1m", "target": 2000 }, + { "duration": "480s", "target": 2000 } + ] + } + }, + "thresholds": { + "iteration_duration": [ "p(95)<1000" ], + "http_req_failed": [ "rate<0.01" ], + "http_req_duration": [ "p(95)<1000" ] + } +} diff --git a/packages/k6-tests/config-k8s/fspiopQuotesConstantRate.json b/packages/k6-tests/config-k8s/fspiopQuotesConstantRate.json new file mode 100644 index 00000000..21ecc1e9 --- /dev/null +++ b/packages/k6-tests/config-k8s/fspiopQuotesConstantRate.json @@ -0,0 +1,18 @@ +{ + "scenarios": { + "fspiopQuotesConstantRate": { + "executor": "constant-arrival-rate", + "exec": "fspiopQuotesScenarios", + "env": { + "UNIDIRECTIONAL": "false" + }, + "duration": "5m", + "rate": 100 + } + }, + "thresholds": { + "iteration_duration": [ "p(95)<1000" ], + "http_req_failed": [ "rate<0.01" ], + "http_req_duration": [ "p(95)<1000" ] + } +} diff --git a/packages/k6-tests/config-k8s/fspiopQuotesNoCallbackConstantRate.json b/packages/k6-tests/config-k8s/fspiopQuotesNoCallbackConstantRate.json new file mode 100644 index 00000000..e3d158ea --- /dev/null +++ b/packages/k6-tests/config-k8s/fspiopQuotesNoCallbackConstantRate.json @@ -0,0 +1,20 @@ +{ + "scenarios": { + "fspiopQuotesNoCallbackScenariosConstantRate": { + "executor": "constant-arrival-rate", + "exec": "fspiopQuotesNoCallbackScenarios", + "env": { + "UNIDIRECTIONAL": "false" + }, + "preAllocatedVUs": 200, + "timeUnit": "1s", + "duration": "5m", + "rate": 200 + } + }, + "thresholds": { + "iteration_duration": [ "p(95)<1000" ], + "http_req_failed": [ "rate<0.01" ], + "http_req_duration": [ "p(95)<1000" ] + } +} diff --git a/packages/k6-tests/config-k8s/fspiopQuotesPersonalInfoExtensions.json b/packages/k6-tests/config-k8s/fspiopQuotesPersonalInfoExtensions.json new file mode 100644 index 00000000..7516a138 --- /dev/null +++ b/packages/k6-tests/config-k8s/fspiopQuotesPersonalInfoExtensions.json @@ -0,0 +1,21 @@ +{ + "scenarios": { + "fspiopQuotes": { + "executor": "ramping-vus", + "exec": "fspiopQuotesScenarios", + "env": { + "UNIDIRECTIONAL": "false" + }, + "startVUs": 1, + "stages": [ + { "duration": "30s", "target": 50 }, + { "duration": "5m", "target": 50 } + ] + } + }, + "thresholds": { + "iteration_duration": [ "p(95)<1000" ], + "http_req_failed": [ "rate<0.01" ], + "http_req_duration": [ "p(95)<1000" ] + } +} diff --git a/packages/k6-tests/config-k8s/fspiopQuotesRampingRate.json b/packages/k6-tests/config-k8s/fspiopQuotesRampingRate.json new file mode 100644 index 00000000..cc31f37a --- /dev/null +++ b/packages/k6-tests/config-k8s/fspiopQuotesRampingRate.json @@ -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" ] + } +} diff --git a/packages/k6-tests/config-k8s/fspiopSingleQuote.json b/packages/k6-tests/config-k8s/fspiopSingleQuote.json new file mode 100644 index 00000000..25df5159 --- /dev/null +++ b/packages/k6-tests/config-k8s/fspiopSingleQuote.json @@ -0,0 +1,18 @@ +{ + "scenarios": { + "fspiopQuotes": { + "executor": "shared-iterations", + "exec": "fspiopQuotesScenarios", + "env": { + "UNIDIRECTIONAL": "false" + }, + "vus": 1, + "iterations": 1 + } + }, + "thresholds": { + "iteration_duration": [ "p(95)<1000" ], + "http_req_failed": [ "rate<0.01" ], + "http_req_duration": [ "p(95)<1000" ] + } +} diff --git a/packages/k6-tests/config-k8s/fspiopSingleTransfer.json b/packages/k6-tests/config-k8s/fspiopSingleTransfer.json new file mode 100644 index 00000000..095f96d6 --- /dev/null +++ b/packages/k6-tests/config-k8s/fspiopSingleTransfer.json @@ -0,0 +1,18 @@ +{ + "scenarios": { + "fspiopTransfers": { + "executor": "shared-iterations", + "exec": "fspiopTransfersScenarios", + "env": { + "UNIDIRECTIONAL": "false" + }, + "vus": 1, + "iterations": 1 + } + }, + "thresholds": { + "iteration_duration": [ "p(95)<1000" ], + "http_req_failed": [ "rate<0.01" ], + "http_req_duration": [ "p(95)<1000" ] + } +} diff --git a/packages/k6-tests/config-k8s/fspiopTransfers.json b/packages/k6-tests/config-k8s/fspiopTransfers.json new file mode 100644 index 00000000..cbe4b014 --- /dev/null +++ b/packages/k6-tests/config-k8s/fspiopTransfers.json @@ -0,0 +1,22 @@ +{ + "scenarios": { + "fspiopTransfers": { + "executor": "ramping-vus", + "exec": "fspiopTransfersScenarios", + "env": { + "UNIDIRECTIONAL": "false" + }, + "startVUs": 5, + "stages": [ + { "duration": "30s", "target": 600 }, + { "duration": "1m", "target": 2000 }, + { "duration": "480s", "target": 2000 } + ] + } + }, + "thresholds": { + "iteration_duration": [ "p(95)<1000" ], + "http_req_failed": [ "rate<0.01" ], + "http_req_duration": [ "p(95)<1000" ] + } +} diff --git a/packages/k6-tests/config-k8s/fspiopTransfersNoCallback.json b/packages/k6-tests/config-k8s/fspiopTransfersNoCallback.json new file mode 100644 index 00000000..012074ad --- /dev/null +++ b/packages/k6-tests/config-k8s/fspiopTransfersNoCallback.json @@ -0,0 +1,18 @@ +{ + "scenarios": { + "fspiopTransfers": { + "executor": "shared-iterations", + "exec": "fspiopTransfersNoCallbackScenarios", + "env": { + "UNIDIRECTIONAL": "false" + }, + "vus": 1, + "iterations": 5000 + } + }, + "thresholds": { + "iteration_duration": [ "p(95)<1000" ], + "http_req_failed": [ "rate<0.01" ], + "http_req_duration": [ "p(95)<1000" ] + } +} diff --git a/packages/k6-tests/config-k8s/fspiopTransfersNoCallbackConstantRate.json b/packages/k6-tests/config-k8s/fspiopTransfersNoCallbackConstantRate.json new file mode 100644 index 00000000..abd4aa77 --- /dev/null +++ b/packages/k6-tests/config-k8s/fspiopTransfersNoCallbackConstantRate.json @@ -0,0 +1,20 @@ +{ + "scenarios": { + "fspiopTransfersNoCallbackScenarios": { + "executor": "constant-arrival-rate", + "exec": "fspiopTransfersNoCallbackScenarios", + "env": { + "UNIDIRECTIONAL": "false" + }, + "preAllocatedVUs": 200, + "timeUnit": "1s", + "duration": "2m", + "rate": 500 + } + }, + "thresholds": { + "iteration_duration": [ "p(95)<1000" ], + "http_req_failed": [ "rate<0.01" ], + "http_req_duration": [ "p(95)<1000" ] + } +} diff --git a/packages/k6-tests/config-k8s/fspiopTransfersNoCallbackRampingRate.json b/packages/k6-tests/config-k8s/fspiopTransfersNoCallbackRampingRate.json new file mode 100644 index 00000000..e9fb2eca --- /dev/null +++ b/packages/k6-tests/config-k8s/fspiopTransfersNoCallbackRampingRate.json @@ -0,0 +1,25 @@ +{ + "scenarios": { + "fspiopTransfers": { + "executor": "ramping-arrival-rate", + "exec": "fspiopTransfersNoCallbackScenarios", + "env": { + "UNIDIRECTIONAL": "false" + }, + "preAllocatedVUs": 50, + "timeUnit": "1s", + "startRate": 30, + "stages": [ + { "target": 50, "duration": "2m" }, + { "target": 100, "duration": "2m" }, + { "target": 150, "duration": "2m" } + + ] + } + }, + "thresholds": { + "iteration_duration": [ "p(95)<1000" ], + "http_req_failed": [ "rate<0.01" ], + "http_req_duration": [ "p(95)<1000" ] + } +} diff --git a/packages/k6-tests/config-k8s/fspiopTransfersRampingRate.json b/packages/k6-tests/config-k8s/fspiopTransfersRampingRate.json new file mode 100644 index 00000000..5b25676d --- /dev/null +++ b/packages/k6-tests/config-k8s/fspiopTransfersRampingRate.json @@ -0,0 +1,31 @@ +{ + "scenarios": { + "fspiopTransfers": { + "executor": "ramping-arrival-rate", + "exec": "fspiopTransfersScenarios", + "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" ] + } +} diff --git a/packages/k6-tests/config-k8s/fspiopTransfersUnidirectional.json b/packages/k6-tests/config-k8s/fspiopTransfersUnidirectional.json new file mode 100644 index 00000000..effb8b85 --- /dev/null +++ b/packages/k6-tests/config-k8s/fspiopTransfersUnidirectional.json @@ -0,0 +1,21 @@ +{ + "scenarios": { + "fspiopTransfers": { + "executor": "ramping-vus", + "exec": "fspiopTransfersScenarios", + "env": { + "UNIDIRECTIONAL": "true" + }, + "startVUs": 1, + "stages": [ + { "duration": "30s", "target": 10 }, + { "duration": "5m", "target": 10 } + ] + } + }, + "thresholds": { + "iteration_duration": [ "p(95)<1000" ], + "http_req_failed": [ "rate<0.01" ], + "http_req_duration": [ "p(95)<1000" ] + } +} diff --git a/packages/k6-tests/config-k8s/inboundSDKDiscovery.json b/packages/k6-tests/config-k8s/inboundSDKDiscovery.json new file mode 100644 index 00000000..d77b5c1c --- /dev/null +++ b/packages/k6-tests/config-k8s/inboundSDKDiscovery.json @@ -0,0 +1,21 @@ +{ + "scenarios": { + "inboundSDKDiscovery": { + "executor": "ramping-vus", + "exec": "inboundSDKDiscoveryScenarios", + "env": { + "UNIDIRECTIONAL": "false" + }, + "startVUs": 1, + "stages": [ + { "duration": "30s", "target": 5 } + ] + } + }, + "thresholds": { + "iteration_duration": [ "p(95)<1000" ], + "http_req_failed": [ "rate<0.01" ], + "http_req_duration": [ "p(95)<1000" ] + } + } + \ No newline at end of file diff --git a/packages/k6-tests/config-k8s/inboundSDKQuotes.json b/packages/k6-tests/config-k8s/inboundSDKQuotes.json new file mode 100644 index 00000000..f63e8aa9 --- /dev/null +++ b/packages/k6-tests/config-k8s/inboundSDKQuotes.json @@ -0,0 +1,18 @@ +{ + "scenarios": { + "inboundSDKQuotes": { + "executor": "ramping-vus", + "exec": "inboundSDKQuotesScenarios", + "startVUs": 1, + "stages": [ + { "duration": "30s", "target": 15 }, + { "duration": "1m", "target": 15 } + ] + } + }, + "thresholds": { + "iteration_duration": [ "p(95)<1000" ], + "http_req_failed": [ "rate<0.01" ], + "http_req_duration": [ "p(95)<1000" ] + } +} diff --git a/packages/k6-tests/config-k8s/inboundSDKTransfer.json b/packages/k6-tests/config-k8s/inboundSDKTransfer.json new file mode 100644 index 00000000..1a48ec0f --- /dev/null +++ b/packages/k6-tests/config-k8s/inboundSDKTransfer.json @@ -0,0 +1,22 @@ +{ + "scenarios": { + "inboundSDKTransfers": { + "executor": "ramping-vus", + "exec": "inboundSDKTransfersScenarios", + "env": { + "UNIDIRECTIONAL": "true" + }, + "startVUs": 1, + "stages": [ + { "duration": "30s", "target": 10 }, + { "duration": "1m", "target": 10 } + ] + } + }, + "thresholds": { + "iteration_duration": [ "p(95)<1000" ], + "http_req_failed": [ "rate<0.01" ], + "http_req_duration": [ "p(95)<1000" ] + } + } + \ No newline at end of file diff --git a/packages/k6-tests/config-k8s/outboundSDKDiscovery.json b/packages/k6-tests/config-k8s/outboundSDKDiscovery.json new file mode 100644 index 00000000..8c706837 --- /dev/null +++ b/packages/k6-tests/config-k8s/outboundSDKDiscovery.json @@ -0,0 +1,21 @@ +{ + "scenarios": { + "outboundSDKDiscovery": { + "executor": "ramping-vus", + "exec": "outboundSDKDiscoveryScenarios", + "env": { + "UNIDIRECTIONAL": "true" + }, + "startVUs": 1, + "stages": [ + { "duration": "2m", "target": 5 } + ] + } + }, + "thresholds": { + "iteration_duration": [ "p(95)<1000" ], + "http_req_failed": [ "rate<0.01" ], + "http_req_duration": [ "p(95)<1000" ] + } + } + \ No newline at end of file diff --git a/packages/k6-tests/config-k8s/outboundSDKQuotes.json b/packages/k6-tests/config-k8s/outboundSDKQuotes.json new file mode 100644 index 00000000..ec13d0ed --- /dev/null +++ b/packages/k6-tests/config-k8s/outboundSDKQuotes.json @@ -0,0 +1,18 @@ +{ + "scenarios": { + "outboundSDKQuotes": { + "executor": "ramping-vus", + "exec": "outboundSDKQuotesScenarios", + "startVUs": 1, + "stages": [ + { "duration": "30s", "target": 15 }, + { "duration": "1m", "target": 15 } + ] + } + }, + "thresholds": { + "iteration_duration": [ "p(95)<1000" ], + "http_req_failed": [ "rate<0.01" ], + "http_req_duration": [ "p(95)<1000" ] + } +} diff --git a/packages/k6-tests/config-k8s/outboundSDKTransfer.json b/packages/k6-tests/config-k8s/outboundSDKTransfer.json new file mode 100644 index 00000000..e9bc55aa --- /dev/null +++ b/packages/k6-tests/config-k8s/outboundSDKTransfer.json @@ -0,0 +1,21 @@ +{ + "scenarios": { + "outboundSDKTransfers": { + "executor": "ramping-vus", + "exec": "outboundSDKTransfersScenarios", + "env": { + "UNIDIRECTIONAL": "true" + }, + "startVUs": 1, + "stages": [ + { "duration": "2m", "target": 5 } + ] + } + }, + "thresholds": { + "iteration_duration": [ "p(95)<1000" ], + "http_req_failed": [ "rate<0.01" ], + "http_req_duration": [ "p(95)<1000" ] + } + } + \ No newline at end of file diff --git a/packages/k6-tests/config-k8s/test.json b/packages/k6-tests/config-k8s/test.json new file mode 100644 index 00000000..7884a667 --- /dev/null +++ b/packages/k6-tests/config-k8s/test.json @@ -0,0 +1,13 @@ +{ + "scenarios": { + "test": { + "executor": "shared-iterations", + "exec": "inboundSDKTransfersScenarios", + "env": { + "UNIDIRECTIONAL": "false" + }, + "vus": 1, + "iterations": 1 + } + } +} diff --git a/packages/k6-tests/config/fspiopDQTRampingRate.json b/packages/k6-tests/config/fspiopDQTRampingRate.json new file mode 100644 index 00000000..15c00d9a --- /dev/null +++ b/packages/k6-tests/config/fspiopDQTRampingRate.json @@ -0,0 +1,75 @@ +{ + "scenarios": { + "fspiopDiscovery": { + "executor": "ramping-arrival-rate", + "exec": "fspiopDiscoveryScenarios", + "env": { + "UNIDIRECTIONAL": "false" + }, + "preAllocatedVUs": 1000, + "timeUnit": "1s", + "startRate": 10, + "stages": [ + { "target": 100, "duration": "15s" }, + { "target": 100, "duration": "3m" }, + { "target": 125, "duration": "15s" }, + { "target": 125, "duration": "3m" }, + { "target": 150, "duration": "15s" }, + { "target": 150, "duration": "3m" }, + { "target": 175, "duration": "15s" }, + { "target": 175, "duration": "3m" }, + { "target": 200, "duration": "15s" }, + { "target": 200, "duration": "3m" } + ] + }, + "fspiopQuotes": { + "executor": "ramping-arrival-rate", + "exec": "fspiopQuotesScenarios", + "env": { + "UNIDIRECTIONAL": "false" + }, + "preAllocatedVUs": 1000, + "timeUnit": "1s", + "startRate": 10, + "stages": [ + { "target": 100, "duration": "15s" }, + { "target": 100, "duration": "3m" }, + { "target": 125, "duration": "15s" }, + { "target": 125, "duration": "3m" }, + { "target": 150, "duration": "15s" }, + { "target": 150, "duration": "3m" }, + { "target": 175, "duration": "15s" }, + { "target": 175, "duration": "3m" }, + { "target": 200, "duration": "15s" }, + { "target": 200, "duration": "3m" } + ] + }, + "fspiopTransfers": { + "executor": "ramping-arrival-rate", + "exec": "fspiopTransfersScenarios", + "env": { + "UNIDIRECTIONAL": "false" + }, + "preAllocatedVUs": 1000, + "timeUnit": "1s", + "startRate": 10, + "stages": [ + { "target": 100, "duration": "15s" }, + { "target": 100, "duration": "3m" }, + { "target": 125, "duration": "15s" }, + { "target": 125, "duration": "3m" }, + { "target": 150, "duration": "15s" }, + { "target": 150, "duration": "3m" }, + { "target": 175, "duration": "15s" }, + { "target": 175, "duration": "3m" }, + { "target": 200, "duration": "15s" }, + { "target": 200, "duration": "3m" } + ] + } + }, + "thresholds": { + "iteration_duration": [ "p(95)<1000" ], + "http_req_failed": [ "rate<0.01" ], + "http_req_duration": [ "p(95)<1000" ] + } +} diff --git a/packages/k6-tests/config/fspiopSingleQuote.json b/packages/k6-tests/config/fspiopSingleQuote.json index 8a9f5547..25df5159 100644 --- a/packages/k6-tests/config/fspiopSingleQuote.json +++ b/packages/k6-tests/config/fspiopSingleQuote.json @@ -1,6 +1,6 @@ { "scenarios": { - "fspiopTransfers": { + "fspiopQuotes": { "executor": "shared-iterations", "exec": "fspiopQuotesScenarios", "env": { diff --git a/packages/k6-tests/index.js b/packages/k6-tests/index.js index 3ec8cc5a..9c76c2e1 100644 --- a/packages/k6-tests/index.js +++ b/packages/k6-tests/index.js @@ -1,7 +1,10 @@ export { fspiopDiscoveryScenarios } from './scenarios/fspiopDiscovery.js'; +export { fspiopDiscoveryNoCallbackScenarios } from './scenarios/fspiopDiscoveryNoCallbackConstantRate.js'; export { fspiopTransfersScenarios } from './scenarios/fspiopTransfers.js'; export { fspiopTransfersNoCallbackScenarios } from './scenarios/fspiopTransfersNoCallback.js'; export { fspiopQuotesScenarios } from './scenarios/fspiopQuotes.js'; +export { fspiopQuotesNoCallbackScenarios } from './scenarios/fspiopQuotesNoCallback.js'; +export { fspiopParallelScenarios } from './scenarios/fspiopParallel.js'; export { fspiopQuotesPersonalInfoExtensionsScenarios } from './scenarios/fspiopQuotesPersonalInfoExtensions.js'; export { fspiopE2EScenarios } from './scenarios/fspiopE2E.js'; export { inboundSDKDiscoveryScenarios } from './scenarios/inboundSDKDiscovery.js'; @@ -11,8 +14,8 @@ export { outboundSDKDiscoveryScenarios } from './scenarios/outboundSDKDiscovery. export { outboundSDKQuotesScenarios } from './scenarios/outboundSDKQuotes.js'; export { outboundSDKTransfersScenarios } from './scenarios/outboundSDKTransfers.js'; - -const configFile = __ENV.K6_SCRIPT_CONFIG_FILE_NAME ? './config/' + __ENV.K6_SCRIPT_CONFIG_FILE_NAME : './config/test.json'; +const configFolder = './' + (__ENV.K6_SCRIPT_CONFIG_FOLDER_NAME || 'config') + '/'; +const configFile = configFolder + __ENV.K6_SCRIPT_CONFIG_FILE_NAME || 'test.json'; const testConfig = JSON.parse(open(configFile)); export const options = Object.assign( diff --git a/packages/k6-tests/scenarios/fspiopDiscoveryNoCallbackConstantRate.js b/packages/k6-tests/scenarios/fspiopDiscoveryNoCallbackConstantRate.js new file mode 100644 index 00000000..4e2a91ac --- /dev/null +++ b/packages/k6-tests/scenarios/fspiopDiscoveryNoCallbackConstantRate.js @@ -0,0 +1,7 @@ +import { getPartiesNoCallback } from "../scripts/getPartiesNoCallback.js"; +import http from 'k6/http'; +import exec from 'k6/execution'; + +export function fspiopDiscoveryNoCallbackScenarios() { + getPartiesNoCallback(); +} \ No newline at end of file diff --git a/packages/k6-tests/scenarios/fspiopParallel.js b/packages/k6-tests/scenarios/fspiopParallel.js new file mode 100644 index 00000000..f73435ca --- /dev/null +++ b/packages/k6-tests/scenarios/fspiopParallel.js @@ -0,0 +1,5 @@ +import { parallelRequests } from "../scripts/parallelRequests.js"; + +export function fspiopParallelScenarios() { + parallelRequests(); +} diff --git a/packages/k6-tests/scenarios/fspiopQuotesNoCallback.js b/packages/k6-tests/scenarios/fspiopQuotesNoCallback.js new file mode 100644 index 00000000..77b61500 --- /dev/null +++ b/packages/k6-tests/scenarios/fspiopQuotesNoCallback.js @@ -0,0 +1,5 @@ +import { postQuotesNoCallback } from "../scripts/postQuotesNoCallback.js"; + +export function fspiopQuotesNoCallbackScenarios() { + postQuotesNoCallback(); +} diff --git a/packages/k6-tests/scripts/E2E.js b/packages/k6-tests/scripts/E2E.js index e5113901..72907066 100644 --- a/packages/k6-tests/scripts/E2E.js +++ b/packages/k6-tests/scripts/E2E.js @@ -1,19 +1,21 @@ import http from 'k6/http'; import { check, group } from 'k6'; -import { crypto } from "k6/experimental/webcrypto"; +// import { crypto } from "k6/experimental/webcrypto"; import { WebSocket } from 'k6/experimental/websockets'; -import { setTimeout, clearTimeout } from 'k6/experimental/timers'; +import { setTimeout, clearTimeout } from 'k6/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} -`); +import { uuid } from '../common/uuid.js' + +function log() { + console.log('Env Vars -->'); + console.log(` K6_SCRIPT_WS_TIMEOUT_MS=${__ENV.K6_SCRIPT_WS_TIMEOUT_MS}`); + console.log(` K6_SCRIPT_FSPIOP_ALS_ENDPOINT_URL=${__ENV.K6_SCRIPT_FSPIOP_ALS_ENDPOINT_URL}`); + console.log(` K6_SCRIPT_ADMIN_ENDPOINT_URL=${__ENV.K6_SCRIPT_ADMIN_ENDPOINT_URL}`); + console.log(` K6_SCRIPT_ORACLE_ENDPOINT_URL=${__ENV.K6_SCRIPT_ORACLE_ENDPOINT_URL}`); + console.log(` 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 @@ -23,6 +25,7 @@ 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() { + !exec.instance.iterationsCompleted && log(); group("E2E", function () { let payerFsp let payeeFsp @@ -47,7 +50,7 @@ export function E2E() { const wsChannelParties = `${traceParent.traceId}/PUT/parties/MSISDN/${payeeId}`; const wsURLParties = `${wsUrl}/${wsChannelParties}` - const wsParties = new WebSocket(wsURLParties); + const wsParties = new WebSocket(wsURLParties, null, {tags: {name: 'e2e parties ws'}}); var wsTimeoutId = null; @@ -67,17 +70,19 @@ export function E2E() { }); wsParties.onmessage = (event) => { - console.info(traceId, `WS message received [${wsChannelParties}]: ${event.data}`); + __ENV.K6_DEBUG && 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 quoteId = crypto.randomUUID(); + // const transactionId = crypto.randomUUID(); + const quoteId = uuid(); + const transactionId = uuid(); const wsChannelQuotes = `${traceParent.traceId}/PUT/quotes/${quoteId}`; const wsURLQuotes = `${wsUrl}/${wsChannelQuotes}` - const wsQuotes = new WebSocket(wsURLQuotes); + const wsQuotes = new WebSocket(wsURLQuotes, null, {tags: {name: 'e2e quotes ws'}}); var wsTimeoutId = null; @@ -97,16 +102,17 @@ export function E2E() { }); wsQuotes.onmessage = (event) => { - console.info(traceId, `WS message received [${wsChannelQuotes}]: ${event.data}`); + __ENV.K6_DEBUG && 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 transferId = crypto.randomUUID(); + const transferId = uuid(); const wsChannelTransfers = `${traceParent.traceId}/PUT/transfers/${transferId}`; const wsURLTransfers = `${wsUrl}/${wsChannelTransfers}` - const wsTransfers = new WebSocket(wsURLTransfers); + const wsTransfers = new WebSocket(wsURLTransfers, null, {tags: {name: 'e2e transfers ws'}}); var wsTimeoutId = null; @@ -126,14 +132,14 @@ export function E2E() { }); wsTransfers.onmessage = (event) => { - console.info(traceId, `WS message received [${wsChannelTransfers}]: ${event.data}`); + __ENV.K6_DEBUG && 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}`); + __ENV.K6_DEBUG && console.info(traceId, `WS open on URL: ${wsUrl}`); const params = { tags: { payerFspId, @@ -189,7 +195,7 @@ export function E2E() { }; wsQuotes.onopen = () => { - console.info(traceId, `WS open on URL: ${wsURLQuotes}`); + __ENV.K6_DEBUG && console.info(traceId, `WS open on URL: ${wsURLQuotes}`); const params = { tags: { payerFspId, @@ -249,7 +255,7 @@ export function E2E() { }; wsParties.onopen = () => { - console.info(traceId, `WS open on URL: ${wsURLParties}`); + __ENV.K6_DEBUG && console.info(traceId, `WS open on URL: ${wsURLParties}`); const params = { tags: { payerFspId, diff --git a/packages/k6-tests/scripts/getParties.js b/packages/k6-tests/scripts/getParties.js index e5e0eef4..abedfd67 100644 --- a/packages/k6-tests/scripts/getParties.js +++ b/packages/k6-tests/scripts/getParties.js @@ -1,10 +1,10 @@ import http from 'k6/http'; import { check, fail, sleep, group } from 'k6'; -import crypto from "k6/crypto"; import { WebSocket } from 'k6/experimental/websockets'; -import { setTimeout, clearTimeout, setInterval, clearInterval } from 'k6/experimental/timers'; -import { randomItem } from "https://jslib.k6.io/k6-utils/1.1.0/index.js"; +import { setTimeout, clearTimeout, setInterval, clearInterval } from 'k6/timers'; import { Trace } from "../common/trace.js"; +import { getTwoItemsFromArray } from "../common/utils.js"; +import exec from 'k6/execution'; // K6_SCRIPT_FSPIOP_ALS_PAYEE_PARTYID=${__ENV.K6_SCRIPT_FSPIOP_ALS_PAYEE_PARTYID}, @@ -12,29 +12,34 @@ import { Trace } from "../common/trace.js"; // K6_SCRIPT_FSPIOP_PAYEE_FSP_ID=${__ENV.K6_SCRIPT_FSPIOP_PAYEE_FSP_ID}, // K6_SCRIPT_CALLBACK_HANDLER_SERVICE_WS_URL=${__ENV.K6_SCRIPT_CALLBACK_HANDLER_SERVICE_WS_URL}, -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} -`); + +function log() { + console.log('Env Vars -->'); + console.log(` K6_SCRIPT_WS_TIMEOUT_MS=${__ENV.K6_SCRIPT_WS_TIMEOUT_MS}`); + console.log(` K6_SCRIPT_FSPIOP_ALS_ENDPOINT_URL=${__ENV.K6_SCRIPT_FSPIOP_ALS_ENDPOINT_URL}`); + console.log(` K6_SCRIPT_ADMIN_ENDPOINT_URL=${__ENV.K6_SCRIPT_ADMIN_ENDPOINT_URL}`); + console.log(` K6_SCRIPT_ORACLE_ENDPOINT_URL=${__ENV.K6_SCRIPT_ORACLE_ENDPOINT_URL}`); + console.log(` K6_SCRIPT_FSPIOP_FSP_POOL=${__ENV.K6_SCRIPT_FSPIOP_FSP_PAYER_POOL}`); +} const fspList = JSON.parse(__ENV.K6_SCRIPT_FSPIOP_FSP_POOL) export function getParties() { + !exec.instance.iterationsCompleted && log(); group("Get Parties", function () { let payerFsp let payeeFsp + if (__ENV.UNIDIRECTIONAL === "true" || __ENV.UNIDIRECTIONAL === "TRUE") { payerFsp = fspList[0] payeeFsp = fspList[1] } else { - const randomSortedFsp = fspList.concat().sort(() => randomItem([-1,1])).slice(0, 2); - payerFsp = randomSortedFsp[0] - payeeFsp = randomSortedFsp[1] + const selectedFsps = getTwoItemsFromArray(fspList) + payerFsp = selectedFsps[0] + payeeFsp = selectedFsps[1] } + const startTs = Date.now(); const payeeId = payeeFsp['partyId']; const payerFspId = payerFsp['fspId']; @@ -44,7 +49,7 @@ export function getParties() { const traceId = traceParent.traceId; const wsChannel = `${traceParent.traceId}/PUT/parties/MSISDN/${payeeId}`; const wsURL = `${wsUrl}/${wsChannel}` - const ws = new WebSocket(wsURL); + const ws = new WebSocket(wsURL, null, {tags: {name: 'parties ws'}}); const wsTimeoutMs = Number(__ENV.K6_SCRIPT_WS_TIMEOUT_MS) || 2000; // user session between 5s and 1m var wsTimeoutId = null; @@ -65,7 +70,7 @@ export function getParties() { }); ws.onmessage = (event) => { - console.info(traceId, `WS message received [${wsChannel}]: ${event.data}`); + __ENV.K6_DEBUG && console.info(traceId, `WS message received [${wsChannel}]: ${event.data}`); check(event.data, { 'ALS_E2E_FSPIOP_GET_PARTIES_SUCCESS': (cbMessage) => cbMessage == 'SUCCESS_CALLBACK_RECEIVED' }); clearTimers(); ws.close(); @@ -73,9 +78,10 @@ export function getParties() { }; ws.onopen = () => { - console.info(traceId, `WS open on URL: ${wsURL}`); + __ENV.K6_DEBUG && console.info(traceId, `WS open on URL: ${wsURL}`); const params = { tags: { + name: 'parties', payerFspId, payeeFspId }, diff --git a/packages/k6-tests/scripts/getPartiesNoCallback.js b/packages/k6-tests/scripts/getPartiesNoCallback.js new file mode 100644 index 00000000..c8265d83 --- /dev/null +++ b/packages/k6-tests/scripts/getPartiesNoCallback.js @@ -0,0 +1,55 @@ +import http from 'k6/http'; +import { check, group } from 'k6'; +import { Trace } from "../common/trace.js"; +import { getTwoItemsFromArray } from "../common/utils.js"; +import exec from 'k6/execution'; + +function log() { + console.log('Env Vars -->'); + console.log(` K6_SCRIPT_FSPIOP_TRANSFERS_ENDPOINT_URL=${__ENV.K6_SCRIPT_FSPIOP_TRANSFERS_ENDPOINT_URL}`); + console.log(` K6_SCRIPT_FSPIOP_FSP_POOL=${__ENV.K6_SCRIPT_FSPIOP_FSP_POOL}`); +} + +const fspList = JSON.parse(__ENV.K6_SCRIPT_FSPIOP_FSP_POOL) + +export function getPartiesNoCallback() { + !exec.instance.iterationsCompleted && log(); + group("getPartiesNoCallback", 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 startTs = Date.now(); + const payeeId = payeeFsp['partyId']; + const payerFspId = payerFsp['fspId']; + const payeeFspId = payeeFsp['fspId']; + const traceParent = Trace(); + + 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=${startTs}` + }, + // timeout: '1s' + }; + + // Lets send the FSPIOP GET /parties request to the ALS + 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 }); + }); +} \ No newline at end of file diff --git a/packages/k6-tests/scripts/inboundSDKGetParties.js b/packages/k6-tests/scripts/inboundSDKGetParties.js index 8599b4af..776bfad4 100644 --- a/packages/k6-tests/scripts/inboundSDKGetParties.js +++ b/packages/k6-tests/scripts/inboundSDKGetParties.js @@ -1,20 +1,22 @@ import http from 'k6/http'; import { check, fail, sleep, group } from 'k6'; import { WebSocket } from 'k6/experimental/websockets'; -import { setTimeout, clearTimeout } from 'k6/experimental/timers'; +import { setTimeout, clearTimeout } from 'k6/timers'; import { randomItem } from "https://jslib.k6.io/k6-utils/1.1.0/index.js"; import { Trace } from "../common/trace.js"; +import exec from 'k6/execution'; - -console.log(`Env Vars --> - K6_SCRIPT_WS_TIMEOUT_MS=${__ENV.K6_SCRIPT_WS_TIMEOUT_MS}, - K6_SCRIPT_SDK_ENDPOINT_URL=${__ENV.K6_SCRIPT_SDK_ENDPOINT_URL}, - K6_SCRIPT_FSPIOP_FSP_POOL=${__ENV.K6_SCRIPT_FSPIOP_FSP_POOL} -`); +function log() { + console.log('Env Vars -->'); + console.log(` K6_SCRIPT_WS_TIMEOUT_MS=${__ENV.K6_SCRIPT_WS_TIMEOUT_MS}`); + console.log(` K6_SCRIPT_SDK_ENDPOINT_URL=${__ENV.K6_SCRIPT_SDK_ENDPOINT_URL}`); + console.log(` K6_SCRIPT_FSPIOP_FSP_POOL=${__ENV.K6_SCRIPT_FSPIOP_FSP_POOL}`); +} const fspList = JSON.parse(__ENV.K6_SCRIPT_FSPIOP_FSP_POOL) export function getParties() { + !exec.instance.iterationsCompleted && log(); group("Get Parties", function () { let payerFsp let payeeFsp @@ -58,7 +60,7 @@ export function getParties() { }); ws.onmessage = (event) => { - console.info(traceId, `WS message received [${wsChannel}]: ${event.data}`); + __ENV.K6_DEBUG && console.info(traceId, `WS message received [${wsChannel}]: ${event.data}`); check(event.data, { 'SDK_GET_PARTIES_SUCCESS': (cbMessage) => cbMessage == 'SUCCESS_CALLBACK_RECEIVED' }); clearTimers(); ws.close(); diff --git a/packages/k6-tests/scripts/inboundSDKQuotes.js b/packages/k6-tests/scripts/inboundSDKQuotes.js index 4dc4b436..79389efd 100644 --- a/packages/k6-tests/scripts/inboundSDKQuotes.js +++ b/packages/k6-tests/scripts/inboundSDKQuotes.js @@ -2,21 +2,24 @@ import http from 'k6/http'; import { crypto } from "k6/experimental/webcrypto"; import { check, fail, sleep, group } from 'k6'; import { WebSocket } from 'k6/experimental/websockets'; -import { setTimeout, clearTimeout, setInterval, clearInterval } from 'k6/experimental/timers'; +import { setTimeout, clearTimeout, setInterval, clearInterval } from 'k6/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_SDK_ENDPOINT_URL=${__ENV.K6_SCRIPT_SDK_ENDPOINT_URL}, - K6_SCRIPT_FSPIOP_FSP_POOL=${__ENV.K6_SCRIPT_FSPIOP_FSP_POOL} -`); +function log() { + console.log('Env Vars -->'); + console.log(` K6_SCRIPT_WS_TIMEOUT_MS=${__ENV.K6_SCRIPT_WS_TIMEOUT_MS}`); + console.log(` K6_SCRIPT_SDK_ENDPOINT_URL=${__ENV.K6_SCRIPT_SDK_ENDPOINT_URL}`); + console.log(` K6_SCRIPT_FSPIOP_FSP_POOL=${__ENV.K6_SCRIPT_FSPIOP_FSP_POOL}`); +} const fspList = JSON.parse(__ENV.K6_SCRIPT_FSPIOP_FSP_POOL) const amount = __ENV.K6_SCRIPT_FSPIOP_QUOTES_AMOUNT.toString() const currency = __ENV.K6_SCRIPT_FSPIOP_QUOTES_CURRENCY export function postQuotes() { + !exec.instance.iterationsCompleted && log(); group("Post Quotes", function () { let payerFsp let payeeFsp @@ -63,7 +66,7 @@ export function postQuotes() { }); ws.onmessage = (event) => { - console.info(traceId, `WS message received [${wsChannel}]: ${event.data}`); + __ENV.K6_DEBUG && console.info(traceId, `WS message received [${wsChannel}]: ${event.data}`); check(event.data, { 'QUOTES_E2E_FSPIOP_POST_QUOTES_SUCCESS': (cbMessage) => cbMessage == 'SUCCESS_CALLBACK_RECEIVED' }); clearTimers(); ws.close(); diff --git a/packages/k6-tests/scripts/inboundSDKTransfers.js b/packages/k6-tests/scripts/inboundSDKTransfers.js index b4f551da..56a0fd83 100644 --- a/packages/k6-tests/scripts/inboundSDKTransfers.js +++ b/packages/k6-tests/scripts/inboundSDKTransfers.js @@ -3,16 +3,17 @@ import { crypto } from "k6/experimental/webcrypto"; import { check, fail, sleep, group } from 'k6'; import exec from 'k6/execution'; import { WebSocket } from 'k6/experimental/websockets'; -import { setTimeout, clearTimeout, setInterval, clearInterval } from 'k6/experimental/timers'; +import { setTimeout, clearTimeout, setInterval, clearInterval } from 'k6/timers'; import { Trace } from "../common/trace.js"; import { getTwoItemsFromArray } from "../common/utils.js"; -console.log(`Env Vars --> - K6_SCRIPT_WS_TIMEOUT_MS=${__ENV.K6_SCRIPT_WS_TIMEOUT_MS}, - K6_SCRIPT_SDK_ENDPOINT_URL=${__ENV.K6_SCRIPT_SDK_ENDPOINT_URL}, - K6_SCRIPT_FSPIOP_FSP_POOL=${__ENV.K6_SCRIPT_FSPIOP_FSP_POOL}, - K6_SCRIPT_ABORT_ON_ERROR=${__ENV.K6_SCRIPT_ABORT_ON_ERROR} -`); +function log() { + console.log('Env Vars -->'); + console.log(` K6_SCRIPT_WS_TIMEOUT_MS=${__ENV.K6_SCRIPT_WS_TIMEOUT_MS}`); + console.log(` K6_SCRIPT_SDK_ENDPOINT_URL=${__ENV.K6_SCRIPT_SDK_ENDPOINT_URL}`); + console.log(` K6_SCRIPT_FSPIOP_FSP_POOL=${__ENV.K6_SCRIPT_FSPIOP_FSP_POOL}`); + console.log(` K6_SCRIPT_ABORT_ON_ERROR=${__ENV.K6_SCRIPT_ABORT_ON_ERROR}`); +} const fspList = JSON.parse(__ENV.K6_SCRIPT_FSPIOP_FSP_POOL) @@ -23,6 +24,7 @@ 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 postTransfers() { + !exec.instance.iterationsCompleted && log(); group("Post Transfers", function () { let payerFsp let payeeFsp @@ -66,7 +68,7 @@ export function postTransfers() { }); ws.onmessage = (event) => { - console.info(traceId, `WS message received [${wsChannel}]: ${event.data}`); + __ENV.K6_DEBUG && console.info(traceId, `WS message received [${wsChannel}]: ${event.data}`); check(event.data, { 'TRANSFERS_E2E_FSPIOP_POST_TRANSFERS_SUCCESS': (cbMessage) => cbMessage == 'SUCCESS_CALLBACK_RECEIVED' }); clearTimers(); ws.close(); @@ -74,7 +76,7 @@ export function postTransfers() { }; ws.onopen = () => { - console.info(traceId, `WS open on URL: ${wsURL}`); + __ENV.K6_DEBUG && console.info(traceId, `WS open on URL: ${wsURL}`); const params = { tags: { payerFspId, diff --git a/packages/k6-tests/scripts/outboundSDKGetParties.js b/packages/k6-tests/scripts/outboundSDKGetParties.js index 382d18b5..45a5295b 100644 --- a/packages/k6-tests/scripts/outboundSDKGetParties.js +++ b/packages/k6-tests/scripts/outboundSDKGetParties.js @@ -1,19 +1,22 @@ import http from 'k6/http'; import { check, group } from 'k6'; import { getTwoItemsFromArray } from "../common/utils.js"; +import exec from 'k6/execution'; -console.log(`Env Vars --> - K6_SCRIPT_FSPIOP_FSP_POOL=${__ENV.K6_SCRIPT_FSPIOP_FSP_POOL}, - K6_SCRIPT_SDK_ENDPOINT_URL=${__ENV.K6_SCRIPT_SDK_ENDPOINT_URL}, -`); +function log() { + console.log('Env Vars -->'); + console.log(` K6_SCRIPT_FSPIOP_FSP_POOL=${__ENV.K6_SCRIPT_FSPIOP_FSP_POOL}`); + console.log(` K6_SCRIPT_SDK_ENDPOINT_URL=${__ENV.K6_SCRIPT_SDK_ENDPOINT_URL},`); +} const fspList = JSON.parse(__ENV.K6_SCRIPT_FSPIOP_FSP_POOL) export function getParties() { + !exec.instance.iterationsCompleted && log(); group("Get Parties", function () { let payerFsp let payeeFsp - + if (__ENV.UNIDIRECTIONAL === "true" || __ENV.UNIDIRECTIONAL === "TRUE") { payerFsp = fspList[0] payeeFsp = fspList[1] @@ -26,7 +29,7 @@ export function getParties() { const payeeId = payeeFsp['partyId']; const payerFspId = payerFsp['fspId']; const payeeFspId = payeeFsp['fspId']; - + const params = { tags: { payerFspId, diff --git a/packages/k6-tests/scripts/outboundSDKQuotes.js b/packages/k6-tests/scripts/outboundSDKQuotes.js index ca949fa0..011935c2 100644 --- a/packages/k6-tests/scripts/outboundSDKQuotes.js +++ b/packages/k6-tests/scripts/outboundSDKQuotes.js @@ -2,17 +2,20 @@ import http from 'k6/http'; import { crypto } from "k6/experimental/webcrypto"; import { check, group } from 'k6'; import { getTwoItemsFromArray } from "../common/utils.js"; +import exec from 'k6/execution'; -console.log(`Env Vars --> - K6_SCRIPT_FSPIOP_FSP_POOL=${__ENV.K6_SCRIPT_FSPIOP_FSP_POOL}, - K6_SCRIPT_SDK_ENDPOINT_URL=${__ENV.K6_SCRIPT_SDK_ENDPOINT_URL}, -`); +function log() { + console.log('Env Vars -->'); + console.log(` K6_SCRIPT_FSPIOP_FSP_POOL=${__ENV.K6_SCRIPT_FSPIOP_FSP_POOL}`); + console.log(` K6_SCRIPT_SDK_ENDPOINT_URL=${__ENV.K6_SCRIPT_SDK_ENDPOINT_URL},`); +} const fspList = JSON.parse(__ENV.K6_SCRIPT_FSPIOP_FSP_POOL) const amount = __ENV.K6_SCRIPT_FSPIOP_QUOTES_AMOUNT.toString() const currency = __ENV.K6_SCRIPT_FSPIOP_QUOTES_CURRENCY export function postQuotes() { + !exec.instance.iterationsCompleted && log(); group("Post Quotes", function () { let payerFsp let payeeFsp diff --git a/packages/k6-tests/scripts/outboundSDKTransfers.js b/packages/k6-tests/scripts/outboundSDKTransfers.js index c0782e70..cf65a160 100644 --- a/packages/k6-tests/scripts/outboundSDKTransfers.js +++ b/packages/k6-tests/scripts/outboundSDKTransfers.js @@ -3,17 +3,19 @@ import { check, group } from 'k6'; import exec from 'k6/execution'; import { getTwoItemsFromArray } from "../common/utils.js"; -console.log(`Env Vars --> - K6_SCRIPT_FSPIOP_FSP_POOL=${__ENV.K6_SCRIPT_FSPIOP_FSP_POOL}, - K6_SCRIPT_ABORT_ON_ERROR=${__ENV.K6_SCRIPT_ABORT_ON_ERROR}, - K6_SCRIPT_SDK_ENDPOINT_URL=${__ENV.K6_SCRIPT_SDK_ENDPOINT_URL} -`); +function log() { + console.log('Env Vars -->'); + console.log(` K6_SCRIPT_FSPIOP_FSP_POOL=${__ENV.K6_SCRIPT_FSPIOP_FSP_POOL}`); + console.log(` K6_SCRIPT_ABORT_ON_ERROR=${__ENV.K6_SCRIPT_ABORT_ON_ERROR}`); + console.log(` K6_SCRIPT_SDK_ENDPOINT_URL=${__ENV.K6_SCRIPT_SDK_ENDPOINT_URL}`); +} const fspList = JSON.parse(__ENV.K6_SCRIPT_FSPIOP_FSP_POOL) const abortOnError = (__ENV.K6_SCRIPT_ABORT_ON_ERROR && __ENV.K6_SCRIPT_ABORT_ON_ERROR.toLowerCase() === 'true') ? true : false export function postTransfers() { + !exec.instance.iterationsCompleted && log(); group("Post Transfers", function () { let payerFsp let payeeFsp @@ -65,7 +67,7 @@ export function postTransfers() { // Lets send the FSPIOP POST /transfers request const postTransferResponse = http.post(`${__ENV.K6_SCRIPT_SDK_ENDPOINT_URL}/transfers`, JSON.stringify(body), params); check(postTransferResponse, { 'TRANSFERS__POST_TRANSFERS_RESPONSE_IS_200' : (r) => r.status == 200 }); - + const transferId = JSON.parse(postTransferResponse.body).transferId if (postTransferResponse.status == 200) { diff --git a/packages/k6-tests/scripts/parallelRequests.js b/packages/k6-tests/scripts/parallelRequests.js new file mode 100644 index 00000000..9536aeba --- /dev/null +++ b/packages/k6-tests/scripts/parallelRequests.js @@ -0,0 +1,207 @@ +import http from 'k6/http'; +import { check, group } from 'k6'; +import { Trace } from "../common/trace.js"; +import { getTwoItemsFromArray } from "../common/utils.js"; +import { crypto } from "k6/experimental/webcrypto"; +import exec from 'k6/execution'; + + +// K6_SCRIPT_FSPIOP_ALS_PAYEE_PARTYID=${__ENV.K6_SCRIPT_FSPIOP_ALS_PAYEE_PARTYID}, +// K6_SCRIPT_FSPIOP_PAYER_FSP_ID=${__ENV.K6_SCRIPT_FSPIOP_PAYER_FSP_ID}, +// K6_SCRIPT_FSPIOP_PAYEE_FSP_ID=${__ENV.K6_SCRIPT_FSPIOP_PAYEE_FSP_ID}, +// K6_SCRIPT_CALLBACK_HANDLER_SERVICE_WS_URL=${__ENV.K6_SCRIPT_CALLBACK_HANDLER_SERVICE_WS_URL}, + +function log() { + console.log('Env Vars -->'); + console.log(` K6_SCRIPT_WS_TIMEOUT_MS=${__ENV.K6_SCRIPT_WS_TIMEOUT_MS}`); + console.log(` K6_SCRIPT_FSPIOP_ALS_ENDPOINT_URL=${__ENV.K6_SCRIPT_FSPIOP_ALS_ENDPOINT_URL}`); + console.log(` K6_SCRIPT_ADMIN_ENDPOINT_URL=${__ENV.K6_SCRIPT_ADMIN_ENDPOINT_URL}`); + console.log(` K6_SCRIPT_ORACLE_ENDPOINT_URL=${__ENV.K6_SCRIPT_ORACLE_ENDPOINT_URL}`); + console.log(` K6_SCRIPT_FSPIOP_FSP_POOL=${__ENV.K6_SCRIPT_FSPIOP_FSP_PAYER_POOL}`); +} + +const fspList = JSON.parse(__ENV.K6_SCRIPT_FSPIOP_FSP_POOL) +const amount = __ENV.K6_SCRIPT_FSPIOP_QUOTES_AMOUNT.toString() +const currency = __ENV.K6_SCRIPT_FSPIOP_QUOTES_CURRENCY +const ilpPacket = __ENV.K6_SCRIPT_FSPIOP_TRANSFERS_ILPPACKET +const condition = __ENV.K6_SCRIPT_FSPIOP_TRANSFERS_CONDITION + +export function parallelRequests() { + !exec.instance.iterationsCompleted && log(); + group("parallelRequests", 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 payeeId = payeeFsp['partyId']; + const payerFspId = payerFsp['fspId']; + const payeeFspId = payeeFsp['fspId']; + + const partiesStartTs = Date.now(); + const partiesTraceParent = Trace(); + const partiesParams = { + 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': partiesTraceParent.toString(), + 'tracestate': `tx_end2end_start_ts=${partiesStartTs}` + }, + }; + + const quotesStartTs = Date.now(); + const quotesTraceParent = Trace(); + const quoteId = crypto.randomUUID(); + const transactionId = crypto.randomUUID(); + + const quotesParams = { + 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': quotesTraceParent.toString(), + 'tracestate': `tx_end2end_start_ts=${quotesStartTs}` + }, + }; + + const quotesBody = { + "quoteId": quoteId, + "transactionId": transactionId, + "payer": { + "partyIdInfo": { + "partyIdType": "MSISDN", + "partyIdentifier": `${payerFsp['partyId']}`, + "fspId": payerFspId, + "extensionList": { + "extension": [ + { + "key": "test1", + "value": "test1" + }, + { + "key": "test2", + "value": "test2" + } + ] + } + }, + "personalInfo": { + "complexName": { + "firstName": "Alice", + "middleName": "A", + "lastName": "Alison" + }, + "dateOfBirth": "1970-01-01" + } + }, + "payee": { + "partyIdInfo": { + "partyIdType": "MSISDN", + "partyIdentifier": `${payeeFsp['partyId']}`, + "fspId": payeeFspId, + "extensionList": { + "extension": [ + { + "key": "test3", + "value": "test3" + }, + { + "key": "test4", + "value": "test4" + } + ] + } + }, + "personalInfo": { + "complexName": { + "firstName": "Bob", + "middleName": "B", + "lastName": "Bloggs" + }, + "dateOfBirth": "1970-01-01" + } + }, + "amountType": "SEND", + "amount": { + "amount": `${amount}`, + "currency": `${currency}` + }, + "transactionType": { + "scenario": "TRANSFER", + "initiator": "PAYER", + "initiatorType": "CONSUMER" + }, + "extensionList": { + "extension": [ + { + "key": "quoteExtension1", + "value": "quoteExtension1" + }, + { + "key": "quoteExtension2", + "value": "quoteExtension2" + } + ] + } + } + + + const transfersStartTs = Date.now(); + const transferId = crypto.randomUUID(); + const transfersTraceParent = Trace(); + const transfersParams = { + 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': transfersTraceParent.toString(), + 'tracestate': `tx_end2end_start_ts=${transfersStartTs}` + }, + }; + + const transfersBody = { + "transferId": transferId, + "payerFsp": payerFspId, + "payeeFsp": payeeFspId, + "amount": { + amount, + currency + }, + "expiration": "2030-01-01T00:00:00.000Z", + ilpPacket, + condition + } + + const res = http.batch([ + ['GET', `${__ENV.K6_SCRIPT_FSPIOP_ALS_ENDPOINT_URL}/parties/MSISDN/${payeeId}`, null, partiesParams], + ['POST', `${__ENV.K6_SCRIPT_FSPIOP_QUOTES_ENDPOINT_URL}/quotes`, JSON.stringify(quotesBody), quotesParams], + ['POST', `${__ENV.K6_SCRIPT_FSPIOP_TRANSFERS_ENDPOINT_URL}/transfers`, JSON.stringify(transfersBody), transfersParams] + ]) + check(res[0], { 'ALS_FSPIOP_GET_PARTIES_RESPONSE_IS_202' : (r) => r.status == 202 }); + check(res[1], { 'QUOTES_FSPIOP_POST_QUOTES_RESPONSE_IS_202' : (r) => r.status == 202 }); + check(res[2], { 'TRANSFERS_FSPIOP_POST_TRANSFERS_RESPONSE_IS_202' : (r) => r.status == 202 }); + }); +} diff --git a/packages/k6-tests/scripts/postQuotes.js b/packages/k6-tests/scripts/postQuotes.js index eced5d12..22a0940e 100644 --- a/packages/k6-tests/scripts/postQuotes.js +++ b/packages/k6-tests/scripts/postQuotes.js @@ -1,22 +1,26 @@ import http from 'k6/http'; -import { crypto } from "k6/experimental/webcrypto"; +// import { crypto } from "k6/experimental/webcrypto"; import { check, fail, sleep, group } from 'k6'; import { WebSocket } from 'k6/experimental/websockets'; -import { setTimeout, clearTimeout, setInterval, clearInterval } from 'k6/experimental/timers'; +import { setTimeout, clearTimeout, setInterval, clearInterval } from 'k6/timers'; import { Trace } from "../common/trace.js"; import { getTwoItemsFromArray } from "../common/utils.js"; +import { uuid } from '../common/uuid.js' +import exec from 'k6/execution'; -console.log(`Env Vars --> - K6_SCRIPT_WS_TIMEOUT_MS=${__ENV.K6_SCRIPT_WS_TIMEOUT_MS}, - K6_SCRIPT_FSPIOP_QUOTES_ENDPOINT_URL=${__ENV.K6_SCRIPT_FSPIOP_QUOTES_ENDPOINT_URL}, - K6_SCRIPT_FSPIOP_FSP_POOL=${__ENV.K6_SCRIPT_FSPIOP_FSP_POOL} -`); +function log() { + console.log(`Env Vars -->`); + console.log(` K6_SCRIPT_WS_TIMEOUT_MS=${__ENV.K6_SCRIPT_WS_TIMEOUT_MS}`); + console.log(` K6_SCRIPT_FSPIOP_QUOTES_ENDPOINT_URL=${__ENV.K6_SCRIPT_FSPIOP_QUOTES_ENDPOINT_URL}`); + console.log(` K6_SCRIPT_FSPIOP_FSP_POOL=${__ENV.K6_SCRIPT_FSPIOP_FSP_POOL}`); +} const fspList = JSON.parse(__ENV.K6_SCRIPT_FSPIOP_FSP_POOL) const amount = __ENV.K6_SCRIPT_FSPIOP_QUOTES_AMOUNT.toString() const currency = __ENV.K6_SCRIPT_FSPIOP_QUOTES_CURRENCY export function postQuotes() { + !exec.instance.iterationsCompleted && log(); group("Post Quotes", function () { let payerFsp let payeeFsp @@ -31,8 +35,10 @@ export function postQuotes() { } const startTs = Date.now(); - const quoteId = crypto.randomUUID(); - const transactionId = crypto.randomUUID(); + // const quoteId = crypto.randomUUID(); + // const transactionId = crypto.randomUUID(); + const quoteId = uuid(); + const transactionId = uuid(); const payerFspId = payerFsp['fspId']; const payeeFspId = payeeFsp['fspId']; const wsUrl = payerFsp['wsUrl']; @@ -40,7 +46,7 @@ export function postQuotes() { const traceId = traceParent.traceId; const wsChannel = `${traceParent.traceId}/PUT/quotes/${quoteId}`; const wsURL = `${wsUrl}/${wsChannel}` - const ws = new WebSocket(wsURL); + const ws = new WebSocket(wsURL, null, {tags: {name: 'quotes ws'}}); const wsTimeoutMs = Number(__ENV.K6_SCRIPT_WS_TIMEOUT_MS) || 2000; // user session between 5s and 1m var wsTimeoutId = null; @@ -61,7 +67,7 @@ export function postQuotes() { }); ws.onmessage = (event) => { - console.info(traceId, `WS message received [${wsChannel}]: ${event.data}`); + __ENV.K6_DEBUG && console.info(traceId, `WS message received [${wsChannel}]: ${event.data}`); check(event.data, { 'QUOTES_E2E_FSPIOP_POST_QUOTES_SUCCESS': (cbMessage) => cbMessage == 'SUCCESS_CALLBACK_RECEIVED' }); clearTimers(); ws.close(); @@ -69,7 +75,7 @@ export function postQuotes() { }; ws.onopen = () => { - console.info(traceId, `WS open on URL: ${wsURL}`); + __ENV.K6_DEBUG && console.info(traceId, `WS open on URL: ${wsURL}`); const params = { tags: { payerFspId, diff --git a/packages/k6-tests/scripts/postQuotesNoCallback.js b/packages/k6-tests/scripts/postQuotesNoCallback.js new file mode 100644 index 00000000..938d10d4 --- /dev/null +++ b/packages/k6-tests/scripts/postQuotesNoCallback.js @@ -0,0 +1,146 @@ +import http from 'k6/http'; +// import { crypto } from "k6/experimental/webcrypto"; +import { check, group } from 'k6'; +import { Trace } from "../common/trace.js"; +import { getTwoItemsFromArray } from "../common/utils.js"; +import { uuid } from '../common/uuid.js' +import exec from 'k6/execution'; + +function log() { + console.log('Env Vars -->'); + console.log(` K6_SCRIPT_WS_TIMEOUT_MS=${__ENV.K6_SCRIPT_WS_TIMEOUT_MS}`); + console.log(` K6_SCRIPT_FSPIOP_QUOTES_ENDPOINT_URL=${__ENV.K6_SCRIPT_FSPIOP_QUOTES_ENDPOINT_URL}`); + console.log(` K6_SCRIPT_FSPIOP_FSP_POOL=${__ENV.K6_SCRIPT_FSPIOP_FSP_POOL}`); +} + +const fspList = JSON.parse(__ENV.K6_SCRIPT_FSPIOP_FSP_POOL) +const amount = __ENV.K6_SCRIPT_FSPIOP_QUOTES_AMOUNT.toString() +const currency = __ENV.K6_SCRIPT_FSPIOP_QUOTES_CURRENCY + +export function postQuotesNoCallback() { + !exec.instance.iterationsCompleted && log(); + group("postQuotesNoCallback", 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 startTs = Date.now(); + // const quoteId = crypto.randomUUID(); + // const transactionId = crypto.randomUUID(); + const quoteId = uuid(); + const transactionId = uuid(); + const payerFspId = payerFsp['fspId']; + const payeeFspId = payeeFsp['fspId']; + const traceParent = Trace(); + + 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=${startTs}` + }, + }; + + const body = { + "quoteId": quoteId, + "transactionId": transactionId, + "payer": { + "partyIdInfo": { + "partyIdType": "MSISDN", + "partyIdentifier": `${payerFsp['partyId']}`, + "fspId": payerFspId, + "extensionList": { + "extension": [ + { + "key": "test1", + "value": "test1" + }, + { + "key": "test2", + "value": "test2" + } + ] + } + }, + "personalInfo": { + "complexName": { + "firstName": "Alice", + "middleName": "A", + "lastName": "Alison" + }, + "dateOfBirth": "1970-01-01" + } + }, + "payee": { + "partyIdInfo": { + "partyIdType": "MSISDN", + "partyIdentifier": `${payeeFsp['partyId']}`, + "fspId": payeeFspId, + "extensionList": { + "extension": [ + { + "key": "test3", + "value": "test3" + }, + { + "key": "test4", + "value": "test4" + } + ] + } + }, + "personalInfo": { + "complexName": { + "firstName": "Bob", + "middleName": "B", + "lastName": "Bloggs" + }, + "dateOfBirth": "1970-01-01" + } + }, + "amountType": "SEND", + "amount": { + "amount": `${amount}`, + "currency": `${currency}` + }, + "transactionType": { + "scenario": "TRANSFER", + "initiator": "PAYER", + "initiatorType": "CONSUMER" + }, + "extensionList": { + "extension": [ + { + "key": "quoteExtension1", + "value": "quoteExtension1" + }, + { + "key": "quoteExtension2", + "value": "quoteExtension2" + } + ] + } + } + + + // 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 }); + }); +} diff --git a/packages/k6-tests/scripts/postQuotesPersonalInfoExtensions.js b/packages/k6-tests/scripts/postQuotesPersonalInfoExtensions.js index 4f881b8f..ad23c1c7 100644 --- a/packages/k6-tests/scripts/postQuotesPersonalInfoExtensions.js +++ b/packages/k6-tests/scripts/postQuotesPersonalInfoExtensions.js @@ -2,21 +2,24 @@ import http from 'k6/http'; import { crypto } from "k6/experimental/webcrypto"; import { check, fail, sleep, group } from 'k6'; import { WebSocket } from 'k6/experimental/websockets'; -import { setTimeout, clearTimeout, setInterval, clearInterval } from 'k6/experimental/timers'; +import { setTimeout, clearTimeout, setInterval, clearInterval } from 'k6/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_QUOTES_ENDPOINT_URL=${__ENV.K6_SCRIPT_FSPIOP_QUOTES_ENDPOINT_URL}, - K6_SCRIPT_FSPIOP_FSP_POOL=${__ENV.K6_SCRIPT_FSPIOP_FSP_POOL} -`); +function log() { + console.log('Env Vars -->'); + console.log(` K6_SCRIPT_WS_TIMEOUT_MS=${__ENV.K6_SCRIPT_WS_TIMEOUT_MS}`); + console.log(` K6_SCRIPT_FSPIOP_QUOTES_ENDPOINT_URL=${__ENV.K6_SCRIPT_FSPIOP_QUOTES_ENDPOINT_URL}`); + console.log(` K6_SCRIPT_FSPIOP_FSP_POOL=${__ENV.K6_SCRIPT_FSPIOP_FSP_POOL}`); +} const fspList = JSON.parse(__ENV.K6_SCRIPT_FSPIOP_FSP_POOL) const amount = __ENV.K6_SCRIPT_FSPIOP_QUOTES_AMOUNT.toString() const currency = __ENV.K6_SCRIPT_FSPIOP_QUOTES_CURRENCY export function postQuotes() { + !exec.instance.iterationsCompleted && log(); group("Post Quotes", function () { let payerFsp let payeeFsp @@ -61,7 +64,7 @@ export function postQuotes() { }); ws.onmessage = (event) => { - console.info(traceId, `WS message received [${wsChannel}]: ${event.data}`); + __ENV.K6_DEBUG && console.info(traceId, `WS message received [${wsChannel}]: ${event.data}`); check(event.data, { 'QUOTES_E2E_FSPIOP_POST_QUOTES_SUCCESS': (cbMessage) => cbMessage == 'SUCCESS_CALLBACK_RECEIVED' }); clearTimers(); ws.close(); @@ -69,7 +72,7 @@ export function postQuotes() { }; ws.onopen = () => { - console.info(traceId, `WS open on URL: ${wsURL}`); + __ENV.K6_DEBUG && console.info(traceId, `WS open on URL: ${wsURL}`); const params = { tags: { payerFspId, diff --git a/packages/k6-tests/scripts/postTransfers.js b/packages/k6-tests/scripts/postTransfers.js index 393f368b..e9d28fbe 100644 --- a/packages/k6-tests/scripts/postTransfers.js +++ b/packages/k6-tests/scripts/postTransfers.js @@ -3,16 +3,18 @@ import { crypto } from "k6/experimental/webcrypto"; import { check, fail, sleep, group } from 'k6'; import exec from 'k6/execution'; import { WebSocket } from 'k6/experimental/websockets'; -import { setTimeout, clearTimeout, setInterval, clearInterval } from 'k6/experimental/timers'; +import { setTimeout, clearTimeout, setInterval, clearInterval } from 'k6/timers'; import { Trace } from "../common/trace.js"; import { getTwoItemsFromArray } from "../common/utils.js"; - -console.log(`Env Vars --> - K6_SCRIPT_WS_TIMEOUT_MS=${__ENV.K6_SCRIPT_WS_TIMEOUT_MS}, - K6_SCRIPT_FSPIOP_TRANSFERS_ENDPOINT_URL=${__ENV.K6_SCRIPT_FSPIOP_TRANSFERS_ENDPOINT_URL}, - K6_SCRIPT_FSPIOP_FSP_POOL=${__ENV.K6_SCRIPT_FSPIOP_FSP_POOL}, - K6_SCRIPT_ABORT_ON_ERROR=${__ENV.K6_SCRIPT_ABORT_ON_ERROR} -`); +import { uuid } from '../common/uuid.js' + +function log() { + console.log('Env Vars -->'); + console.log(` K6_SCRIPT_WS_TIMEOUT_MS=${__ENV.K6_SCRIPT_WS_TIMEOUT_MS}`); + console.log(` K6_SCRIPT_FSPIOP_TRANSFERS_ENDPOINT_URL=${__ENV.K6_SCRIPT_FSPIOP_TRANSFERS_ENDPOINT_URL}`); + console.log(` K6_SCRIPT_FSPIOP_FSP_POOL=${__ENV.K6_SCRIPT_FSPIOP_FSP_POOL}`); + console.log(` K6_SCRIPT_ABORT_ON_ERROR=${__ENV.K6_SCRIPT_ABORT_ON_ERROR}`); +} const fspList = JSON.parse(__ENV.K6_SCRIPT_FSPIOP_FSP_POOL) @@ -23,6 +25,7 @@ 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 postTransfers() { + !exec.instance.iterationsCompleted && log(); group("Post Transfers", function () { let payerFsp let payeeFsp @@ -37,7 +40,8 @@ export function postTransfers() { } const startTs = Date.now(); - const transferId = crypto.randomUUID(); + // const transferId = crypto.randomUUID(); + const transferId = uuid(); const payerFspId = payerFsp['fspId']; const payeeFspId = payeeFsp['fspId']; const wsUrl = payerFsp['wsUrl']; @@ -45,7 +49,7 @@ export function postTransfers() { const traceId = traceParent.traceId; const wsChannel = `${traceParent.traceId}/PUT/transfers/${transferId}`; const wsURL = `${wsUrl}/${wsChannel}` - const ws = new WebSocket(wsURL); + const ws = new WebSocket(wsURL, null, {tags: {name: 'transfers ws'}}); const wsTimeoutMs = Number(__ENV.K6_SCRIPT_WS_TIMEOUT_MS) || 2000; // user session between 5s and 1m var wsTimeoutId = null; @@ -66,7 +70,7 @@ export function postTransfers() { }); ws.onmessage = (event) => { - console.info(traceId, `WS message received [${wsChannel}]: ${event.data}`); + __ENV.K6_DEBUG && console.info(traceId, `WS message received [${wsChannel}]: ${event.data}`); check(event.data, { 'TRANSFERS_E2E_FSPIOP_POST_TRANSFERS_SUCCESS': (cbMessage) => cbMessage == 'SUCCESS_CALLBACK_RECEIVED' }); clearTimers(); ws.close(); @@ -74,7 +78,7 @@ export function postTransfers() { }; ws.onopen = () => { - console.info(traceId, `WS open on URL: ${wsURL}`); + // __ENV.K6_DEBUG && console.info(traceId, `WS open on URL: ${wsURL}`); const params = { tags: { payerFspId, diff --git a/packages/k6-tests/scripts/postTransfersNoCallback.js b/packages/k6-tests/scripts/postTransfersNoCallback.js index afb255d9..8f1c3e74 100644 --- a/packages/k6-tests/scripts/postTransfersNoCallback.js +++ b/packages/k6-tests/scripts/postTransfersNoCallback.js @@ -1,13 +1,16 @@ import http from 'k6/http'; -import { crypto } from "k6/experimental/webcrypto"; +// import { crypto } from "k6/experimental/webcrypto"; import { check, fail, sleep, group } from 'k6'; import { Trace } from "../common/trace.js"; import { getTwoItemsFromArray } from "../common/utils.js"; +import { uuid } from '../common/uuid.js' +import exec from 'k6/execution'; -console.log(`Env Vars --> - K6_SCRIPT_FSPIOP_TRANSFERS_ENDPOINT_URL=${__ENV.K6_SCRIPT_FSPIOP_TRANSFERS_ENDPOINT_URL}, - K6_SCRIPT_FSPIOP_FSP_POOL=${__ENV.K6_SCRIPT_FSPIOP_FSP_POOL} -`); +function log() { + console.log('Env Vars -->'); + console.log(` K6_SCRIPT_FSPIOP_TRANSFERS_ENDPOINT_URL=${__ENV.K6_SCRIPT_FSPIOP_TRANSFERS_ENDPOINT_URL}`); + console.log(` K6_SCRIPT_FSPIOP_FSP_POOL=${__ENV.K6_SCRIPT_FSPIOP_FSP_POOL}`); +} const fspList = JSON.parse(__ENV.K6_SCRIPT_FSPIOP_FSP_POOL) @@ -17,6 +20,7 @@ const amount = __ENV.K6_SCRIPT_FSPIOP_TRANSFERS_AMOUNT.toString() const currency = __ENV.K6_SCRIPT_FSPIOP_TRANSFERS_CURRENCY export function postTransfersNoCallback() { + !exec.instance.iterationsCompleted && log(); group("Post Transfers", function () { let payerFsp let payeeFsp @@ -31,7 +35,8 @@ export function postTransfersNoCallback() { } const startTs = Date.now(); - const transferId = crypto.randomUUID(); + // const transferId = crypto.randomUUID(); + const transferId = uuid(); const payerFspId = payerFsp['fspId']; const payeeFspId = payeeFsp['fspId']; const traceParent = Trace(); diff --git a/perf-test.sh b/perf-test.sh new file mode 100755 index 00000000..84dfb5d8 --- /dev/null +++ b/perf-test.sh @@ -0,0 +1,84 @@ +#!/bin/bash +export K6_SCRIPT_CONFIG_FOLDER_NAME="config-k8s" + +args="$1$2" + +case "$args" in +discovery) + echo "Testing single account discovery" + env K6_SCRIPT_CONFIG_FILE_NAME=fspiopDiscoverySingle.json docker compose --project-name load -f docker-compose-load.yml up +;; +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 +;; +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 +;; +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 +;; +dqtrate) + echo "Testing account discoveries, quotes and transfers in parallel with constant rates" + env K6_SCRIPT_CONFIG_FILE_NAME=fspiopDQTRampingRate.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 +;; +e2esingle) + echo "Testing single end to end" + env K6_SCRIPT_CONFIG_FILE_NAME=fspiopE2Esingle.json docker compose --project-name load -f docker-compose-load.yml up +;; +simstart) + echo "Starting the simulators" + docker compose --project-name simulators -f docker-compose-perf.yml --profile 8dfsp --profile testing-toolkit --profile ttk-provisioning-remote-k8s --profile oracle up -d +;; +simstop) + echo "Stopping the simulators" + docker compose --project-name simulators -f docker-compose-perf.yml --profile 8dfsp --profile testing-toolkit --profile oracle down -v +;; +simrestart) + echo "Restartung the simulators" + docker compose --project-name simulators -f docker-compose-perf.yml --profile 8dfsp --profile testing-toolkit --profile oracle down -v + docker compose --project-name simulators -f docker-compose-perf.yml --profile 8dfsp --profile testing-toolkit --profile ttk-provisioning-remote-k8s --profile oracle up -d +;; +*) + echo "Usage: " + echo " $0 discovery" + echo " $0 discoveries" + echo " $0 discoveries rate" + echo " $0 quote" + echo " $0 quotes" + echo " $0 transfer" + echo " $0 transfers" + echo " $0 e2e" + echo " $0 e2e single" + echo " $0 sim start" + echo " $0 sim stop" + echo " $0 sim restart" + exit 1 +;; +esac diff --git a/perf.env b/perf.env index 8af5c209..34e7a2d6 100644 --- a/perf.env +++ b/perf.env @@ -13,7 +13,7 @@ K6_OUT=experimental-prometheus-rw # Ref: https://k6.io/docs/results-output/real- # K6_SCRIPT_WS_TIMEOUT_MS=10000 K6_SCRIPT_WS_TIMEOUT_MS=5000 # K6_SCRIPT_ABORT_ON_ERROR=true -#### Use this if we want to hit the ALS +#### Use this if we want to hit the ALS in docker-compose # K6_SCRIPT_FSPIOP_ALS_ENDPOINT_URL=http://account-lookup-service:4002 #### Use this if we want to bypass ALS # K6_SCRIPT_FSPIOP_ALS_ENDPOINT_URL=http://sim-perffsp2:3001/fspiop @@ -47,13 +47,12 @@ K6_SCRIPT_FSPIOP_FSP_POOL='[{"partyId":19012345001,"fspId":"perffsp1","wsUrl":"w K6_SCRIPT_ADMIN_ENDPOINT_URL=http://callback-handler-svc-cl-sim:3001/admin K6_SCRIPT_ORACLE_ENDPOINT_URL=http://callback-handler-svc-oracle-sim:3001/oracle -K6_SCRIPT_FSPIOP_TRANSFERS_ENDPOINT_URL=http://ml-api-adapter:3000 -# K6_SCRIPT_FSPIOP_TRANSFERS_ENDPOINT_URL=http://sim-perffsp2:3001/fspiop - K6_SCRIPT_FSPIOP_QUOTES_ENDPOINT_URL=http://quoting-service:3002 K6_SCRIPT_FSPIOP_QUOTES_AMOUNT=2 K6_SCRIPT_FSPIOP_QUOTES_CURRENCY=USD +K6_SCRIPT_FSPIOP_TRANSFERS_ENDPOINT_URL=http://ml-api-adapter:3000 +# K6_SCRIPT_FSPIOP_TRANSFERS_ENDPOINT_URL=http://sim-perffsp2:3001/fspiop K6_SCRIPT_FSPIOP_TRANSFERS_ILPPACKET='AYIDGQAAAAAAACcQIWcuZ3JlZW5iYW5rZnNwLm1zaXNkbi4yNzcxMzgwMzkxMoIC62V5SjBjbUZ1YzJGamRHbHZia2xrSWpvaU1ERXhaR1EyTldZdE5UQXpNeTAwTVdNMkxUazFaR1l0T1RFeFl6WTRPVFExWWpobUlpd2ljWFZ2ZEdWSlpDSTZJbVF3TXpJMU1EVTJMVE0xTldFdE5EUmxNUzFpT1RnMExXWXdZVFExTmpFMFkyRXpPQ0lzSW5CaGVXVmxJanA3SW5CaGNuUjVTV1JKYm1adklqcDdJbkJoY25SNVNXUlVlWEJsSWpvaVRWTkpVMFJPSWl3aWNHRnlkSGxKWkdWdWRHbG1hV1Z5SWpvaU1qYzNNVE00TURNNU1USWlMQ0ptYzNCSlpDSTZJbWR5WldWdVltRnVhMlp6Y0NKOWZTd2ljR0Y1WlhJaU9uc2ljR0Z5ZEhsSlpFbHVabThpT25zaWNHRnlkSGxKWkZSNWNHVWlPaUpOVTBsVFJFNGlMQ0p3WVhKMGVVbGtaVzUwYVdacFpYSWlPaUkwTkRFeU16UTFOamM0T1NJc0ltWnpjRWxrSWpvaWNHbHVhMkpoYm10bWMzQWlmU3dpY0dWeWMyOXVZV3hKYm1adklqcDdJbU52YlhCc1pYaE9ZVzFsSWpwN0ltWnBjbk4wVG1GdFpTSTZJa1pwY25OMGJtRnRaUzFVWlhOMElpd2liR0Z6ZEU1aGJXVWlPaUpNWVhOMGJtRnRaUzFVWlhOMEluMHNJbVJoZEdWUFprSnBjblJvSWpvaU1UazROQzB3TVMwd01TSjlmU3dpWVcxdmRXNTBJanA3SW1OMWNuSmxibU41SWpvaVZWTkVJaXdpWVcxdmRXNTBJam9pTVRBd0luMHNJblJ5WVc1ellXTjBhVzl1Vkhsd1pTSTZleUp6WTJWdVlYSnBieUk2SWxSU1FVNVRSa1ZTSWl3aWFXNXBkR2xoZEc5eUlqb2lVRUZaUlZJaUxDSnBibWwwYVdGMGIzSlVlWEJsSWpvaVEwOU9VMVZOUlZJaWZYMAA' K6_SCRIPT_FSPIOP_TRANSFERS_CONDITION='5m0gq_5dLQlTSSRKQmLpj0MZ1MtWLWgSu1oLGVTJyYs' K6_SCRIPT_FSPIOP_TRANSFERS_AMOUNT=2 diff --git a/perf.override.sample.env b/perf.override.sample.env new file mode 100644 index 00000000..fa7c7736 --- /dev/null +++ b/perf.override.sample.env @@ -0,0 +1,12 @@ +## Uncomment following lines by setting proper values +# K6_SCRIPT_ADMIN_ENDPOINT_URL=https://intapi.example.com/admin +# K6_SCRIPT_FSPIOP_ALS_ENDPOINT_URL=https://intapi.example.com +# K6_SCRIPT_ALS_ADMIN_ENDPOINT_URL=https://intapi.example.com/als-admin +# K6_SCRIPT_ORACLE_ENDPOINT_URL=http://10.10.100.75:30000 +# K6_SCRIPT_FSPIOP_QUOTES_ENDPOINT_URL=https://intapi.example.com +# K6_SCRIPT_FSPIOP_TRANSFERS_ENDPOINT_URL=https://intapi.example.com +# CBH_FSPIOP_TRANSFERS_ENDPOINT_URL=https://intapi.example.com +# CBH_FSPIOP_QUOTES_ENDPOINT_URL=https://intapi.example.com +# CBH_FSPIOP_ALS_ENDPOINT_URL=https://intapi.example.com +# K6_CALLBACK_FQDN=10.10.100.75 +# K6_SCRIPT_WS_TIMEOUT_MS=10000