mirror of
https://github.com/golang/go
synced 2024-11-20 08:04:42 -07:00
cmd/go: clear GIT_ALLOW_PROTOCOL during tests
Clear it before any tests begin. Clear it again after TestIsSecureGitAllowProtocol sets it. Fixes #17700. Change-Id: I6ea50d37f8222d8c7c9fee0b1eac3bbdfb5d133e Reviewed-on: https://go-review.googlesource.com/32640 Reviewed-by: Quentin Smith <quentin@golang.org> Run-TryBot: Russ Cox <rsc@golang.org>
This commit is contained in:
parent
a35decf5a7
commit
95e809f0e5
@ -99,6 +99,7 @@ func TestMain(m *testing.M) {
|
|||||||
// Don't let these environment variables confuse the test.
|
// Don't let these environment variables confuse the test.
|
||||||
os.Unsetenv("GOBIN")
|
os.Unsetenv("GOBIN")
|
||||||
os.Unsetenv("GOPATH")
|
os.Unsetenv("GOPATH")
|
||||||
|
os.Unsetenv("GIT_ALLOW_PROTOCOL")
|
||||||
if home, ccacheDir := os.Getenv("HOME"), os.Getenv("CCACHE_DIR"); home != "" && ccacheDir == "" {
|
if home, ccacheDir := os.Getenv("HOME"), os.Getenv("CCACHE_DIR"); home != "" && ccacheDir == "" {
|
||||||
// On some systems the default C compiler is ccache.
|
// On some systems the default C compiler is ccache.
|
||||||
// Setting HOME to a non-existent directory will break
|
// Setting HOME to a non-existent directory will break
|
||||||
|
@ -271,6 +271,7 @@ func TestIsSecureGitAllowProtocol(t *testing.T) {
|
|||||||
{vcsBzr, "foo://example.com/bar.bzr", false},
|
{vcsBzr, "foo://example.com/bar.bzr", false},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
defer os.Unsetenv("GIT_ALLOW_PROTOCOL")
|
||||||
os.Setenv("GIT_ALLOW_PROTOCOL", "https:foo")
|
os.Setenv("GIT_ALLOW_PROTOCOL", "https:foo")
|
||||||
for _, test := range tests {
|
for _, test := range tests {
|
||||||
secure := test.vcs.isSecure(test.url)
|
secure := test.vcs.isSecure(test.url)
|
||||||
|
Loading…
Reference in New Issue
Block a user