From 737c178b772c8ef790674661f848edc779a866f0 Mon Sep 17 00:00:00 2001 From: Gary <982483+gmalouf@users.noreply.github.com> Date: Fri, 3 May 2024 13:55:50 -0400 Subject: [PATCH] Update test/scripts/e2e_subs/goal-account-asset.sh Co-authored-by: Jason Paulos --- test/scripts/e2e_subs/goal-account-asset.sh | 85 +++++++++++++++++++-- 1 file changed, 79 insertions(+), 6 deletions(-) diff --git a/test/scripts/e2e_subs/goal-account-asset.sh b/test/scripts/e2e_subs/goal-account-asset.sh index f01000b1d5..3366838d9e 100755 --- a/test/scripts/e2e_subs/goal-account-asset.sh +++ b/test/scripts/e2e_subs/goal-account-asset.sh @@ -41,16 +41,89 @@ ${gcmd} asset optin --account ${ACCOUNTB} --assetid ${ASSET_D_ID} --signer ${ACC # displays held assets ${gcmd} account info -a ${ACCOUNTB} -# query account assets w/ details -${gcmd} account assetdetails -a ${ACCOUNTA} -l 2 -n 1004 -${gcmd} account assetdetails -a ${ACCOUNTB} +# wait a few rounds for the asset optins to get into the db, since the account asset info endpoint +# does not look at in memory deltas +${gcmd} clerk send -a 0 -f ${ACCOUNTA} -t ${ACCOUNTB} +${gcmd} clerk send -a 0 -f ${ACCOUNTA} -t ${ACCOUNTB} +${gcmd} clerk send -a 0 -f ${ACCOUNTA} -t ${ACCOUNTB} + +# query account assets w/ details, (1) +RES=$(${gcmd} account assetdetails -a ${ACCOUNTB}) +if [[ ${RES} != *"Account: ${ACCOUNTB}"* ]]; then + date '+goal-account-asset-test assetdetails (1) should be for correct account %Y%m%d_%H%M%S' + false +fi +if [[ ${RES} != *"Asset ID: ${ASSET_A_ID}"$'\n'" Amount: 0"* ]]; then + date '+goal-account-asset-test assetdetails (1) should contain asset A %Y%m%d_%H%M%S' + false +fi +if [[ ${RES} != *"Asset ID: ${ASSET_B_ID}"$'\n'" Amount: 0"* ]]; then + date '+goal-account-asset-test assetdetails (1) should contain asset B %Y%m%d_%H%M%S' + false +fi +if [[ ${RES} != *"Asset ID: ${ASSET_C_ID}"$'\n'" Amount: 0"* ]]; then + date '+goal-account-asset-test assetdetails (1) should contain asset C %Y%m%d_%H%M%S' + false +fi +if [[ ${RES} != *"Asset ID: ${ASSET_D_ID}"$'\n'" Amount: 0"* ]]; then + date '+goal-account-asset-test assetdetails (1) should contain asset D %Y%m%d_%H%M%S' + false +fi + +# query account assets w/ details, limit 2, next set to asset B, (2) +RES=$(${gcmd} account assetdetails -a ${ACCOUNTB} -l 2 -n ${ASSET_B_ID}) +if [[ ${RES} != *"Account: ${ACCOUNTB}"* ]]; then + date '+goal-account-asset-test assetdetails (2) should be for correct account %Y%m%d_%H%M%S' + false +fi +if [[ ${RES} == *"Asset ID: ${ASSET_A_ID}"* ]]; then + date '+goal-account-asset-test assetdetails (2) should not contain asset A %Y%m%d_%H%M%S' + false +fi +if [[ ${RES} == *"Asset ID: ${ASSET_B_ID}"* ]]; then + date '+goal-account-asset-test assetdetails (2) should not contain asset B %Y%m%d_%H%M%S' + false +fi +if [[ ${RES} != *"Asset ID: ${ASSET_C_ID}"$'\n'" Amount: 0"* ]]; then + date '+goal-account-asset-test assetdetails (2) should contain asset C %Y%m%d_%H%M%S' + false +fi +if [[ ${RES} != *"Asset ID: ${ASSET_D_ID}"$'\n'" Amount: 0"* ]]; then + date '+goal-account-asset-test assetdetails (2) should contain asset D %Y%m%d_%H%M%S' + false +fi # delete one of the asset ${gcmd} asset destroy --assetid ${ASSET_B_ID} --creator ${ACCOUNTA} --signer ${ACCOUNTA} -# query account assets w/ details -${gcmd} account assetdetails -a ${ACCOUNTA} -l 2 -n 1004 -${gcmd} account assetdetails -a ${ACCOUNTB} +# wait a few rounds for the deletion to get into the db +${gcmd} clerk send -a 0 -f ${ACCOUNTA} -t ${ACCOUNTB} +${gcmd} clerk send -a 0 -f ${ACCOUNTA} -t ${ACCOUNTB} +${gcmd} clerk send -a 0 -f ${ACCOUNTA} -t ${ACCOUNTB} + +# query account assets w/ details after deletion, (3) +RES=$(${gcmd} account assetdetails -a ${ACCOUNTB}) +if [[ ${RES} != *"Account: ${ACCOUNTB}"* ]]; then + date '+goal-account-asset-test assetdetails (3) should be for correct account %Y%m%d_%H%M%S' + false +fi +if [[ ${RES} != *"Asset ID: ${ASSET_A_ID}"$'\n'" Amount: 0"* ]]; then + date '+goal-account-asset-test assetdetails (3) should contain asset A %Y%m%d_%H%M%S' + false +fi +# ensure asset B is still present, but its params are unavailable +if [[ ${RES} != *"Asset ID: ${ASSET_B_ID}"$'\n'" Amount (without formatting): 0"* ]]; then + date '+goal-account-asset-test assetdetails (3) should contain asset B without asset params %Y%m%d_%H%M%S' + false +fi +if [[ ${RES} != *"Asset ID: ${ASSET_C_ID}"$'\n'" Amount: 0"* ]]; then + date '+goal-account-asset-test assetdetails (3) should contain asset C %Y%m%d_%H%M%S' + false +fi +if [[ ${RES} != *"Asset ID: ${ASSET_D_ID}"$'\n'" Amount: 0"* ]]; then + date '+goal-account-asset-test assetdetails (3) should contain asset D %Y%m%d_%H%M%S' + false +fi # check account info display RES=$(${gcmd} account info -a ${ACCOUNTB})