Run registry CLI tests as part of laconicd fixturenet test workflow
All checks were successful
Lint Checks / Run linter (pull_request) Successful in 47s
Webapp Test / Run webapp test suite (pull_request) Successful in 5m1s
Deploy Test / Run deploy test suite (pull_request) Successful in 5m55s
Smoke Test / Run basic test suite (pull_request) Successful in 6m1s
K8s Deploy Test / Run deploy test suite on kind/k8s (pull_request) Successful in 10m27s

This commit is contained in:
Prathamesh Musale 2024-04-01 13:52:32 +05:30
parent d2442bcc9b
commit fbde144880
4 changed files with 65 additions and 0 deletions

View File

@ -46,3 +46,6 @@ jobs:
run: ./scripts/build_shiv_package.sh
- name: "Run fixturenet-laconicd tests"
run: ./tests/fixturenet-laconicd/run-test.sh
# TODO: Separate out in a job
- name: "Run laconic CLI tests"
run: ./tests/fixturenet-laconicd/run-cli-test.sh

View File

@ -3,6 +3,9 @@ services:
restart: unless-stopped
image: cerc/laconicd:local
command: ["sh", "/docker-entrypoint-scripts.d/create-fixturenet.sh"]
environment:
TEST_AUCTION_ENABLED: ${TEST_AUCTION_ENABLED}
TEST_REGISTRY_EXPIRY: ${TEST_REGISTRY_EXPIRY}
volumes:
# The cosmos-sdk node's database directory:
- laconicd-data:/root/.laconicd

View File

@ -52,6 +52,10 @@ RUN npm config set @cerc-io:registry ${CERC_NPM_REGISTRY_URL} \
# Globally install the cli package
RUN yarn global add @cerc-io/laconic-registry-cli
# Clone the repo for running CLI tests inside the container
RUN git clone https://git.vdb.to/cerc-io/laconic-registry-cli.git \
&& cd laconic-registry-cli && yarn
# Add scripts
RUN mkdir /scripts
RUN mkdir /scripts/demo-records

View File

@ -0,0 +1,55 @@
#!/usr/bin/env bash
set -e
if [ -n "$CERC_SCRIPT_DEBUG" ]; then
set -x
fi
echo "$(date +"%Y-%m-%d %T"): Running stack-orchestrator Laconicd fixturenet test"
env
cat /etc/hosts
# Bit of a hack, test the most recent package
TEST_TARGET_SO=$( ls -t1 ./package/laconic-so* | head -1 )
echo "$(date +"%Y-%m-%d %T"): Starting stack"
TEST_AUCTION_ENABLED=true $TEST_TARGET_SO --stack fixturenet-laconicd deploy --cluster laconicd up
echo "$(date +"%Y-%m-%d %T"): Stack started"
# Verify that the fixturenet is up and running
$TEST_TARGET_SO --stack fixturenet-laconicd deploy --cluster laconicd ps
# Get the key from laconicd
laconicd_key=$(docker exec laconicd-laconicd-1 sh -c 'yes | laconicd keys export mykey --unarmored-hex --unsafe')
# Get the fixturenet account address
laconicd_account_address=$(docker exec laconicd-laconicd-1 laconicd keys list | awk '/- address:/ {print $3}')
# 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
# Create the required config and copy it over inside the container
config_file="config.yml"
config=$(cat <<EOL
services:
cns:
restEndpoint: $laconicd_rest_endpoint
gqlEndpoint: $laconicd_gql_endpoint
userKey: $laconicd_key
bondId:
chainId: $cosmos_chain_id
gas: 200000
fees: 200000aphoton
EOL
)
echo "$config" > "$config_file"
docker cp $config_file laconicd-cli-1:laconic-registry-cli/config.yml
# Run the tests
docker exec -it -e TEST_ACCOUNT=$laconicd_account_address laconicd-cli-1 sh -c 'cd laconic-registry-cli && yarn test'
# Clean up
$TEST_TARGET_SO --stack fixturenet-laconicd deploy --cluster laconicd down --delete-volumes
echo "$(date +"%Y-%m-%d %T"): Test finished"