diff --git a/scripts/install.sh b/scripts/install.sh index 88acc2777..4d6ccf5fd 100644 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -71,6 +71,11 @@ while [[ $# -gt 0 ]]; do exit 0 ;; --channel) + if [[ $# -lt 2 || "${2:-}" == -* ]]; then + log_err "Missing value for --channel" + usage + exit 1 + fi CHANNEL="${2:-}" shift 2 ;; diff --git a/scripts/test_install.sh b/scripts/test_install.sh index 526f6cde2..d0f4bba43 100755 --- a/scripts/test_install.sh +++ b/scripts/test_install.sh @@ -30,6 +30,20 @@ if [[ "$missing_platform_rc" -ne 3 ]]; then exit 1 fi +set +e +missing_channel_output=$(bash "$REPO_ROOT/scripts/install.sh" --channel 2>&1) +missing_channel_rc=$? +set -e +if [[ "$missing_channel_rc" -eq 0 ]]; then + echo "FAIL: install.sh --channel should fail when the value is missing" + exit 1 +fi +if [[ "$missing_channel_output" != *"Missing value for --channel"* ]]; then + echo "FAIL: install.sh --channel should explain that the value is missing" + echo "$missing_channel_output" + exit 1 +fi + assert_retry_shape() { local calls="$1" label="$2" local _ first second extra