From e9bc90a6f31f6a92df0822a1c73471df5c1f1d61 Mon Sep 17 00:00:00 2001 From: Dylan Ratcliffe Date: Wed, 6 Nov 2024 11:34:31 +0000 Subject: [PATCH] Don't configure traces without honeycomb --- adapters/iam_test.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/adapters/iam_test.go b/adapters/iam_test.go index 7ecd97c6..09d62481 100644 --- a/adapters/iam_test.go +++ b/adapters/iam_test.go @@ -16,18 +16,18 @@ type TestIAMClient struct{} func TestMain(m *testing.M) { // Add tracing if present key, _ := os.LookupEnv("HONEYCOMB_API_KEY") - opts := make([]otlptracehttp.Option, 0) if key != "" { - opts = []otlptracehttp.Option{ + opts := []otlptracehttp.Option{ otlptracehttp.WithEndpoint("api.honeycomb.io"), otlptracehttp.WithHeaders(map[string]string{"x-honeycomb-team": key}), } - } - if err := tracing.InitTracing(opts...); err != nil { - log.Fatal(err) + if err := tracing.InitTracing(opts...); err != nil { + log.Fatal(err) + } + defer tracing.ShutdownTracing() + } - defer tracing.ShutdownTracing() os.Exit(m.Run()) }