Skip to content

Commit

Permalink
test: fix revocation new variable (#926)
Browse files Browse the repository at this point in the history
Signed-off-by: Allain Magyar <allain.magyar@iohk.io>
  • Loading branch information
amagyar-iohk authored Mar 15, 2024
1 parent 76300e2 commit 91dc001
Show file tree
Hide file tree
Showing 7 changed files with 189 additions and 6 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/performance-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ on:

env:
BENCHMARKING_DIR: "tests/performance-tests/atala-performance-tests-k6"
NODE_AUTH_TOKEN: ${{ secrets.ATALA_GITHUB_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_ACTOR: ${{ github.actor }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

jobs:
run-e2e-tests:
Expand All @@ -35,8 +37,8 @@ jobs:
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ secrets.ATALA_GITHUB_ACTOR }}
password: ${{ secrets.ATALA_GITHUB_TOKEN }}
username: ${{ env.GITHUB_ACTOR }}
password: ${{ env.GITHUB_TOKEN }}

- uses: KengoTODA/actions-setup-docker-compose@v1
name: Install `docker-compose`
Expand All @@ -46,8 +48,6 @@ jobs:
- name: Build local version of PRISM Agent
env:
ENV_FILE: "infrastructure/local/.env"
GITHUB_ACTOR: ${{ secrets.ATALA_GITHUB_ACTOR }}
GITHUB_TOKEN: ${{ secrets.ATALA_GITHUB_TOKEN }}
run: |
sbt docker:publishLocal
PRISM_AGENT_VERSION=$(cut version.sbt -d '=' -f2 | tr -d '" ')
Expand Down
1 change: 1 addition & 0 deletions infrastructure/shared/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ services:
AGENT_DB_NAME: agent
AGENT_DB_USER: postgres
AGENT_DB_PASSWORD: postgres
POLLUX_STATUS_LIST_REGISTRY_PUBLIC_URL: http://${DOCKERHOST}:${PORT}/prism-agent
DIDCOMM_SERVICE_URL: http://${DOCKERHOST}:${PORT}/didcomm
REST_SERVICE_URL: http://${DOCKERHOST}:${PORT}/prism-agent
PRISM_NODE_HOST: prism-node
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ pollux {
awaitConnectionThreads = ${?POLLUX_DB_AWAIT_CONNECTION_THREADS}
}
statusListRegistry {
publicEndpointUrl = "http://localhost:8085"
# defaults to the exposed AGENT_HTTP_PORT port
publicEndpointUrl = "http://localhost:"${agent.httpEndpoint.http.port}
publicEndpointUrl = ${?POLLUX_STATUS_LIST_REGISTRY_PUBLIC_URL}
}
issueBgJobRecordsLimit = 25
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ data class Agent(
"KEYCLOAK_REALM" to (keycloak?.realm ?: ""),
"KEYCLOAK_CLIENT_ID" to (keycloak?.clientId ?: ""),
"KEYCLOAK_CLIENT_SECRET" to (keycloak?.clientSecret ?: ""),
"POLLUX_STATUS_LIST_REGISTRY_PUBLIC_URL" to "http://host.docker.internal:$httpPort"
)

// setup token authentication
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ services:
AGENT_HTTP_PORT:
DIDCOMM_SERVICE_URL:
REST_SERVICE_URL:
POLLUX_STATUS_LIST_REGISTRY_PUBLIC_URL:
API_KEY_ENABLED:
# Secret storage configuration
SECRET_STORAGE_BACKEND:
Expand Down
3 changes: 3 additions & 0 deletions tests/performance-tests/atala-performance-tests-k6/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
PRISM_AGENT_VERSION=1.30.1-SNAPSHOT
PRISM_NODE_VERSION=2.2.1
VAULT_DEV_ROOT_TOKEN_ID=root
176 changes: 176 additions & 0 deletions tests/performance-tests/atala-performance-tests-k6/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@
#!/bin/bash

set -e

# Variables
ENV_FILE=".env"
PERF_DIR=$(cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
AGENT_DIR="$PERF_DIR/../../.."
DOCKERFILE="$AGENT_DIR/infrastructure/shared/docker-compose.yml"
K6_URL="https://github.com/grafana/k6/releases/download/v0.45.0/k6-v0.45.0-macos-arm64.zip"
K6_ZIP_FILE="$(basename ${K6_URL})"

# Functions
function startAgent() {
echo "Starting [$NAME] agent"
PORT="${PORT}" \
ADMIN_TOKEN="${ADMIN_TOKEN}" \
DEFAULT_WALLET_ENABLED="${DEFAULT_WALLET_ENABLED}" \
DEFAULT_WALLET_AUTH_API_KEY="${DEFAULT_WALLET_AUTH_API_KEY}" \
API_KEY_AUTO_PROVISIONING="${API_KEY_AUTO_PROVISIONING}" \
API_KEY_ENABLED="${API_KEY_ENABLED}" \
DOCKERHOST="${DOCKERHOST}" \
PG_PORT="${PG_PORT}" \
NODE_REFRESH_AND_SUBMIT_PERIOD="${NODE_REFRESH_AND_SUBMIT_PERIOD}" \
NODE_MOVE_SCHEDULED_TO_PENDING_PERIOD="${NODE_MOVE_SCHEDULED_TO_PENDING_PERIOD}" \
NODE_WALLET_MAX_TPS="${NODE_WALLET_MAX_TPS}" \
docker compose -p "${NAME}" -f "${DOCKERFILE}" \
--env-file "${ENV_FILE}" up -d --wait 2> /dev/null
echo "Agent [$NAME] healthy"
}

function stopAgent() {
echo "Stopping [${NAME}] agent"
PORT="${PORT}" \
DOCKERHOST="${DOCKERHOST}" \
docker compose \
-p "${NAME}" \
-f "${DOCKERFILE}" \
--env-file "${ENV_FILE}" down -v 2> /dev/null
echo "Agent [${NAME}] stopped"
}

function createIssuer() {
local NAME="issuer"
local PORT=8080
local ADMIN_TOKEN=admin
local DEFAULT_WALLET_ENABLED=true
local DEFAULT_WALLET_AUTH_API_KEY=default
local API_KEY_AUTO_PROVISIONING=false
local API_KEY_ENABLED=true
local DOCKERHOST="host.docker.internal"
local PG_PORT=5432
local NODE_REFRESH_AND_SUBMIT_PERIOD="1s"
local NODE_MOVE_SCHEDULED_TO_PENDING_PERIOD="1s"
local NODE_WALLET_MAX_TPS="1000"

startAgent
}

function createHolder() {
local NAME="holder"
local PORT=8090
local ADMIN_TOKEN=admin
local DEFAULT_WALLET_ENABLED=true
local DEFAULT_WALLET_AUTH_API_KEY=default
local API_KEY_AUTO_PROVISIONING=false
local API_KEY_ENABLED=true
local DOCKERHOST="host.docker.internal"
local PG_PORT=5433
local NODE_REFRESH_AND_SUBMIT_PERIOD="1s"
local NODE_MOVE_SCHEDULED_TO_PENDING_PERIOD="1s"
local NODE_WALLET_MAX_TPS="1000"

startAgent
}

function createVerifier() {
local NAME="verifier"
local PORT=8100
local ADMIN_TOKEN=admin
local DEFAULT_WALLET_ENABLED=true
local DEFAULT_WALLET_AUTH_API_KEY=default
local API_KEY_AUTO_PROVISIONING=false
local API_KEY_ENABLED=true
local DOCKERHOST="host.docker.internal"
local PG_PORT=5434
local NODE_REFRESH_AND_SUBMIT_PERIOD="1s"
local NODE_MOVE_SCHEDULED_TO_PENDING_PERIOD="1s"
local NODE_WALLET_MAX_TPS="1000"

startAgent
}

function removeIssuer() {
local NAME="issuer"
local PORT=8080
local DOCKERHOST="host.docker.internal"

stopAgent
}

function removeVerifier() {
local NAME="verifier"
local PORT=8100
local DOCKERHOST="host.docker.internal"

stopAgent
}

function removeHolder() {
local NAME="holder"
local PORT=8090
local DOCKERHOST="host.docker.internal"

stopAgent
}

# clean up on finish
function cleanup() {
echo "Removing K6 binaries"
rm k6
rm "$K6_ZIP_FILE"

removeIssuer &
removeVerifier &
removeHolder &
wait
}

trap 'cleanup' EXIT

# download and unzip k6
echo "Downloading K6"
curl -LO -s "${K6_URL}"
unzip -j "${K6_ZIP_FILE}" > /dev/null
echo "K6 downloaded"

## navigate to main project
cd "$AGENT_DIR"

##sbt docker:publishLocal
PRISM_AGENT_VERSION=$(cut -d '"' -f 2 version.sbt)

## back to performance folder
cd "$PERF_DIR"

# set version to env file
sed -i.bak "s/PRISM_AGENT_VERSION=.*/PRISM_AGENT_VERSION=${PRISM_AGENT_VERSION}/" "${ENV_FILE}" && rm -f "${ENV_FILE}.bak"

# create agents in parallel
createIssuer &
createHolder &
createVerifier &
wait

# yarn install
echo "Installing dependencies"
yarn -s > /dev/null
echo "Building performance tests"
yarn webpack > /dev/null

# start perf test
echo "Starting performance testing"

export ISSUER_AGENT_API_KEY=default
export HOLDER_AGENT_API_KEY=default
export VERIFIER_AGENT_API_KEY=default

./k6 run -e SCENARIO_LABEL=create-prism-did-smoke ./dist/create-prism-did-test.js
./k6 run -e SCENARIO_LABEL=credential-offer-smoke ./dist/credential-offer-test.js
./k6 run -e SCENARIO_LABEL=credential-definition-smoke ./dist/credential-definition-test.js
./k6 run -e SCENARIO_LABEL=credential-schema-smoke ./dist/credential-schema-test.js
./k6 run -e SCENARIO_LABEL=did-publishing-smoke ./dist/did-publishing-test.js
./k6 run -e SCENARIO_LABEL=connection-flow-smoke ./dist/connection-flow-test.js
./k6 run -e SCENARIO_LABEL=issuance-flow-smoke ./dist/issuance-flow-test.js
./k6 run -e SCENARIO_LABEL=present-proof-flow-smoke ./dist/present-proof-flow-test.js

0 comments on commit 91dc001

Please sign in to comment.