1
0
mirror of https://github.com/open-telemetry/opentelemetry-go.git synced 2025-08-10 22:31:50 +02:00

Replace tenv with usetesting (#6313)

The `tenv` linter is deprecated in favor of `usetesting`.
This commit is contained in:
Damien Mathieu
2025-02-13 11:18:37 +01:00
committed by GitHub
parent 44ea53bad8
commit f62232fa1b
4 changed files with 5 additions and 7 deletions

View File

@@ -25,13 +25,13 @@ linters:
- perfsprint - perfsprint
- revive - revive
- staticcheck - staticcheck
- tenv
- testifylint - testifylint
- typecheck - typecheck
- unconvert - unconvert
- unused - unused
- unparam - unparam
- usestdlibvars - usestdlibvars
- usetesting
issues: issues:
# Maximum issues count per one linter. # Maximum issues count per one linter.

View File

@@ -15,7 +15,7 @@ import (
func TestReadFileExistent(t *testing.T) { func TestReadFileExistent(t *testing.T) {
fileContents := "foo" fileContents := "foo"
f, err := os.CreateTemp("", "readfile_") f, err := os.CreateTemp(t.TempDir(), "readfile_")
require.NoError(t, err) require.NoError(t, err)
defer os.Remove(f.Name()) defer os.Remove(f.Name())
@@ -31,7 +31,7 @@ func TestReadFileExistent(t *testing.T) {
func TestReadFileNonExistent(t *testing.T) { func TestReadFileNonExistent(t *testing.T) {
// create unique filename // create unique filename
f, err := os.CreateTemp("", "readfile_") f, err := os.CreateTemp(t.TempDir(), "readfile_")
require.NoError(t, err) require.NoError(t, err)
// make file non-existent // make file non-existent

View File

@@ -8,7 +8,6 @@ import (
"encoding/binary" "encoding/binary"
"errors" "errors"
"fmt" "fmt"
"os"
"sync" "sync"
"testing" "testing"
"time" "time"
@@ -267,7 +266,7 @@ func TestNewBatchSpanProcessorWithEnvOptions(t *testing.T) {
for _, option := range options { for _, option := range options {
t.Run(option.name, func(t *testing.T) { t.Run(option.name, func(t *testing.T) {
for k, v := range option.envs { for k, v := range option.envs {
require.NoError(t, os.Setenv(k, v)) t.Setenv(k, v)
} }
te := testBatchExporter{} te := testBatchExporter{}

View File

@@ -5,7 +5,6 @@ package trace
import ( import (
"context" "context"
"os"
"testing" "testing"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
@@ -115,7 +114,7 @@ func TestSettingSpanLimits(t *testing.T) {
t.Cleanup(func() { require.NoError(t, es.Restore()) }) t.Cleanup(func() { require.NoError(t, es.Restore()) })
for k, v := range test.env { for k, v := range test.env {
es.Record(k) es.Record(k)
require.NoError(t, os.Setenv(k, v)) t.Setenv(k, v)
} }
} }