Use t.Setenv instead of os.Setenv

Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
This commit is contained in:
Maksym Pavlenko
2022-04-01 13:53:17 -07:00
parent 887615c7d0
commit 2d59a39445
3 changed files with 5 additions and 13 deletions

View File

@@ -18,7 +18,6 @@ package shim
import (
"context"
"os"
"runtime"
"testing"
)
@@ -27,7 +26,7 @@ func TestRuntimeWithEmptyMaxEnvProcs(t *testing.T) {
var oldGoMaxProcs = runtime.GOMAXPROCS(0)
defer runtime.GOMAXPROCS(oldGoMaxProcs)
os.Setenv("GOMAXPROCS", "")
t.Setenv("GOMAXPROCS", "")
setRuntime()
var currentGoMaxProcs = runtime.GOMAXPROCS(0)
@@ -37,7 +36,7 @@ func TestRuntimeWithEmptyMaxEnvProcs(t *testing.T) {
}
func TestRuntimeWithNonEmptyMaxEnvProcs(t *testing.T) {
os.Setenv("GOMAXPROCS", "not_empty")
t.Setenv("GOMAXPROCS", "not_empty")
setRuntime()
var oldGoMaxProcs2 = runtime.GOMAXPROCS(0)
if oldGoMaxProcs2 != runtime.NumCPU() {