Skip to content

Commit

Permalink
Run registry CLI tests as part of laconicd fixturenet tests (#791)
Browse files Browse the repository at this point in the history
  • Loading branch information
2 people authored and ashwin committed Apr 4, 2024
1 parent d2442bc commit 105805c
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 3 deletions.
4 changes: 3 additions & 1 deletion .gitea/workflows/fixturenet-laconicd-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:

jobs:
test:
name: "Run an Laconicd fixturenet test"
name: "Run Laconicd fixturenet and Laconic CLI tests"
runs-on: ubuntu-latest
steps:
- name: 'Update'
Expand Down Expand Up @@ -46,3 +46,5 @@ jobs:
run: ./scripts/build_shiv_package.sh
- name: "Run fixturenet-laconicd tests"
run: ./tests/fixturenet-laconicd/run-test.sh
- name: "Run laconic CLI tests"
run: ./tests/fixturenet-laconicd/run-cli-test.sh
1 change: 1 addition & 0 deletions .gitea/workflows/triggers/fixturenet-laconicd-test
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
Change this file to trigger running the fixturenet-laconicd-test CI job
Trigger
Trigger
Trigger
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -25,6 +28,7 @@ services:
image: cerc/laconic-registry-cli:local
volumes:
- ../config/fixturenet-laconicd/registry-cli-config-template.yml:/registry-cli-config-template.yml
- ${BASE_DIR:-~/cerc}/laconic-registry-cli:/laconic-registry-cli

volumes:
laconicd-data:
37 changes: 37 additions & 0 deletions tests/fixturenet-laconicd/run-cli-test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/usr/bin/env bash

set -e
if [ -n "$CERC_SCRIPT_DEBUG" ]; then
set -x
fi

echo "$(date +"%Y-%m-%d %T"): Running stack-orchestrator Laconic registry CLI tests"
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 BASE_DIR=~/cerc $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 fixturenet account address
laconicd_account_address=$(docker exec laconicd-laconicd-1 laconicd keys list | awk '/- address:/ {print $3}')

# Copy over config
docker exec laconicd-cli-1 cp config.yml laconic-registry-cli/

# Wait for the laconid endpoint to come up
echo "Waiting for the RPC endpoint to come up"
docker exec laconicd-laconicd-1 sh -c "curl --retry 20 --retry-delay 3 --retry-connrefused http://127.0.0.1:9473/api"

# Run the tests
echo "Running the tests"
docker exec -e TEST_ACCOUNT=$laconicd_account_address laconicd-cli-1 sh -c 'cd laconic-registry-cli && yarn && yarn test'

# Clean up
$TEST_TARGET_SO --stack fixturenet-laconicd deploy --cluster laconicd down --delete-volumes
echo "$(date +"%Y-%m-%d %T"): Test finished"
4 changes: 2 additions & 2 deletions tests/webapp-test/run-webapp-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ set +e

CONTAINER_ID=$(docker run -p 3000:80 -d -e CERC_SCRIPT_DEBUG=$CERC_SCRIPT_DEBUG cerc/test-progressive-web-app:local)
sleep 3
wget -t 7 -O test.before -m http://localhost:3000
wget --tries 20 --retry-connrefused --waitretry=3 -O test.before -m http://localhost:3000

docker logs $CONTAINER_ID
docker remove -f $CONTAINER_ID

CONTAINER_ID=$(docker run -p 3000:80 -e CERC_WEBAPP_DEBUG=$CHECK -e CERC_SCRIPT_DEBUG=$CERC_SCRIPT_DEBUG -d cerc/test-progressive-web-app:local)
sleep 3
wget -t 7 -O test.after -m http://localhost:3000
wget --tries 20 --retry-connrefused --waitretry=3 -O test.after -m http://localhost:3000

docker logs $CONTAINER_ID
docker remove -f $CONTAINER_ID
Expand Down

0 comments on commit 105805c

Please sign in to comment.