Skip to content

Commit

Permalink
add assess run show cloud test
Browse files Browse the repository at this point in the history
  • Loading branch information
evanson committed Aug 15, 2022
1 parent db84a1a commit cea93dc
Showing 1 changed file with 21 additions and 5 deletions.
26 changes: 21 additions & 5 deletions tests/suites/cli/display_clouds.sh
Original file line number Diff line number Diff line change
Expand Up @@ -81,19 +81,35 @@ EOF
echo "${CLOUDS}" >>"${TEST_DIR}/juju/clouds.yaml"
CLOUD_LIST=$(JUJU_DATA="${TEST_DIR}/juju" juju clouds --client --format=json 2>/dev/null | jq -S 'with_entries(select(
.value.defined != "built-in")) | with_entries((select(.value.defined == "local")
| del(.value.defined) | del(.value.description)))' | uniq -u)
| del(.value.defined) | del(.value.description)))')
EXPECTED=$(echo "${CLOUDS}" | yq -I0 -oj | jq -S '.[] | del(.clouds) | .[] |= ({endpoint} as $endpoint | .[] |= walk(
(objects | select(contains($endpoint))) |= del(.endpoint)
))')
if [ "${CLOUD_LIST}" != "${EXPECTED}" ]; then
echo "expected ${EXPECTED}, got ${CLOUD_LIST}"
exit 1
fi
}

#run_show_cloud(){
#
#}
CLOUD_LIST=$(JUJU_DATA="${TEST_DIR}/juju" juju show-cloud finfolk-vmaas --format yaml --client 2>/dev/null | yq -I0 -oj | jq -S 'with_entries((select(.value!= null)))')
EXPECTED=$(
cat <<'EOF' | jq -S
{
"auth-types": [
"oauth1"
],
"defined": "local",
"description": "Metal As A Service",
"endpoint": "http://10.125.0.10:5240/MAAS/",
"type": "maas"
}
EOF
)

if [ "${CLOUD_LIST}" != "${EXPECTED}" ]; then
echo "expected ${EXPECTED}, got ${CLOUD_LIST}"
exit 1
fi
}

test_display_clouds() {
if [ "$(skip 'test_display_clouds')" ]; then
Expand Down

0 comments on commit cea93dc

Please sign in to comment.