-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* patch paths on github actions * fix text output of autopay instructions
- Loading branch information
1 parent
e827fb8
commit c3b7c82
Showing
13 changed files
with
255 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"autopay_instructions": [ | ||
{ | ||
"note": "test balance", | ||
"uid": 0, | ||
"destination": "88E74DFED34420F2AD8032148280A84B", | ||
"type_of": "FixedOnce", | ||
"value": 1, | ||
"duration_epochs": 1 | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
SHELL=/usr/bin/env bash | ||
DATA_PATH = ${HOME}/.0L | ||
SWARM_TEMP = ${DATA_PATH}/swarm_temp | ||
LOG=${DATA_PATH}/test-mining.log | ||
UNAME := $(shell uname) | ||
|
||
NODE_ENV=test | ||
TEST=y | ||
|
||
ifndef SOURCE_PATH | ||
SOURCE_PATH = ${HOME}/libra | ||
endif | ||
MAKE_FILE = ${SOURCE_PATH}/ol/integration-tests/test-autopay.mk | ||
|
||
# alice | ||
ifndef PERSONA | ||
PERSONA=alice | ||
endif | ||
|
||
MNEM="talent sunset lizard pill fame nuclear spy noodle basket okay critic grow sleep legend hurry pitch blanket clerk impose rough degree sock insane purse" | ||
|
||
NUM_NODES = 2 | ||
|
||
START_TEXT = "To run the Libra CLI client" | ||
SUCCESS_TEXT = "transaction executed" | ||
|
||
ifndef AUTOPAY_FILE | ||
AUTOPAY_FILE = alice.autopay_batch.json | ||
endif | ||
|
||
test: swarm check-swarm send-tx check-tx check-autopay check-transfer stop | ||
|
||
test-percent-change: | ||
AUTOPAY_FILE=alice.autopay_batch.json make -f ${MAKE_FILE} test | ||
|
||
test-fixed-once: | ||
AUTOPAY_FILE=alice.fixed_once.autopay_batch.json make -f ${MAKE_FILE} test | ||
|
||
swarm: | ||
@echo Building Swarm | ||
rm -rf ${SWARM_TEMP} | ||
mkdir ${SWARM_TEMP} | ||
cd ${SOURCE_PATH} && cargo build -p libra-node -p cli | ||
cd ${SOURCE_PATH} && cargo run -p libra-swarm -- --libra-node ${SOURCE_PATH}/target/debug/libra-node -c ${SWARM_TEMP} -n ${NUM_NODES} &> ${LOG} & | ||
|
||
stop: | ||
killall libra-swarm libra-node miner ol | true | ||
|
||
echo: | ||
@echo hi &> ${LOG} & | ||
|
||
init: | ||
cd ${SOURCE_PATH} && cargo r -p ol -- --swarm-path ${SWARM_TEMP} --swarm-persona ${PERSONA} init --source-path ${SOURCE_PATH} | ||
|
||
tx: | ||
cd ${SOURCE_PATH} && NODE_ENV=test TEST=y cargo r -p txs -- --swarm-path ${SWARM_TEMP} --swarm-persona ${PERSONA} autopay-batch -f ${SOURCE_PATH}/ol/fixtures/autopay/${AUTOPAY_FILE} | ||
|
||
resources: | ||
cd ${SOURCE_PATH} && cargo run -p ol -- --swarm-path ${SWARM_TEMP} --swarm-persona ${PERSONA} query --resources | ||
|
||
balance: | ||
cd ${SOURCE_PATH} && cargo run -p ol -- --swarm-path ${SWARM_TEMP} --swarm-persona ${PERSONA} query --balance | ||
|
||
balance-bob: | ||
cd ${SOURCE_PATH} && cargo run -p ol -- --account 88E74DFED34420F2AD8032148280A84B --swarm-path ${SWARM_TEMP} --swarm-persona ${PERSONA} query --balance | ||
|
||
|
||
check-swarm: | ||
@while [[ ${NOW} -le ${END} ]] ; do \ | ||
if grep -q ${START_TEXT} ${LOG} ; then \ | ||
break; \ | ||
else \ | ||
echo . ; \ | ||
fi ; \ | ||
echo "Sleeping for 5 secs" ; \ | ||
sleep 5 ; \ | ||
done | ||
|
||
send-tx: | ||
PERSONA=alice make -f ${MAKE_FILE} init | ||
PERSONA=alice make -f ${MAKE_FILE} tx &>> ${LOG} & | ||
|
||
check-tx: | ||
@while [[ ${NOW} -le ${END} ]] ; do \ | ||
if grep -q ${SUCCESS_TEXT} ${LOG} ; then \ | ||
echo TX SUCCESS ; \ | ||
break ; \ | ||
else \ | ||
echo . ; \ | ||
fi ; \ | ||
echo "Sleeping for 5 secs" ; \ | ||
sleep 5 ; \ | ||
done | ||
|
||
check-autopay: | ||
# checks if there is any mention of BOB's account as a payee | ||
PERSONA=alice make -f ${MAKE_FILE} resources | grep -e '88E74DFED34420F2AD8032148280A84B' -e 'payee' | ||
|
||
|
||
check-transfer: | ||
# swarm accounts start with a balance of 4 | ||
@while [[ ${NOW} -le ${END} ]] ; do \ | ||
if PERSONA=alice make -f ${MAKE_FILE} balance-bob | grep -e '5'; then \ | ||
echo TX SUCCESS ; \ | ||
break ; \ | ||
else \ | ||
echo . ; \ | ||
fi ; \ | ||
echo "Sleeping for 5 secs" ; \ | ||
sleep 5 ; \ | ||
done | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.