From 366752a77c9c0208961dc27554c695b611ac229c Mon Sep 17 00:00:00 2001 From: David Boreham Date: Wed, 21 Dec 2022 13:47:30 -0700 Subject: [PATCH 1/3] Use correct chain id --- init.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.sh b/init.sh index b06d0db4..b18ba487 100755 --- a/init.sh +++ b/init.sh @@ -1,7 +1,7 @@ #!/bin/bash KEY="mykey" -CHAINID="ethermint_9000-1" +CHAINID="laconic_9000-1" MONIKER="localtestnet" KEYRING="test" KEYALGO="eth_secp256k1" From c431d4eca5ae62ab9338cf73e8ae6828bbbe859e Mon Sep 17 00:00:00 2001 From: David Boreham Date: Wed, 21 Dec 2022 13:51:01 -0700 Subject: [PATCH 2/3] Remove special branch --- tests/sdk_tests/Dockerfile-sdk | 52 +++++++++++++++++++++ tests/sdk_tests/build-laconicd-container.sh | 3 ++ tests/sdk_tests/build-sdk-test-container.sh | 3 ++ tests/sdk_tests/docker-compose.yml | 29 ++++++++++++ tests/sdk_tests/entrypoint.sh | 3 ++ tests/sdk_tests/run-tests.sh | 12 +++++ 6 files changed, 102 insertions(+) create mode 100644 tests/sdk_tests/Dockerfile-sdk create mode 100755 tests/sdk_tests/build-laconicd-container.sh create mode 100755 tests/sdk_tests/build-sdk-test-container.sh create mode 100644 tests/sdk_tests/docker-compose.yml create mode 100755 tests/sdk_tests/entrypoint.sh create mode 100755 tests/sdk_tests/run-tests.sh diff --git a/tests/sdk_tests/Dockerfile-sdk b/tests/sdk_tests/Dockerfile-sdk new file mode 100644 index 00000000..fd9d6cc9 --- /dev/null +++ b/tests/sdk_tests/Dockerfile-sdk @@ -0,0 +1,52 @@ +# Originally from: https://github.com/devcontainers/images/blob/main/src/javascript-node/.devcontainer/Dockerfile +# [Choice] Node.js version (use -bullseye variants on local arm64/Apple Silicon): 18, 16, 14, 18-bullseye, 16-bullseye, 14-bullseye, 18-buster, 16-buster, 14-buster +ARG VARIANT=16-bullseye +FROM node:${VARIANT} + +ARG USERNAME=node +ARG NPM_GLOBAL=/usr/local/share/npm-global + +# Add NPM global to PATH. +ENV PATH=${NPM_GLOBAL}/bin:${PATH} + +RUN \ + # Configure global npm install location, use group to adapt to UID/GID changes + if ! cat /etc/group | grep -e "^npm:" > /dev/null 2>&1; then groupadd -r npm; fi \ + && usermod -a -G npm ${USERNAME} \ + && umask 0002 \ + && mkdir -p ${NPM_GLOBAL} \ + && touch /usr/local/etc/npmrc \ + && chown ${USERNAME}:npm ${NPM_GLOBAL} /usr/local/etc/npmrc \ + && chmod g+s ${NPM_GLOBAL} \ + && npm config -g set prefix ${NPM_GLOBAL} \ + && su ${USERNAME} -c "npm config -g set prefix ${NPM_GLOBAL}" \ + # Install eslint + && su ${USERNAME} -c "umask 0002 && npm install -g eslint" \ + && npm cache clean --force > /dev/null 2>&1 + +# [Optional] Uncomment this section to install additional OS packages. +# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ +# && apt-get -y install --no-install-recommends + +# [Optional] Uncomment if you want to install an additional version of node using nvm +# ARG EXTRA_NODE_VERSION=10 +# RUN su node -c "source /usr/local/share/nvm/nvm.sh && nvm install ${EXTRA_NODE_VERSION}" + +# [Optional] Uncomment if you want to install more global node modules +# RUN su node -c "npm install -g " + +WORKDIR / +COPY entrypoint.sh . +ENTRYPOINT ["/entrypoint.sh"] +# Placeholder CMD : generally this will be overridden at run time like : +# docker run -it -v /home/builder/cerc/laconic-sdk:/workspace cerc/builder-js sh -c 'cd /workspace && yarn && yarn build' +CMD node --version + +# Temp hack, clone the laconic-sdk repo here +WORKDIR /app +RUN \ + git clone https://github.com/cerc-io/laconic-sdk.git \ + && cd laconic-sdk \ + && yarn install + +WORKDIR /app/laconic-sdk diff --git a/tests/sdk_tests/build-laconicd-container.sh b/tests/sdk_tests/build-laconicd-container.sh new file mode 100755 index 00000000..ed4b963d --- /dev/null +++ b/tests/sdk_tests/build-laconicd-container.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash +docker build -t cerc-io/laconicd:local-test ../../ + diff --git a/tests/sdk_tests/build-sdk-test-container.sh b/tests/sdk_tests/build-sdk-test-container.sh new file mode 100755 index 00000000..c4913889 --- /dev/null +++ b/tests/sdk_tests/build-sdk-test-container.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash +docker build -t cerc-io/laconic-sdk-tester:local-test -f Dockerfile-sdk . + diff --git a/tests/sdk_tests/docker-compose.yml b/tests/sdk_tests/docker-compose.yml new file mode 100644 index 00000000..f260d443 --- /dev/null +++ b/tests/sdk_tests/docker-compose.yml @@ -0,0 +1,29 @@ +services: + laconicd: + restart: unless-stopped + image: cerc-io/laconicd:local-test + command: ["sh", "/docker-entrypoint-scripts.d/create-fixturenet.sh"] + volumes: + - ../../init.sh:/docker-entrypoint-scripts.d/create-fixturenet.sh + healthcheck: + test: ["CMD", "wget", "-nv", "-t1", "--spider", "http://localhost: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/entrypoint.sh b/tests/sdk_tests/entrypoint.sh new file mode 100755 index 00000000..2bdf572b --- /dev/null +++ b/tests/sdk_tests/entrypoint.sh @@ -0,0 +1,3 @@ +#!/bin/sh +exec "$@" + diff --git a/tests/sdk_tests/run-tests.sh b/tests/sdk_tests/run-tests.sh new file mode 100755 index 00000000..f2e99b19 --- /dev/null +++ b/tests/sdk_tests/run-tests.sh @@ -0,0 +1,12 @@ +#!/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 | 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 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" From 1ba3cd8d9b005eed1c2be9a4fe99e75ce7b950b1 Mon Sep 17 00:00:00 2001 From: David Boreham Date: Tue, 3 Jan 2023 06:52:45 -0700 Subject: [PATCH 3/3] Back out chain id change, covered in another PR --- init.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.sh b/init.sh index b18ba487..b06d0db4 100755 --- a/init.sh +++ b/init.sh @@ -1,7 +1,7 @@ #!/bin/bash KEY="mykey" -CHAINID="laconic_9000-1" +CHAINID="ethermint_9000-1" MONIKER="localtestnet" KEYRING="test" KEYALGO="eth_secp256k1"