From 6e4bfbba401b18d2da85aeb3b2503e6415300441 Mon Sep 17 00:00:00 2001 From: Andre Popovitch Date: Mon, 19 Aug 2024 11:36:47 -0500 Subject: [PATCH] add more logging --- run_basic_scenario.sh | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/run_basic_scenario.sh b/run_basic_scenario.sh index a621c64..b3598cd 100755 --- a/run_basic_scenario.sh +++ b/run_basic_scenario.sh @@ -28,7 +28,27 @@ jq -r '.root_canister_id' -e sns_canister_ids.json jq -r '.swap_canister_id' -e sns_canister_ids.json # Assert the SNS swap lifecycle is in the OPEN state. -[ "$(./get_sns_swap_state.sh | ./bin/idl2json | jq -r '.swap[0].lifecycle')" == "2" ] && echo "OK" || exit 1 +( + # Run the command and capture the output + swap_state=$(./get_sns_swap_state.sh | ./bin/idl2json) + + # Extract the lifecycle value + lifecycle=$(echo "$swap_state" | jq -r '.swap[0].lifecycle') + + # Log the output and extracted lifecycle value + echo "Full output: ${swap_state}" + echo "Extracted lifecycle value: ${lifecycle}" + + # Check if the lifecycle is in the OPEN state (2) + if [ "${lifecycle}" == "2" ]; then + echo "OK - SNS swap lifecycle is in the OPEN state (2)" + else + echo "ERROR - SNS swap lifecycle is not in the OPEN state" + echo "Expected: 2 (OPEN state)" + echo "Actual: ${lifecycle}" + exit 1 + fi +) # Assert that the test canister is indeed registered. [ "$(./get_sns_canisters.sh | ./bin/idl2json | jq -r '.dapps[0]')" == "$(./bin/dfx canister id test)" ] && echo "OK" || exit 1