Skip to content

Commit

Permalink
[chore] [exporter/elasticsearch] Use t.Setenv in the tests (#30379)
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitryax authored Jan 9, 2024
1 parent 7967c38 commit e10067a
Showing 1 changed file with 1 addition and 12 deletions.
13 changes: 1 addition & 12 deletions exporter/elasticsearchexporter/traces_exporter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
"errors"
"fmt"
"net/http"
"os"
"runtime"
"strings"
"sync"
Expand Down Expand Up @@ -111,18 +110,8 @@ func TestTracesExporter_New(t *testing.T) {
env = map[string]string{defaultElasticsearchEnvName: ""}
}

oldEnv := make(map[string]string, len(env))
defer func() {
for k, v := range oldEnv {
os.Setenv(k, v)
}
}()

for k := range env {
oldEnv[k] = os.Getenv(k)
}
for k, v := range env {
os.Setenv(k, v)
t.Setenv(k, v)
}

exporter, err := newTracesExporter(zap.NewNop(), test.config)
Expand Down

0 comments on commit e10067a

Please sign in to comment.