Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions scripts/run-tests.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
#!/bin/bash

set -e

# This script runs Polymesh integration tests

# Get the directory where this script is located, regardless of where it's called from
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"

# Vault token needs to be set so the tests can manage keys
echo "[ENV RUN] Fetching vault token..."
export VAULT_TOKEN=$("${SCRIPT_DIR}/get-vault-token.sh")

# Run jest with default maxWorkers and any additional arguments passed to this script
echo "Beginning tests..."
echo "[ENV RUN] Beginning tests..."
yarn jest --maxWorkers=8 "$@"

14 changes: 7 additions & 7 deletions scripts/start-env.sh
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
#!/bin/bash

#!/bin/bash

# This script starts up a dev environment via compose and executes a suite of integration tests
set -e

# Get the directory where this script is located, regardless of where it's called from
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"

COMPOSE_ENV="${SCRIPT_DIR}/../envs/latest"

echo "Starting env using $COMPOSE_ENV"
echo "[ENV START] Starting env using $COMPOSE_ENV"
docker compose --env-file "$COMPOSE_ENV" up --detach
echo "[ENV START] Docker env started. Now waiting for ready"

echo "Waiting for a fully initialized environment..."
docker compose wait environment-ready >/dev/null 2>&1
echo "[ENV START] Waiting for a fully initialized environment..."
# `|| true` swallows all errors, but wait exits with non-zero in the expected case
docker compose --env-file "$COMPOSE_ENV" wait environment-ready >/dev/null || true

echo "Polymesh dev environment started"
echo "[ENV START] Polymesh dev environment started"
8 changes: 6 additions & 2 deletions scripts/stop-env.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
#!/bin/bash

set -e

# This script cleans up the test environment

# Get the directory where this script is located, regardless of where it's called from
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"

COMPOSE_ENV="${SCRIPT_DIR}/../envs/latest"

echo "Cleaning up the docker environment..."
docker compose --env-file "$COMPOSE_ENV" down -v
echo "[ENV STOP] Cleaning up the docker environment..."
docker compose --env-file "$COMPOSE_ENV" down -v

echo "[ENV STOP] docker env cleaned up"
8 changes: 5 additions & 3 deletions scripts/test.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
#!/bin/bash

# This script sets up a Polymesh env, runs the tests and cleans up the environment
# This script sets up a Polymesh env, runs the tests and then cleans up its environment
set -e

# Get the directory where this script is located, regardless of where it's called from
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"

echo "[ENV TEST] Starting environment..."
"${SCRIPT_DIR}/start-env.sh"

echo "[ENV TEST] Running tests..."
"${SCRIPT_DIR}/run-tests.sh"

echo "[ENV TEST] Cleaning up environment..."
"${SCRIPT_DIR}/stop-env.sh"


Loading