From 3234c06d9fe39f36d01bb9131a345a1828331bc2 Mon Sep 17 00:00:00 2001 From: Prathamesh Musale Date: Tue, 12 Mar 2024 12:26:22 +0530 Subject: [PATCH 1/2] Add SDK tests script --- ...tainer.sh => build-laconic2d-container.sh} | 0 tests/sdk_tests/docker-compose.yml | 33 +++++++++++++++++++ tests/sdk_tests/run-tests.sh | 28 ++++++++++++++++ 3 files changed, 61 insertions(+) rename tests/sdk_tests/{build-laconicd-container.sh => build-laconic2d-container.sh} (100%) create mode 100644 tests/sdk_tests/docker-compose.yml create mode 100755 tests/sdk_tests/run-tests.sh diff --git a/tests/sdk_tests/build-laconicd-container.sh b/tests/sdk_tests/build-laconic2d-container.sh similarity index 100% rename from tests/sdk_tests/build-laconicd-container.sh rename to tests/sdk_tests/build-laconic2d-container.sh diff --git a/tests/sdk_tests/docker-compose.yml b/tests/sdk_tests/docker-compose.yml new file mode 100644 index 00000000..0e58625d --- /dev/null +++ b/tests/sdk_tests/docker-compose.yml @@ -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 diff --git a/tests/sdk_tests/run-tests.sh b/tests/sdk_tests/run-tests.sh new file mode 100755 index 00000000..8b212bd8 --- /dev/null +++ b/tests/sdk_tests/run-tests.sh @@ -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[@]}" -- 2.45.2 From bcf272b5e079b3aaecb59878d3d95ce2de138498 Mon Sep 17 00:00:00 2001 From: Prathamesh Musale Date: Tue, 12 Mar 2024 14:17:57 +0530 Subject: [PATCH 2/2] Expose RPC port --- scripts/init.sh | 1 + tests/sdk_tests/run-tests.sh | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/init.sh b/scripts/init.sh index ff948d9d..9f94d36f 100755 --- a/scripts/init.sh +++ b/scripts/init.sh @@ -87,4 +87,5 @@ laconic2d start \ --log_level $LOGLEVEL \ --minimum-gas-prices=0.0001photon \ --api.enable \ + --rpc.laddr="tcp://0.0.0.0:26657" \ --gql-server --gql-playground diff --git a/tests/sdk_tests/run-tests.sh b/tests/sdk_tests/run-tests.sh index 8b212bd8..356adade 100755 --- a/tests/sdk_tests/run-tests.sh +++ b/tests/sdk_tests/run-tests.sh @@ -10,7 +10,7 @@ yarn_args+=("${@:-test}") # Get the key from laconic2d laconic2d_key=$( - yes | docker compose exec laconic2d laconic2d keys export mykey --unarmored-hex --unsafe + yes | docker compose exec laconic2d laconic2d keys export alice --keyring-backend test --unarmored-hex --unsafe ) # Set parameters for the test suite cosmos_chain_id=laconic_9000-1 -- 2.45.2