From 30c28bbf0507cba9219633192e02b68719ab8280 Mon Sep 17 00:00:00 2001 From: "Bryan C. Mills" Date: Tue, 9 Mar 2021 23:31:41 -0500 Subject: [PATCH] cmd/go: avoid password prompts in TestScript/mod_get_private_vcs In some cases, this test would prompt for interactive SSH passwords in order to authenticate to github.com over SSH. Setting GIT_SSH_COMMAND to /bin/false prevents that, while still provoking the desired Git failure mode. Updates #44904. Change-Id: Idc9fe9f47d2ccb6c8a4ea988b73d9c8c774e4079 Reviewed-on: https://go-review.googlesource.com/c/go/+/300156 Trust: Bryan C. Mills Trust: Kevin Burke Run-TryBot: Bryan C. Mills TryBot-Result: Go Bot Reviewed-by: Kevin Burke --- src/cmd/go/testdata/script/mod_get_private_vcs.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/cmd/go/testdata/script/mod_get_private_vcs.txt b/src/cmd/go/testdata/script/mod_get_private_vcs.txt index 8b01eac62c2..75c776a7fa2 100644 --- a/src/cmd/go/testdata/script/mod_get_private_vcs.txt +++ b/src/cmd/go/testdata/script/mod_get_private_vcs.txt @@ -22,7 +22,8 @@ stderr '^If this is a private repository, see https://golang.org/doc/faq#git_htt ! stderr 'unknown revision' ! stdout . -[!linux] stop +[!linux] stop # Needs XDG_CONFIG_HOME. +[!exec:false] stop # Test that Git clone errors will be shown to the user instead of a generic # "unknown revision" error. To do this we want to force git ls-remote to return @@ -31,6 +32,7 @@ stderr '^If this is a private repository, see https://golang.org/doc/faq#git_htt # Set XDG_CONFIG_HOME to tell Git where to look for the git config file listed # below, which turns on ssh. env XDG_CONFIG_HOME=$TMPDIR +env GIT_SSH_COMMAND=false ! go install github.com/golang/nonexist@master stderr 'fatal: Could not read from remote repository.' ! stderr 'unknown revision'