Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The following changes introduce the idea of a display clouds integration tests. Unfortunately it required to change how we handle machine interactions. For formatting directives such as json or yaml, we never want to be prompted for anything, we just either want an empty output in the right format (json being {}) or the data. Bringing in the changes is the first drive into doing so, the PR doesn't enforce the changes through out, although it is a first step in doing so. Adding redirection of the stderr to /dev/null for machine directives is pointless, so in the future checking for ctx.IsSerial() should be used. If the value is true then omitting the information and the noise is probably the wisest.
- Loading branch information
1 parent
12db207
commit c0e2685
Showing
22 changed files
with
95 additions
and
21 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
clouds: | ||
vmaas: | ||
type: maas | ||
auth-types: [oauth1] | ||
endpoint: http://192.168.1.21/MAAS | ||
regions: | ||
default: {} |
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,57 @@ | ||
run_show_clouds() { | ||
echo | ||
|
||
mkdir -p "${TEST_DIR}/juju" | ||
echo "" >> "${TEST_DIR}/juju/public-clouds.yaml" | ||
echo "" >> "${TEST_DIR}/juju/credentials.yaml" | ||
|
||
OUT=$(XDG_DATA_HOME="${TEST_DIR}" juju clouds --local --format=json 2>/dev/null | jq ".[] | select(.defined != \"built-in\")") | ||
if [ -n "${OUT}" ]; then | ||
echo "expected empty ${OUT}" | ||
exit 1 | ||
fi | ||
|
||
cp ./tests/suites/cli/clouds/public-clouds.yaml "${TEST_DIR}"/juju/public-clouds.yaml | ||
OUT=$(XDG_DATA_HOME="${TEST_DIR}" juju clouds --local --format=json 2>/dev/null | jq ".[] | select(.defined != \"built-in\")") | ||
if [ -n "${OUT}" ]; then | ||
echo "expected empty ${OUT}" | ||
exit 1 | ||
fi | ||
|
||
EXPECTED=$(cat <<'EOF' | ||
{ | ||
"defined": "public", | ||
"type": "maas", | ||
"description": "Metal As A Service", | ||
"auth-types": [ | ||
"oauth1" | ||
], | ||
"endpoint": "http://192.168.1.21/MAAS", | ||
"regions": { | ||
"default": {} | ||
} | ||
} | ||
EOF | ||
) | ||
|
||
OUT=$(XDG_DATA_HOME="${TEST_DIR}" juju clouds --all --format=json 2>/dev/null | jq ".[] | select(.defined != \"built-in\")") | ||
if [ "${OUT}" != "${EXPECTED}" ]; then | ||
echo "expected ${EXPECTED}, got ${OUT}" | ||
exit 1 | ||
fi | ||
} | ||
|
||
test_display_clouds() { | ||
if [ "$(skip 'test_display_clouds')" ]; then | ||
echo "==> TEST SKIPPED: display clouds" | ||
return | ||
fi | ||
|
||
( | ||
set_verbosity | ||
|
||
cd .. || exit | ||
|
||
run "run_show_clouds" | ||
) | ||
} |
File renamed without changes.
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
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