Skip to content

Commit

Permalink
tests: add prism agent benchmarks project (#334)
Browse files Browse the repository at this point in the history
Supported simulations:
* Connection protocol simulation
* Credential Issuance protocol simulation
  • Loading branch information
abalias committed Jan 31, 2023
1 parent fda6899 commit 4f35430
Show file tree
Hide file tree
Showing 17 changed files with 1,118 additions and 0 deletions.
85 changes: 85 additions & 0 deletions .github/workflows/performance-tests.yml
@@ -0,0 +1,85 @@
name: Performance tests

concurrency:
group: ${{ github.head_ref }}${{ github.ref }}-performance-tests
cancel-in-progress: true

on:
schedule:
- cron: "0 3 * * *"
pull_request:
paths:
- ".github/workflows/performance-tests.yml"
- "tests/performance-tests/**"
push:
branches:
- "main"
workflow_dispatch:

defaults:
run:
shell: bash
working-directory: "tests/performance-tests/prism-performance-tests"

jobs:
run-e2e-tests:
name: "Run performance tests"
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup Java and Scala
uses: olafurpg/setup-scala@v13
with:
java-version: openjdk@1.11

- name: Setup Gradle
uses: gradle/gradle-build-action@v2

- name: Install Python
uses: actions/setup-python@v2
with:
python-version: '3.8'

- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ secrets.ATALA_GITHUB_ACTOR }}
password: ${{ secrets.ATALA_GITHUB_TOKEN }}

- name: Install Compose
uses: ndeloof/install-compose-action@v0.0.1
with:
version: v2.12.2 # defaults to 'latest'
legacy: true # will also install in PATH as `docker-compose`

- name: Start services for issuer
env:
PORT: 8080
uses: isbang/compose-action@v1.4.1
with:
compose-file: "./infrastructure/shared/docker-compose.yml"
compose-flags: "--env-file ./infrastructure/local/.env -p issuer"
up-flags: "--wait"
down-flags: "--volumes"

- name: Start services for holder
env:
PORT: 8090
uses: isbang/compose-action@v1.4.1
with:
compose-file: "./infrastructure/shared/docker-compose.yml"
compose-flags: "--env-file ./infrastructure/local/.env -p holder"
up-flags: "--wait"
down-flags: "--volumes"

- name: Run performance tests
run: |
./gradlew gatlingRun
- uses: actions/upload-artifact@v2
with:
name: performance-tests-results
path: tests/performance-tests/prism-performance-tests/build/reports
21 changes: 21 additions & 0 deletions tests/performance-tests/prism-performance-tests/.gitignore
@@ -0,0 +1,21 @@
.gradle
**/build/
!src/**/build/

# Ignore Gradle GUI config
gradle-app.setting

# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
!gradle-wrapper.jar

# Avoid ignore Gradle wrappper properties
!gradle-wrapper.properties

# Cache of project
.gradletasknamecache

# Eclipse Gradle plugin generated files
# Eclipse Core
.project
# JDT-specific (Eclipse Java Development Tools)
.classpath
33 changes: 33 additions & 0 deletions tests/performance-tests/prism-performance-tests/README.md
@@ -0,0 +1,33 @@
# Atala PRISM V2 Performance Gatling Project

Welcome to performance measurements project for Atala PRISM V2.

The project is written on Kotlin and uses [Gatling](https://gatling.io/) load test framework.

## Project structure

The project is divided by the following main modules:
* `common`: general module for constants and utility functions
* `simulations`: Gatling simulations
* `steps`: simulation steps that can be combined into simulations later

## Running simulations

To run all simulations, use the following command:
```shell
./gradlew gatlingRun
```

To run a specific simulation, specify the full path to the required simulation file.
For example, running `ConnectionSimulation` from `simulations` package:
```shell
./gradlew gatlingRun-simulations.ConnectionSimulation
```

## Environments configuration

There are multiple configuration environment variables available through `common.Configuration` module:
* `ISSUER_AGENT_URL`: URL for Issuer Agent, example: `http://localhost:8080/prism-agent`
* `ISSUER_AGENT_API_KEY`: access key for Issuer agent if hosted on remote env
* `HOLDER_AGENT_URL`: URL for Holder Agent, example: `http://localhost:8090/prism-agent`
* `HOLDER_AGENT_API_KEY`: access key for Holder agent if hosted on remote env
31 changes: 31 additions & 0 deletions tests/performance-tests/prism-performance-tests/build.gradle.kts
@@ -0,0 +1,31 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
kotlin("jvm") version "1.7.21"
id("io.gatling.gradle") version "3.9.0.2"
}

group = "io.atala.prism"
version = "0.1.0"

repositories {
mavenCentral()
}

gatling {
logLevel = "WARN"
// set to 'ALL' for all HTTP traffic in TRACE, 'FAILURES' for failed HTTP traffic in DEBUG
logHttp = io.gatling.gradle.LogHttp.NONE
}

dependencies {
testImplementation(kotlin("test"))
}

tasks.test {
useJUnitPlatform()
}

tasks.withType<KotlinCompile> {
kotlinOptions.jvmTarget = "1.8"
}
@@ -0,0 +1 @@
kotlin.code.style=official
Binary file not shown.
@@ -0,0 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

0 comments on commit 4f35430

Please sign in to comment.