Skip to content

Commit

Permalink
comp/trace/config: use dedicated testing.T in subtests (#30674)
Browse files Browse the repository at this point in the history
  • Loading branch information
ajgajg1134 authored Nov 4, 2024
1 parent 1530248 commit c959bd1
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions comp/trace/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ func TestConfigHostname(t *testing.T) {

// makeProgram creates a new binary file which returns the given response and exits to the OS
// given the specified code, returning the path of the program.
makeProgram := func(response string, code int) string {
makeProgram := func(t *testing.T, response string, code int) string {
f, err := os.CreateTemp("", "trace-test-hostname.*.go")
if err != nil {
t.Fatal(err)
Expand Down Expand Up @@ -401,7 +401,7 @@ func TestConfigHostname(t *testing.T) {
fallbackHostnameFunc = func() (string, error) { return "fallback.host", nil }

t.Run("good", func(t *testing.T) {
bin := makeProgram("host.name", 0)
bin := makeProgram(t, "host.name", 0)
defer os.Remove(bin)

config := buildConfigComponent(t)
Expand All @@ -415,7 +415,7 @@ func TestConfigHostname(t *testing.T) {
})

t.Run("empty", func(t *testing.T) {
bin := makeProgram("", 0)
bin := makeProgram(t, "", 0)
defer os.Remove(bin)

config := buildConfigComponent(t)
Expand All @@ -428,7 +428,7 @@ func TestConfigHostname(t *testing.T) {
})

t.Run("empty+disallowed", func(t *testing.T) {
bin := makeProgram("", 0)
bin := makeProgram(t, "", 0)
defer os.Remove(bin)

config := buildConfigComponent(t)
Expand All @@ -443,7 +443,7 @@ func TestConfigHostname(t *testing.T) {
})

t.Run("fallback1", func(t *testing.T) {
bin := makeProgram("", 1)
bin := makeProgram(t, "", 1)
defer os.Remove(bin)

config := buildConfigComponent(t)
Expand All @@ -456,7 +456,7 @@ func TestConfigHostname(t *testing.T) {
})

t.Run("fallback2", func(t *testing.T) {
bin := makeProgram("some text", 1)
bin := makeProgram(t, "some text", 1)
defer os.Remove(bin)

config := buildConfigComponent(t)
Expand Down

0 comments on commit c959bd1

Please sign in to comment.