Skip to content
This repository has been archived by the owner on May 15, 2024. It is now read-only.

Commit

Permalink
chore: make devnet Makefile more resillient and informative
Browse files Browse the repository at this point in the history
  • Loading branch information
rvagg committed Oct 23, 2023
1 parent eb956fc commit d37c0f4
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 17 deletions.
29 changes: 17 additions & 12 deletions integration/test/Makefile
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
.PHONY: devnet/up devnet/down motionlarity/up motionlarity/down test

./devnet/.up:
echo "Run Boost Devnet from pre-built images"
rm -rf ./devnet/data && docker compose -f ./devnet/docker-compose.yaml up -d
echo "Await Lotus full node startup"
@echo "Running Boost Devnet from pre-built images"
@rm -rf ./devnet/data || (echo "\033[1mCould not clean devnet\033[0m, try running 'sudo rm -rf ./devnet/data'" && false)
docker compose -f ./devnet/docker-compose.yaml up -d
@echo "Awaiting Lotus full node startup..."
docker compose -f ./devnet/docker-compose.yaml exec lotus lotus wait-api --timeout=20m
echo "Await Lotus-miner full node startup"
@echo "Lotus full node started"
@echo "Awaiting Lotus-miner full node startup..."
docker compose -f ./devnet/docker-compose.yaml exec lotus-miner lotus-miner wait-api --timeout=20m
@echo "Lotus-miner full node started"
touch ./devnet/.up

devnet/up: ./devnet/.up
Expand All @@ -16,20 +19,22 @@ devnet/up: ./devnet/.up
touch ./devnet/.boostready

./motionlarity/.env.local: ./devnet/.up
echo "Set up Motion Wallet and API endpoints"
@echo "Setting up Motion Wallet and API endpoints"
cat ./motionlarity/.env > ./motionlarity/.env.local
echo "" >> ./motionlarity/.env.local
./integration-setup.sh ./motionlarity/.env.local

motionlarity/setup: ./motionlarity/.env.local ./devnet/.boostready

devnet/down: motionlarity/down
docker compose -f ./devnet/docker-compose.yaml down && sleep 2 && rm -rf ./devnet/data
rm ./devnet/.up || true
docker compose -f ./devnet/docker-compose.yaml down
sleep 2
rm -f ./devnet/.up || true
@rm -rf ./devnet/data || (echo "\033[31mCould not clean devnet\033[0m, try running 'sudo rm -rf ./devnet/data'" && false)

./motionlarity/.up: ./motionlarity/.env.local ./devnet/.boostready
./buildsingularity.sh
echo "Run Motionlarity"
@echo "Runing Motionlarity"
docker compose -f ./motionlarity/docker-compose.yaml --env-file ./motionlarity/.env.local up -d
./waitmotion.sh
touch ./motionlarity/.up
Expand All @@ -38,10 +43,10 @@ motionlarity/up: ./motionlarity/.up

motionlarity/down:
docker compose -f ./motionlarity/docker-compose.yaml down --rmi=all --volumes
rm ./motionlarity/.up || true
rm ./motionlarity/.env.local || true
rm ./devnet/.boostready || true
rm -f ./motionlarity/.up || true
rm -f ./motionlarity/.env.local || true
rm -f ./devnet/.boostready || true

test: motionlarity/up
echo "Run Motion integration tests"
@echo "Running Motion integration tests"
MOTION_INTEGRATION_TEST='true' go test . -v --count=1
9 changes: 6 additions & 3 deletions integration/test/boost-setup.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
#!/usr/bin/env bash

echo "setup boost pricing"
echo "Setting Boost pricing..."
for i in {1..10}
do
curl -X POST -d '{"operationName":"AppStorageAskUpdateMutation","variables":{"update":{"Price":"0", "VerifiedPrice": 0}},"query":"mutation AppStorageAskUpdateMutation($update: StorageAskUpdate!) {\n storageAskUpdate(update: $update)\n}\n"}' http://localhost:8080/graphql/query && break || sleep 5
done
curl -X POST -d '{"operationName":"AppStorageAskUpdateMutation","variables":{"update":{"Price":"0", "VerifiedPrice": 0}},"query":"mutation AppStorageAskUpdateMutation($update: StorageAskUpdate!) {\n storageAskUpdate(update: $update)\n}\n"}' http://localhost:8080/graphql/query && break
echo "Retrying..."
sleep 5
done
echo -e "\nBoost pricing set"
5 changes: 3 additions & 2 deletions integration/test/integration-setup.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash

echo "build config file and wallets for motion"
echo "Building config file and wallets for motion..."
# Setup Lotus API token
export `docker compose -f ./devnet/docker-compose.yaml exec lotus lotus auth api-info --perm=admin`
IFS=: read -r token path <<< "${FULLNODE_API_INFO}"
Expand All @@ -14,4 +14,5 @@ echo "MOTION_WALLET_ADDR=${MOTION_WALLET_ADDR}" >> $1
echo "MOTION_WALLET_KEY=${MOTION_WALLET_KEY}" >> $1
echo "MOTION_STORAGE_PROVIDERS=t01000" >> $1
echo "MOTION_API_ENDPOINT=http://localhost:40080" >> $1
echo "SINGULARITY_API_ENDPOINT=http://localhost:9091" >> $1
echo "SINGULARITY_API_ENDPOINT=http://localhost:9091" >> $1
echo "Done building config file and wallets for motion"

0 comments on commit d37c0f4

Please sign in to comment.