Skip to content

Commit

Permalink
Confirm that version name is correct.
Browse files Browse the repository at this point in the history
  • Loading branch information
kamatama41 committed Jan 22, 2017
1 parent ed675ae commit 4033d2c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
5 changes: 5 additions & 0 deletions libexec/tfenv-install
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ if [ -f ${dst_path}/terraform ];then
exit
fi

if [ -z "$(tfenv-list-remote | grep "${version}")" ];then
echo "'${version}' doesn't exist in remote, please confirm version name."
exit 1
fi

case "$(uname -s)" in
Darwin* )
os="darwin_amd64"
Expand Down
10 changes: 10 additions & 0 deletions test/test_install_and_use.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,13 @@ if ! check_version ${v}; then
echo "Installing .terraform-version ${v}" 1>&2
exit 1
fi

echo "### Install invalid version"
cleanup

v=9.9.9
expected_error_message="'${v}' doesn't exist in remote, please confirm version name."
if [ -z "$(tfenv install ${v} | grep "${expected_error_message}")" ]; then
echo "Installing invalid version ${v}" 1>&2
exit 1
fi

0 comments on commit 4033d2c

Please sign in to comment.