ci(deps): fix tenv in ".*_test.go$" (#6748)

Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
This commit is contained in:
Matthieu MOREL
2024-05-23 06:50:01 +02:00
committed by GitHub
parent db5c523144
commit c3e734f659
5 changed files with 4 additions and 8 deletions

View File

@@ -112,7 +112,6 @@ issues:
- govet
- ineffassign
- misspell
- tenv
- unused
- linters:
- gosec

View File

@@ -1,7 +1,6 @@
package pom
import (
"os"
"testing"
"github.com/stretchr/testify/assert"
@@ -87,8 +86,7 @@ func Test_evaluateVariable(t *testing.T) {
}
envName := "TEST_GO_DEP_PARSER"
os.Setenv(envName, "1.2.3")
defer os.Unsetenv(envName)
t.Setenv(envName, "1.2.3")
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {

View File

@@ -22,7 +22,7 @@ func setupPodmanSock(t *testing.T) *httptest.Server {
runtimeDir, err := os.MkdirTemp("", "daemon")
require.NoError(t, err)
os.Setenv("XDG_RUNTIME_DIR", runtimeDir)
t.Setenv("XDG_RUNTIME_DIR", runtimeDir)
dir := filepath.Join(runtimeDir, "podman")
err = os.MkdirAll(dir, os.ModePerm)

View File

@@ -330,7 +330,7 @@ exception[rules] {
func Test_RegoScanning_WithRuntimeValues(t *testing.T) {
_ = os.Setenv("DEFSEC_RUNTIME_VAL", "AOK")
t.Setenv("DEFSEC_RUNTIME_VAL", "AOK")
srcFS := CreateFS(t, map[string]string{
"policies/test.rego": `

View File

@@ -3,7 +3,6 @@ package report_test
import (
"bytes"
"context"
"os"
"testing"
"time"
@@ -168,7 +167,7 @@ func TestReportWriter_Template(t *testing.T) {
t.Run(tc.name, func(t *testing.T) {
ctx := clock.With(context.Background(), time.Date(2020, 8, 10, 7, 28, 17, 958601, time.UTC))
os.Setenv("AWS_ACCOUNT_ID", "123456789012")
t.Setenv("AWS_ACCOUNT_ID", "123456789012")
got := bytes.Buffer{}
inputReport := types.Report{
Results: types.Results{