-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed repetetive objects loading from ipfs (#513)
* Fixed unnecessary ram consumption * Light refactor of upgrade commit * Copy changes to v5 * fixed repetetive objects loading from ipfs * Fixed upgrade over 1 version * Fixed test * ci tests * fix typo * fix a bug * Fix test13 * build all versions * Increased version --------- Co-authored-by: SilkovAlexander <[email protected]> Co-authored-by: SilkovAlexander <[email protected]> Co-authored-by: Vasily Selivanov <[email protected]>
- Loading branch information
1 parent
2e52e2a
commit 9341667
Showing
60 changed files
with
1,043 additions
and
577 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
#!/bin/bash | ||
set -e | ||
set -o pipefail | ||
. ./util.sh | ||
set -x | ||
|
||
# Test 28 - ensure that content from ipfs loaded once per blob. | ||
|
||
if [[ "$VERSION" == *"v1_x"* ]]; then | ||
echo "Test is ignored for v1" | ||
exit 0 | ||
fi | ||
|
||
REPO_NAME="repo28_$(date +%s)" | ||
|
||
[ -d $REPO_NAME ] && rm -rf $REPO_NAME | ||
|
||
deploy_repo | ||
REPO_ADDR=$(get_repo_addr) | ||
|
||
echo "***** awaiting repo deploy *****" | ||
wait_account_active $REPO_ADDR | ||
|
||
echo "***** cloning repo *****" | ||
git clone gosh://$SYSTEM_CONTRACT_ADDR/$DAO_NAME/$REPO_NAME | ||
|
||
#check | ||
cd $REPO_NAME | ||
|
||
# config git client | ||
git config user.email "[email protected]" | ||
git config user.name "My name" | ||
git branch -m main | ||
|
||
max_files=10 | ||
file_name=big_file.dat | ||
|
||
for n in $(seq 1 $max_files); do | ||
dd if=/dev/urandom of=$file_name bs=16K count=10 | ||
git add $file_name | ||
git commit -m "main: update '$file_name' ($n)" | ||
git push -u origin main | ||
delay 10 | ||
done | ||
|
||
cd .. | ||
|
||
GOSH_TRACE=5 git clone gosh://$SYSTEM_CONTRACT_ADDR/$DAO_NAME/$REPO_NAME "${REPO_NAME}-clone" &> trace-clone.log | ||
|
||
set +o pipefail | ||
cnt=$(grep -c "load_data_from_ipfs: ipfs_address=" trace-clone.log) | ||
|
||
if (( $cnt != $max_files )); then | ||
echo "TEST FAILED" | ||
exit 1 | ||
fi | ||
|
||
echo "TEST SUCCEEDED" |
112 changes: 112 additions & 0 deletions
112
tests/upgrade_tests/02_5-push_after_upgrade_over_version.test.sh.ignore
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 @@ | ||
#!/bin/bash | ||
set -e | ||
set -o pipefail | ||
. ./util.sh | ||
|
||
set -x | ||
|
||
if [ "$1" = "ignore" ]; then | ||
echo "Test $0 ignored" | ||
exit 0 | ||
fi | ||
|
||
REPO_NAME=upgrade_repo02_5 | ||
DAO_NAME="dao-upgrade-test02_5_$(date +%s)" | ||
NEW_REPO_PATH=upgrade_repo02_5_v2 | ||
|
||
# delete folders | ||
[ -d $REPO_NAME ] && rm -rf $REPO_NAME | ||
[ -d $NEW_REPO_PATH ] && rm -rf $NEW_REPO_PATH | ||
|
||
# deploy new DAO that will be upgraded | ||
deploy_DAO_and_repo | ||
|
||
export OLD_LINK="gosh://$SYSTEM_CONTRACT_ADDR/$DAO_NAME/$REPO_NAME" | ||
echo "OLD_LINK=$OLD_LINK" | ||
|
||
echo "***** cloning old version repo *****" | ||
git clone $OLD_LINK | ||
|
||
# check | ||
cd $REPO_NAME | ||
git config user.email "[email protected]" | ||
git config user.name "My name" | ||
git branch -m main | ||
|
||
# push 1 file | ||
echo "***** Pushing file to old repo *****" | ||
echo old_ver > 1.txt | ||
git add 1.txt | ||
git commit -m test | ||
git push -u origin main | ||
#git log | ||
|
||
cd .. | ||
|
||
echo "Upgrade DAO" | ||
upgrade_DAO | ||
|
||
echo "***** new repo02_5 deploy *****" | ||
tonos-cli call --abi $WALLET_ABI_1 --sign $WALLET_KEYS $WALLET_ADDR AloneDeployRepository \ | ||
"{\"nameRepo\":\"$REPO_NAME\",\"descr\":\"\",\"previous\":{\"addr\":\"$REPO_ADDR\", \"version\":\"$CUR_VERSION\"}}" || exit 1 | ||
REPO_ADDR=$(tonos-cli -j run $SYSTEM_CONTRACT_ADDR_1 getAddrRepository "{\"name\":\"$REPO_NAME\",\"dao\":\"$DAO_NAME\"}" --abi $SYSTEM_CONTRACT_ABI_1 | sed -n '/value0/ p' | cut -d'"' -f 4) | ||
|
||
echo "***** awaiting repo deploy *****" | ||
wait_account_active $REPO_ADDR | ||
sleep 3 | ||
|
||
tonos-cli callx --addr $WALLET_ADDR --abi $WALLET_ABI_1 --keys $WALLET_KEYS -m sendTokenToNewVersionAuto | ||
sleep 30 | ||
|
||
tonos-cli callx --addr $WALLET_ADDR --abi $WALLET_ABI_1 --keys $WALLET_KEYS -m sendTokenToNewVersionAuto | ||
sleep 30 | ||
|
||
tonos-cli callx --addr "$WALLET_ADDR" --abi "$WALLET_ABI_1" --keys "$WALLET_KEYS" -m lockVoting --amount 0 | ||
|
||
sleep 30 | ||
|
||
echo "Upgrade DAO" | ||
upgrade_DAO $TEST_VERSION2 $SYSTEM_CONTRACT_ADDR_2 | ||
|
||
echo "***** new repo02_5 deploy *****" | ||
tonos-cli call --abi $WALLET_ABI_1 --sign $WALLET_KEYS $WALLET_ADDR AloneDeployRepository \ | ||
"{\"nameRepo\":\"$REPO_NAME\",\"descr\":\"\",\"previous\":{\"addr\":\"$REPO_ADDR\", \"version\":\"$TEST_VERSION1\"}}" || exit 1 | ||
REPO_ADDR=$(tonos-cli -j run $SYSTEM_CONTRACT_ADDR_2 getAddrRepository "{\"name\":\"$REPO_NAME\",\"dao\":\"$DAO_NAME\"}" --abi $SYSTEM_CONTRACT_ABI_2 | sed -n '/value0/ p' | cut -d'"' -f 4) | ||
|
||
echo "***** awaiting repo deploy *****" | ||
wait_account_active $REPO_ADDR | ||
sleep 3 | ||
|
||
export NEW_LINK="gosh://$SYSTEM_CONTRACT_ADDR_1/$DAO_NAME/$REPO_NAME" | ||
echo "NEW_LINK=$NEW_LINK" | ||
|
||
echo "***** push after upgrade *****" | ||
cd $REPO_NAME | ||
git fetch | ||
echo new_ver > 1.txt | ||
git add 1.txt | ||
git commit -m test2 | ||
GOSH_TRACE=5 git push -u origin main &> ../trace_2_5.log | ||
|
||
wait_set_commit $REPO_ADDR main | ||
|
||
cd .. | ||
|
||
sleep 20 | ||
|
||
echo "***** cloning repo with new link *****" | ||
git clone $NEW_LINK $NEW_REPO_PATH | ||
|
||
echo "***** push to new version *****" | ||
cd $NEW_REPO_PATH | ||
|
||
cur_ver=$(cat 1.txt) | ||
if [ $cur_ver != "new_ver" ]; then | ||
echo "WRONG VERSION" | ||
exit 1 | ||
fi | ||
echo "GOOD VERSION" | ||
|
||
cd .. | ||
|
||
echo "TEST SUCCEEDED" |
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
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
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
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.