Skip to content

Commit

Permalink
ci(deps): fix tenv in ".*_test.go$"
Browse files Browse the repository at this point in the history
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
  • Loading branch information
mmorel-35 committed May 22, 2024
1 parent 48a7183 commit e5066d5
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 8 deletions.
1 change: 0 additions & 1 deletion .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ issues:
- govet
- ineffassign
- misspell
- tenv
- unused
- linters:
- gosec
Expand Down
4 changes: 1 addition & 3 deletions pkg/dependency/parser/java/pom/artifact_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package pom

import (
"os"
"testing"

"github.com/stretchr/testify/assert"
Expand Down Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion pkg/fanal/image/daemon/podman_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion pkg/iac/rego/scanner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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": `
Expand Down
3 changes: 1 addition & 2 deletions pkg/report/template_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package report_test
import (
"bytes"
"context"
"os"
"testing"
"time"

Expand Down Expand Up @@ -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{
Expand Down

0 comments on commit e5066d5

Please sign in to comment.