]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go: clear GIT_ALLOW_PROTOCOL during tests
authorRuss Cox <rsc@golang.org>
Thu, 3 Nov 2016 03:12:10 +0000 (23:12 -0400)
committerRuss Cox <rsc@golang.org>
Thu, 3 Nov 2016 16:08:35 +0000 (16:08 +0000)
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>

src/cmd/go/go_test.go
src/cmd/go/vcs_test.go

index 37da67c8b77077e68efa551016448fd6dd3a240b..e6eec09082f077dc43009a56a230c193d44e2bf6 100644 (file)
@@ -99,6 +99,7 @@ func TestMain(m *testing.M) {
        // Don't let these environment variables confuse the test.
        os.Unsetenv("GOBIN")
        os.Unsetenv("GOPATH")
+       os.Unsetenv("GIT_ALLOW_PROTOCOL")
        if home, ccacheDir := os.Getenv("HOME"), os.Getenv("CCACHE_DIR"); home != "" && ccacheDir == "" {
                // On some systems the default C compiler is ccache.
                // Setting HOME to a non-existent directory will break
index 798f6683a6619cc22f4133c21ae7a4a69337887d..c73f5d0e85b41b53a1fffccdcf0697959a012855 100644 (file)
@@ -271,6 +271,7 @@ func TestIsSecureGitAllowProtocol(t *testing.T) {
                {vcsBzr, "foo://example.com/bar.bzr", false},
        }
 
+       defer os.Unsetenv("GIT_ALLOW_PROTOCOL")
        os.Setenv("GIT_ALLOW_PROTOCOL", "https:foo")
        for _, test := range tests {
                secure := test.vcs.isSecure(test.url)