Add SDK tests script
All checks were successful
Build / build (pull_request) Successful in 2m8s
E2E Tests / test-e2e (pull_request) Successful in 3m44s
Integration Tests / test-integration (pull_request) Successful in 2m17s
Lint / Run golangci-lint (pull_request) Successful in 4m55s
Unit Tests / test-unit (pull_request) Successful in 2m26s

This commit is contained in:
Prathamesh Musale 2024-03-12 12:26:22 +05:30
parent 67cbbf7088
commit 4b1169f0a3
3 changed files with 61 additions and 0 deletions

View File

@ -0,0 +1,33 @@
services:
laconic2d:
restart: unless-stopped
image: cerc/laconic2d:local
entrypoint: ["sh", "/docker-entrypoint-scripts.d/create-fixturenet.sh"]
environment:
- TEST_AUCTION_ENABLED
- TEST_REGISTRY_EXPIRY
- LOGLEVEL
volumes:
- ../../scripts/init.sh:/docker-entrypoint-scripts.d/create-fixturenet.sh
healthcheck:
test: ["CMD", "curl", "-v", "http://127.0.0.1:6060"]
interval: 1s
timeout: 5s
retries: 30
ports:
- "6060"
- "26657"
- "26656"
- "9473"
- "8545"
- "8546"
- "9090"
- "9091"
- "1317"
sdk-test-runner:
image: cerc/registry-sdk-tester:local
depends_on:
laconic2d:
condition: service_healthy
command: tail -F /dev/null

28
tests/sdk_tests/run-tests.sh Executable file
View File

@ -0,0 +1,28 @@
#!/usr/bin/env bash
# Forwards all args to yarn on the sdk-test-runner container
if [ -n "$CERC_SCRIPT_DEBUG" ]; then
set -x
fi
yarn_args=("--inspect-brk=8888")
yarn_args+=("${@:-test}")
# Get the key from laconic2d
laconic2d_key=$(
yes | docker compose exec laconic2d laconic2d keys export mykey --unarmored-hex --unsafe
)
# Set parameters for the test suite
cosmos_chain_id=laconic_9000-1
laconicd_rpc_endpoint=http://laconic2d:26657
laconicd_gql_endpoint=http://laconic2d:9473/api
docker compose exec laconic2d sh -c "curl --retry 10 --retry-delay 3 --retry-connrefused http://127.0.0.1:9473/api"
# Run tests
docker compose exec \
-e COSMOS_CHAIN_ID="$cosmos_chain_id" \
-e LACONICD_REST_ENDPOINT="$laconicd_rpc_endpoint" \
-e LACONICD_GQL_ENDPOINT="$laconicd_gql_endpoint" \
-e PRIVATE_KEY="$laconic2d_key" \
sdk-test-runner yarn run "${yarn_args[@]}"