Skip to content

Commit 79a1f60

Browse files
authored
internal/telemetry: remove "testing" import from internal/telemetry/utils.go (#3017)
1 parent 17415ba commit 79a1f60

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

Diff for: internal/telemetry/utils.go

+9-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import (
1212
"math"
1313
"sort"
1414
"strings"
15-
"testing"
1615
)
1716

1817
// MockGlobalClient replaces the global telemetry client with a custom
@@ -30,8 +29,16 @@ func MockGlobalClient(client Client) func() {
3029
}
3130
}
3231

32+
// Errorfer is an interface that allows to call the `Errorf` method.
33+
// This is the same interface as `testing.T` because the goal of this
34+
// interface is to remove the need to import `testing` in this package
35+
// that is actually imported by users.
36+
type Errorfer interface {
37+
Errorf(format string, args ...any)
38+
}
39+
3340
// Check is a testing utility to assert that a target key in config contains the expected value
34-
func Check(t *testing.T, configuration []Configuration, key string, expected interface{}) {
41+
func Check(t Errorfer, configuration []Configuration, key string, expected interface{}) {
3542
for _, kv := range configuration {
3643
if kv.Name == key {
3744
if kv.Value != expected {

0 commit comments

Comments
 (0)