From 891f372bb236ba5dd050f6814f8039067ba68dd6 Mon Sep 17 00:00:00 2001 From: Ikenna Omekam Date: Wed, 16 Aug 2023 19:31:31 -0400 Subject: [PATCH] test: add tests from agoric-upgrade-10 to agoric-upgrade-11 --- .../agoric-upgrade-11/actions.sh | 26 +++++++++++++++++++ .../agoric-upgrade-11/pre_test.sh | 21 +++++++++++++++ 2 files changed, 47 insertions(+) diff --git a/packages/deployment/upgrade-test/upgrade-test-scripts/agoric-upgrade-11/actions.sh b/packages/deployment/upgrade-test/upgrade-test-scripts/agoric-upgrade-11/actions.sh index 1ab98891560..a535679ff83 100644 --- a/packages/deployment/upgrade-test/upgrade-test-scripts/agoric-upgrade-11/actions.sh +++ b/packages/deployment/upgrade-test/upgrade-test-scripts/agoric-upgrade-11/actions.sh @@ -84,3 +84,29 @@ echo +++++ Run prober second time +++++ # Re-run prober test and expect internal atomicRearrange. $upgrade11/zoe-full-upgrade/run-prober.sh test_val "$(agd query vstorage data published.prober-asid9a -o jsonlines | jq -r '.value' | jq -r '.values[0]')" "true" "Prober called zcf.atomicReallocate()" + +test_not_val "$(agops vaults list --from $GOV1ADDR)" "" "gov1 has no vaults" + +# open up a vault +OFFER=$(mktemp -t agops.XXX) +agops vaults open --wantMinted 7.00 --giveCollateral 11.0 >|"$OFFER" +agops perf satisfaction --from "$GOV1ADDR" --executeOffer "$OFFER" --keyring-backend=test + +# put some IST in +OFFER=$(mktemp -t agops.XXX) +agops vaults adjust --vaultId vault3 --giveMinted 1.5 --from $GOV1ADDR --keyring-backend=test >|"$OFFER" +agops perf satisfaction --from "$GOV1ADDR" --executeOffer "$OFFER" --keyring-backend=test + +# add some collateral +OFFER=$(mktemp -t agops.XXX) +agops vaults adjust --vaultId vault3 --giveCollateral 2.0 --from $GOV1ADDR --keyring-backend="test" >|"$OFFER" +agops perf satisfaction --from "$GOV1ADDR" --executeOffer "$OFFER" --keyring-backend=test + +# close out +OFFER=$(mktemp -t agops.XXX) +agops vaults close --vaultId vault3 --giveMinted 5.75 --from $GOV1ADDR --keyring-backend="test" >|"$OFFER" +agops perf satisfaction --from "$GOV1ADDR" --executeOffer "$OFFER" --keyring-backend=test + +test_val $(agoric follow -l -F :published.vaultFactory.managers.manager0.vaults.vault3 -o jsonlines | jq -r '.vaultState') "closed" "vault3 is closed" +test_val $(agoric follow -l -F :published.vaultFactory.managers.manager0.vaults.vault3 -o jsonlines | jq -r '.locked.value') "0" "vault3 contains no collateral" +test_val $(agoric follow -l -F :published.vaultFactory.managers.manager0.vaults.vault3 -o jsonlines | jq -r '.debtSnapshot.debt.value') "0" "vault3 has no debt" diff --git a/packages/deployment/upgrade-test/upgrade-test-scripts/agoric-upgrade-11/pre_test.sh b/packages/deployment/upgrade-test/upgrade-test-scripts/agoric-upgrade-11/pre_test.sh index 418bea44937..e391bde4e32 100755 --- a/packages/deployment/upgrade-test/upgrade-test-scripts/agoric-upgrade-11/pre_test.sh +++ b/packages/deployment/upgrade-test/upgrade-test-scripts/agoric-upgrade-11/pre_test.sh @@ -10,3 +10,24 @@ upgrade11=./upgrade-test-scripts/agoric-upgrade-11 # zoe vat is at incarnation 0 test_val "$(yarn --silent node $upgrade11/vat-status.mjs zoe)" "0" "zoe vat incarnation" + +# validate agoric-upgrade-10 metrics after update + +test_val $(agd q vstorage children published.vaultFactory.managers.manager0.vaults -o json | jq -r '.children | length') 3 "we have three vaults" +test_val $(agoric follow -l -F :published.vaultFactory.managers.manager0.metrics -o jsonlines | jq -r '.numActiveVaults') 1 "only one vault is active" + +test_val $(agoric follow -l -F :published.vaultFactory.managers.manager0.metrics -o jsonlines | jq -r '.totalDebt.value') "6030000" "totalDebt is correct" +test_val $(agoric follow -l -F :published.vaultFactory.managers.manager0.metrics -o jsonlines | jq -r '.totalCollateral.value') "8000000" "totalCollateral is correct" + +test_val $(agoric follow -l -F :published.vaultFactory.managers.manager0.vaults.vault0 -o jsonlines | jq -r '.vaultState') "active" "vault0 is open" +test_val $(agoric follow -l -F :published.vaultFactory.managers.manager0.vaults.vault0 -o jsonlines | jq -r '.locked.value') "8000000" "vault0 contains 8 ATOM collateral" +test_val $(agoric follow -l -F :published.vaultFactory.managers.manager0.vaults.vault0 -o jsonlines | jq -r '.debtSnapshot.debt.value') "6030000" "vault0 debt is 6.03 IST" + +test_val $(agoric follow -l -F :published.vaultFactory.managers.manager0.vaults.vault1 -o jsonlines | jq -r '.vaultState') "closed" "vault1 is closed" +test_val $(agoric follow -l -F :published.vaultFactory.managers.manager0.vaults.vault1 -o jsonlines | jq -r '.locked.value') "0" "vault1 contains no collateral" +test_val $(agoric follow -l -F :published.vaultFactory.managers.manager0.vaults.vault1 -o jsonlines | jq -r '.debtSnapshot.debt.value') "0" "vault1 has no debt" + +test_val $(agoric follow -l -F :published.vaultFactory.managers.manager0.vaults.vault2 -o jsonlines | jq -r '.vaultState') "closed" "vault2 is closed" +test_val $(agoric follow -l -F :published.vaultFactory.managers.manager0.vaults.vault2 -o jsonlines | jq -r '.locked.value') "0" "vault2 contains no collateral" +test_val $(agoric follow -l -F :published.vaultFactory.managers.manager0.vaults.vault2 -o jsonlines | jq -r '.debtSnapshot.debt.value') "0" "vault2 has no debt" +