Skip to content

Commit

Permalink
Merge pull request #470 from wultra/develop
Browse files Browse the repository at this point in the history
Merge develop to master
  • Loading branch information
banterCZ authored Jul 26, 2024
2 parents 9fc53e1 + 18d63b3 commit 1e3db6d
Show file tree
Hide file tree
Showing 87 changed files with 2,417 additions and 1,864 deletions.
5 changes: 5 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,8 @@ updates:
directory: "/"
schedule:
interval: "weekly"
- package-ecosystem: "github-actions"
# Workflow files stored in the default location of `.github/workflows`. (You don't need to specify `/.github/workflows` for `directory`. You can use `directory: "/"`.)
directory: "/"
schedule:
interval: "weekly"
6 changes: 3 additions & 3 deletions .github/workflows/develop_pa-test-internal-testserver-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
INTERNAL_USERNAME: ${{ secrets.JFROG_USERNAME }}
INTERNAL_PASSWORD: ${{ secrets.JFROG_PASSWORD }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3

- name: Log in to ACR
if: ${{ github.actor != 'dependabot[bot]' }}
Expand All @@ -60,7 +60,7 @@ jobs:
cd powerauth-test-server
./copy_liquibase.sh
- name: Build and push container image to ACR
uses: docker/build-push-action@v5
uses: docker/build-push-action@v6
with:
push: ${{ github.actor != 'dependabot[bot]' }}
platforms: linux/amd64,linux/arm64
Expand All @@ -78,7 +78,7 @@ jobs:
password: ${{ secrets.JFROG_CONTAINER_REGISTRY_PASSWORD }}
- name: Build and push container image to JFrog
if: ${{ github.event_name == 'workflow_dispatch' && inputs.jfrog_deploy == true }}
uses: docker/build-push-action@v5
uses: docker/build-push-action@v6
with:
push: ${{ github.event_name == 'workflow_dispatch' && inputs.jfrog_deploy == true }}
platforms: linux/amd64,linux/arm64
Expand Down
22 changes: 22 additions & 0 deletions .github/workflows/maven-deploy-fido2-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Deploy FIDO2 Tests with Maven

on:
workflow_dispatch:
branches:
- 'develop'
- 'master'
- 'releases/*'

jobs:
maven-deploy-manual:
if: ${{ github.event_name == 'workflow_dispatch' }}
name: Manual deploy fido2-tests
uses: wultra/wultra-infrastructure/.github/workflows/maven-deploy.yml@develop
with:
environment: internal-publish
release_type: snapshot
directory_path: ./powerauth-fido2-tests
java_version: 21
secrets:
username: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
password: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Deploy with Maven
name: Deploy Test Server with Maven

on:
workflow_dispatch:
Expand All @@ -10,7 +10,7 @@ on:
jobs:
maven-deploy-manual:
if: ${{ github.event_name == 'workflow_dispatch' }}
name: Manual deploy
name: Manual deploy test-server
uses: wultra/wultra-infrastructure/.github/workflows/maven-deploy.yml@develop
with:
environment: internal-publish
Expand All @@ -19,4 +19,4 @@ jobs:
java_version: 21
secrets:
username: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
password: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
password: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
1 change: 0 additions & 1 deletion .github/workflows/maven-integration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ jobs:
INTERNAL_PASSWORD: ${{ secrets.JFROG_PASSWORD }}
POWERAUTH_REST_URL: ${{ secrets.POWERAUTH_REST_URL }}
POWERAUTH_INTEGRATION_SERVICE_URL: ${{ secrets.POWERAUTH_INTEGRATION_SERVICE_URL }}
POWERAUTH_NEXTSTEP_SERVICE_URL: ${{ secrets.POWERAUTH_NEXTSTEP_SERVICE_URL }}
POWERAUTH_ENROLLMENT_SERVICE_URL: ${{ secrets.POWERAUTH_ENROLLMENT_SERVICE_URL }}
POWERAUTH_ENROLLMENT_ONBOARDING_SERVICE_URL: ${{ secrets.POWERAUTH_ENROLLMENT_ONBOARDING_SERVICE_URL }}
POWERAUTH_SERVICE_SECURITY_CLIENTTOKEN: ${{ secrets.POWERAUTH_SERVICE_SECURITY_CLIENTTOKEN }}
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ This project contains various tests for PowerAuth backends:

- [PowerAuth End-To-End Tests](./powerauth-backend-tests/README.md)
- [PowerAuth Load Tests](./powerauth-load-tests/README.md)
- [PowerAuth Web Flow UI Tests](./powerauth-webflow-tests/README.md)
- [PowerAuth FIDO2 Tests](./powerauth-fido2-tests/README.md)

# License

Expand Down
206 changes: 206 additions & 0 deletions docs-private/Performance-Testing-Guide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,206 @@
# Performance Testing Guide

This document serves as an internal guide for running performance tests.

## DB preparation

Before running the tests there are several steps that need to be taken:

### 1. Create Admin User in PAC

Postgresql

```sql
INSERT INTO pa_cloud_user (id, username, userpassword, enabled)
VALUES (nextval('pa_cloud_user_seq'), 'system-admin', '{GENERATED_PWD_ENCODED}', true);

INSERT INTO pa_cloud_user_authority (id, user_id, authority)
VALUES (nextval('pa_cloud_user_seq'), (SELECT id FROM pa_cloud_user WHERE username = 'system-admin'), 'ROLE_ADMIN');
```

MSSQL

```sql
INSERT INTO pa_cloud_user (id, username, userpassword, enabled)
VALUES (NEXT VALUE FOR pa_cloud_user_seq, 'system-admin', '{GENERATED_PWD_ENCODED}', 1);

INSERT INTO pa_cloud_user_authority (id, user_id, authority)
VALUES (NEXT VALUE FOR pa_cloud_user_seq, (SELECT id FROM pa_cloud_user WHERE username = 'system-admin'), 'ROLE_ADMIN');
```

ORACLE

```sql
INSERT INTO pa_cloud_user (ID, USERNAME, userpassword, ENABLED)
SELECT pa_cloud_user_seq.NEXTVAL, 'system-admin', '{GENERATED_PWD_ENCODED}', 1 FROM DUAL;
INSERT INTO pa_cloud_user_authority (id, user_id, authority)
SELECT pa_cloud_user_seq.NEXTVAL, id, 'ROLE_ADMIN'
FROM pa_cloud_user
WHERE username = 'system-admin';
```

To create the password follow steps
from https://developers.wultra.com/components/powerauth-cloud/develop/documentation/

### 2. Create template in pa_operation_template

Postgresql

```sql
INSERT INTO pa_operation_template (id, template_name, operation_type, data_template, signature_type, max_failure_count, expiration)
VALUES (1, 'login', 'login', 'A2', 'possession_knowledge,possession_biometry', 5, 300);

INSERT INTO pa_operation_template (id, template_name, operation_type, data_template, signature_type, max_failure_count, expiration)
VALUES (2, 'payment', 'authorize_payment', 'A1*A${amount}${currency}*I${iban}', 'possession_knowledge,possession_biometry', 5, 300);
```

MSSQL

```sql
INSERT INTO pa_operation_template (id, template_name, operation_type, data_template, signature_type, max_failure_count, expiration)
VALUES (1, 'login', 'login', 'A2', 'possession_knowledge,possession_biometry', 5, 300);

INSERT INTO pa_operation_template (id, template_name, operation_type, data_template, signature_type, max_failure_count, expiration)
VALUES (2, 'payment', 'authorize_payment', 'A1*A${amount}${currency}*I${iban}', 'possession_knowledge,possession_biometry', 5, 300);
```

ORACLE

```sql
INSERT INTO pa_operation_template (id, template_name, operation_type, data_template, signature_type, max_failure_count, expiration)
VALUES (1, 'login', 'login', 'A2', 'possession_knowledge,possession_biometry', 5, 300);

INSERT INTO pa_operation_template (id, template_name, operation_type, data_template, signature_type, max_failure_count, expiration)
VALUES (2, 'payment', 'authorize_payment', 'A1*A${amount}${currency}*I${iban}', 'possession_knowledge,possession_biometry', 5, 300);
```

### 3. Create operation summary localization

Postgresql

```sql
INSERT INTO pa_cloud_localization (id, placeholder, language, title, summary)
VALUES (1, 'login', 'en', 'Approve Login', 'Please confirm the login request.');

INSERT INTO pa_cloud_localization (id, placeholder, language, title, summary)
VALUES (2, 'payment', 'en', 'Approve Payment', 'Please approve the payment of ${amount} ${currency} to account ${iban}.');
```

MSSQL

```sql
INSERT INTO pa_cloud_localization (id, placeholder, language, title, summary)
VALUES (1, 'login', 'en', 'Approve Login', 'Please confirm the login request.');

INSERT INTO pa_cloud_localization (id, placeholder, language, title, summary)
VALUES (2, 'payment', 'en', 'Approve Payment', 'Please approve the payment of ${amount} ${currency} to account ${iban}.');
```

ORACLE

```sql
INSERT INTO pa_cloud_localization (id, placeholder, language, title, summary)
VALUES (1, 'login', 'en', 'Approve Login', 'Please confirm the login request.');

INSERT INTO pa_cloud_localization (id, placeholder, language, title, summary)
VALUES (2, 'payment', 'en', 'Approve Payment', 'Please approve the payment of ${amount} ${currency} to account ${iban}.');
```

### 4. Create mobile token operation localization

Postgresql

```sql
INSERT INTO es_operation_template (id, placeholder, language, title, message, attributes, ui)
VALUES (1, 'login', 'en', 'Login Approval', 'Are you logging in to the internet banking?', null, null);

INSERT INTO es_operation_template (id, placeholder, language, title, message, attributes, ui)
VALUES (2, 'authorize_payment', 'en', 'Payment Approval', 'Please confirm the payment', '[
{
"id": "operation.amount",
"type": "AMOUNT",
"text": "Amount",
"params": {
"amount": "amount",
"currency": "currency"
}
},
{
"id": "operation.account",
"type": "KEY_VALUE",
"text": "To Account",
"params": {
"value": "iban"
}
}
]', null);
```

MSSQL

```sql
INSERT INTO es_operation_template (id, placeholder, language, title, message, attributes, ui)
VALUES (1, 'login', 'en', 'Login Approval', 'Are you logging in to the internet banking?', NULL, NULL);

INSERT INTO es_operation_template (id, placeholder, language, title, message, attributes, ui)
VALUES (2, 'authorize_payment', 'en', 'Payment Approval', 'Please confirm the payment', '[
{
"id": "operation.amount",
"type": "AMOUNT",
"text": "Amount",
"params": {
"amount": "amount",
"currency": "currency"
}
},
{
"id": "operation.account",
"type": "KEY_VALUE",
"text": "To Account",
"params": {
"value": "iban"
}
}
]', NULL);
```

Oracle

```sql
INSERT INTO es_operation_template (id, placeholder, language, title, message, attributes, ui)
VALUES (1, 'login', 'en', 'Login Approval', 'Are you logging in to the internet banking?', NULL, NULL);

INSERT INTO es_operation_template (id, placeholder, language, title, message, attributes, ui)
VALUES (2, 'authorize_payment', 'en', 'Payment Approval', 'Please confirm the payment', '[{"id": "operation.amount", "type": "AMOUNT", "text": "Amount", "params": {"amount": "amount", "currency": "currency"}}, {"id": "operation.account", "type": "KEY_VALUE", "text": "To Account", "params": {"value": "iban"}}]', NULL);
```

## Running the tests

To run the tests we use maven gatling plugin. The methodology of the tests is as follows. There are two simulations:

- Data Preparation
- Performance Test

There is a config file [.perf_test_config](./../powerauth-load-tests/src/test/resources/.perf_test_config) which needs
to be sourced before running the tests. This file serves as a configuration file for the testing. More information about
possible parameters to set is inside the file.

Before running the Performance Test Simulation, which is essentially a load test, **the Data Preparation needs to be run
at least once to populate the db with some data**. It also generates a JSON file
to `powerauth-load-tests/src/test/resources` which holds information that is used during the Performance Test.

One may use prepared scripts to easily trigger the tests:

- [run_perf_tests.sh](./../powerauth-load-tests/src/test/resources/run_perf_tests.sh)
- [run_data_prepare.sh](./../powerauth-load-tests/src/test/resources/run_data_prepare.sh)

The reports are by default generated to `/results/`.

## Useful

- Link to Gatling docs - https://docs.gatling.io

- Generating reports from failed/unfinished tests
```bash
mvn gatling:test -Dgatling.reportsOnly={PATH_TO_SIMULATION_OUTPUT_FOLDER}
```
38 changes: 11 additions & 27 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.2.4</version>
<version>3.3.2</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>

<groupId>com.wultra</groupId>
<artifactId>powerauth-backend-tests-parent</artifactId>
<version>1.7.0</version>
<version>1.8.0</version>
<packaging>pom</packaging>

<description>Parent pom for backend tests</description>
Expand Down Expand Up @@ -45,18 +45,16 @@
</developers>

<properties>
<enrollment-server.version>1.7.0</enrollment-server.version>
<powerauth-cmd.version>1.7.0</powerauth-cmd.version>
<powerauth-crypto.version>1.7.0</powerauth-crypto.version>
<powerauth-restful-integration.version>1.7.0</powerauth-restful-integration.version>
<powerauth-server.version>1.7.0</powerauth-server.version>
<powerauth-webflow.version>1.7.0</powerauth-webflow.version>
<wultra-core.version>1.9.0</wultra-core.version>

<bc.version>1.77</bc.version>
<springdoc-openapi-starter-webmvc-ui.version>2.5.0</springdoc-openapi-starter-webmvc-ui.version>
<enrollment-server.version>1.8.0</enrollment-server.version>
<powerauth-cmd.version>1.8.0</powerauth-cmd.version>
<powerauth-crypto.version>1.8.0</powerauth-crypto.version>
<powerauth-restful-integration.version>1.8.0</powerauth-restful-integration.version>
<powerauth-server.version>1.8.0</powerauth-server.version>
<wultra-core.version>1.10.0</wultra-core.version>

<springdoc-openapi-starter-webmvc-ui.version>2.6.0</springdoc-openapi-starter-webmvc-ui.version>
<logstash.version>7.4</logstash.version>
<webauthn4j.version>0.23.0.RELEASE</webauthn4j.version>
<webauthn4j.version>0.25.0.RELEASE</webauthn4j.version>

<maven.deploy.skip>true</maven.deploy.skip>
</properties>
Expand All @@ -66,24 +64,10 @@
<module>powerauth-fido2-tests</module>
<module>powerauth-load-tests</module>
<module>powerauth-test-server</module>
<module>powerauth-webflow-tests</module>
</modules>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk18on</artifactId>
<version>${bc.version}</version>
</dependency>

<!-- PowerAuth Webflow -->
<dependency>
<groupId>io.getlime.security</groupId>
<artifactId>powerauth-nextstep-client</artifactId>
<version>${powerauth-webflow.version}</version>
</dependency>

<!-- PowerAuth Crypto -->
<dependency>
<groupId>io.getlime.security</groupId>
Expand Down
Loading

0 comments on commit 1e3db6d

Please sign in to comment.