Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
May 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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