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

comp/trace/config: use dedicated testing.T in subtests #30674

Merged
merged 1 commit into from
Nov 4, 2024
Merged
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
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
Loading