diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 20e83ca9..37167aa4 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -102,8 +102,31 @@ jobs: run: docker compose up -d - name: run-tests.sh working-directory: tests/sdk_tests - run: ./run-all-tests.sh - + run: ./run-tests.sh + - name: reset containers for auction tests + working-directory: tests/sdk_tests + if: always() + run: docker compose down + - name: start auction containers + working-directory: tests/sdk_tests + run: docker compose -f docker-compose-auctions.yml up -d + - name: run-acution-tests.sh + working-directory: tests/sdk_tests + run: ./run-auction-tests.sh + - name: reset containers for nameservice tests + working-directory: tests/sdk_tests + if: always() + run: docker compose -f docker-compose-auctions.yml down + - name: start auction containers + working-directory: tests/sdk_tests + run: docker compose -f docker-compose-nameservice.yml up -d + - name: run-nameservice-expiry-tests.sh + working-directory: tests/sdk_tests + run: ./run-nameservice-expiry-tests.sh + - name: reset containers for nameservice tests + working-directory: tests/sdk_tests + if: always() + run: docker compose -f docker-compose-nameservice.yml down # integration_tests: # runs-on: ubuntu-latest diff --git a/tests/sdk_tests/Dockerfile-sdk b/tests/sdk_tests/Dockerfile-sdk index 5c9ac9eb..fd9d6cc9 100644 --- a/tests/sdk_tests/Dockerfile-sdk +++ b/tests/sdk_tests/Dockerfile-sdk @@ -47,7 +47,6 @@ WORKDIR /app RUN \ git clone https://github.com/cerc-io/laconic-sdk.git \ && cd laconic-sdk \ - && git checkout auction_nameservice_tests \ && yarn install WORKDIR /app/laconic-sdk diff --git a/tests/sdk_tests/docker-compose-auctions.yml b/tests/sdk_tests/docker-compose-auctions.yml new file mode 100644 index 00000000..9b0df5fd --- /dev/null +++ b/tests/sdk_tests/docker-compose-auctions.yml @@ -0,0 +1,31 @@ +services: + laconicd: + restart: unless-stopped + image: cerc-io/laconicd:local-test + environment: + - TEST_AUCTION_ENABLED=true + command: ["sh", "/docker-entrypoint-scripts.d/create-fixturenet.sh"] + volumes: + - ../../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-io/laconic-sdk-tester:local-test + depends_on: + laconicd: + condition: service_healthy + command: tail -F /dev/null diff --git a/tests/sdk_tests/docker-compose-nameservice.yml b/tests/sdk_tests/docker-compose-nameservice.yml new file mode 100644 index 00000000..17614108 --- /dev/null +++ b/tests/sdk_tests/docker-compose-nameservice.yml @@ -0,0 +1,31 @@ +services: + laconicd: + restart: unless-stopped + image: cerc-io/laconicd:local-test + environment: + - TEST_REGISTRY_EXPIRY=true + command: ["sh", "/docker-entrypoint-scripts.d/create-fixturenet.sh"] + volumes: + - ../../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-io/laconic-sdk-tester:local-test + depends_on: + laconicd: + condition: service_healthy + command: tail -F /dev/null diff --git a/tests/sdk_tests/docker-compose.yml b/tests/sdk_tests/docker-compose.yml index f9ed9ea1..aa886496 100644 --- a/tests/sdk_tests/docker-compose.yml +++ b/tests/sdk_tests/docker-compose.yml @@ -2,9 +2,6 @@ services: laconicd: restart: unless-stopped image: cerc-io/laconicd:local-test - environment: - - TEST_AUCTION_ENABLED=true - - TEST_REGISTRY_EXPIRY=true command: ["sh", "/docker-entrypoint-scripts.d/create-fixturenet.sh"] volumes: - ../../init.sh:/docker-entrypoint-scripts.d/create-fixturenet.sh diff --git a/tests/sdk_tests/run-auction-tests.sh b/tests/sdk_tests/run-auction-tests.sh new file mode 100755 index 00000000..d1a05d17 --- /dev/null +++ b/tests/sdk_tests/run-auction-tests.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env bash +if [ -n "$CERC_SCRIPT_DEBUG" ]; then + set -x +fi +# Get the key from laconicd +laconicd_key=$( docker compose exec laconicd echo y | docker compose exec laconicd laconicd keys export mykey --unarmored-hex --unsafe ) +# Set parameters for the test suite +cosmos_chain_id=laconic_9000-1 +laconicd_rest_endpoint=http://laconicd:1317 +laconicd_gql_endpoint=http://laconicd:9473/api +# Run tests +docker network inspect sdk_tests_default +sleep 30s +docker logs sdk_tests-laconicd-1 + +docker compose exec sdk-test-runner sh -c "COSMOS_CHAIN_ID=${cosmos_chain_id} LACONICD_REST_ENDPOINT=${laconicd_rest_endpoint} LACONICD_GQL_ENDPOINT=${laconicd_gql_endpoint} PRIVATE_KEY=${laconicd_key} yarn test:auctions" diff --git a/tests/sdk_tests/run-all-tests.sh b/tests/sdk_tests/run-nameservice-expiry-tests.sh similarity index 62% rename from tests/sdk_tests/run-all-tests.sh rename to tests/sdk_tests/run-nameservice-expiry-tests.sh index c3969e57..572eaa46 100755 --- a/tests/sdk_tests/run-all-tests.sh +++ b/tests/sdk_tests/run-nameservice-expiry-tests.sh @@ -11,8 +11,6 @@ laconicd_gql_endpoint=http://laconicd:9473/api # Run tests docker network inspect sdk_tests_default sleep 30s - -docker compose exec sdk-test-runner sh -c "COSMOS_CHAIN_ID=${cosmos_chain_id} LACONICD_REST_ENDPOINT=${laconicd_rest_endpoint} LACONICD_GQL_ENDPOINT=${laconicd_gql_endpoint} PRIVATE_KEY=${laconicd_key} yarn test" -docker compose exec sdk-test-runner sh -c "COSMOS_CHAIN_ID=${cosmos_chain_id} LACONICD_REST_ENDPOINT=${laconicd_rest_endpoint} LACONICD_GQL_ENDPOINT=${laconicd_gql_endpoint} PRIVATE_KEY=${laconicd_key} yarn test:auctions" -docker compose exec sdk-test-runner sh -c "COSMOS_CHAIN_ID=${cosmos_chain_id} LACONICD_REST_ENDPOINT=${laconicd_rest_endpoint} LACONICD_GQL_ENDPOINT=${laconicd_gql_endpoint} PRIVATE_KEY=${laconicd_key} yarn test:nameservice-expiry" docker logs sdk_tests-laconicd-1 + +docker compose exec sdk-test-runner sh -c "COSMOS_CHAIN_ID=${cosmos_chain_id} LACONICD_REST_ENDPOINT=${laconicd_rest_endpoint} LACONICD_GQL_ENDPOINT=${laconicd_gql_endpoint} PRIVATE_KEY=${laconicd_key} yarn test:nameservice-expiry"