Skip to content

Commit 970d654

Browse files
committed
fix cleanup in tests
1 parent 872d230 commit 970d654

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

tools/download_test.go

+9
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ package tools
1717

1818
import (
1919
"encoding/json"
20+
"runtime"
2021
"testing"
2122
"time"
2223

@@ -40,6 +41,10 @@ func TestDownloadCorrectPlatform(t *testing.T) {
4041
{"windows", "amd64", "x86_64-mingw32"},
4142
{"linux", "arm", "arm-linux-gnueabihf"},
4243
}
44+
defer func() {
45+
OS = runtime.GOOS // restore `runtime.OS`
46+
Arch = runtime.GOARCH // restore `runtime.ARCH`
47+
}()
4348
testIndex := paths.New("testdata", "test_tool_index.json")
4449
buf, err := testIndex.ReadFile()
4550
require.NoError(t, err)
@@ -72,6 +77,10 @@ func TestDownloadFallbackPlatform(t *testing.T) {
7277
{"darwin", "arm64", "i386-apple-darwin11"},
7378
{"windows", "amd64", "i686-mingw32"},
7479
}
80+
defer func() {
81+
OS = runtime.GOOS // restore `runtime.OS`
82+
Arch = runtime.GOARCH // restore `runtime.ARCH`
83+
}()
7584
testIndex := paths.New("testdata", "test_tool_index.json")
7685
buf, err := testIndex.ReadFile()
7786
require.NoError(t, err)

0 commit comments

Comments
 (0)