diff --git a/contrib/gin-gonic/gin/gintrace_test.go b/contrib/gin-gonic/gin/gintrace_test.go index c605938cae..c0079a61ff 100644 --- a/contrib/gin-gonic/gin/gintrace_test.go +++ b/contrib/gin-gonic/gin/gintrace_test.go @@ -649,6 +649,10 @@ func TestServiceName(t *testing.T) { // TestTracerStartedMultipleTimes tests a v2 regression where the global service name was being set to an empty string // when the tracer is started more than once. func TestTracerStartedMultipleTimes(t *testing.T) { + // tracer.WithService below overwrites the global service name, this call + // ensures we restore it its previous value after this test finishes. + testutils.SetGlobalServiceName(t, "") + tt1 := testtracer.Start(t) defer tt1.Stop() tt2 := testtracer.Start(t, testtracer.WithTracerStartOpts(tracer.WithService("global_service"))) diff --git a/contrib/log/slog/slog_test.go b/contrib/log/slog/slog_test.go index a1cc95831a..cdfde838fa 100644 --- a/contrib/log/slog/slog_test.go +++ b/contrib/log/slog/slog_test.go @@ -84,6 +84,8 @@ func testLogger(t *testing.T, createLogger func(b io.Writer) *slog.Logger, asser spanID := strconv.FormatUint(span.Context().SpanID(), 10) if os.Getenv("DD_TRACE_128_BIT_TRACEID_LOGGING_ENABLED") == "false" { // Re-initialize to account for race condition between setting env var in the test and reading it in the contrib + oldCfg := cfg + t.Cleanup(func() { cfg = oldCfg }) cfg = newConfig() traceID = strconv.FormatUint(span.Context().TraceIDLower(), 10) } else { diff --git a/contrib/sirupsen/logrus/logrus_test.go b/contrib/sirupsen/logrus/logrus_test.go index d20602abb8..cf682c6e04 100644 --- a/contrib/sirupsen/logrus/logrus_test.go +++ b/contrib/sirupsen/logrus/logrus_test.go @@ -36,6 +36,8 @@ func TestFire128BitDisabled(t *testing.T) { t.Setenv("DD_TRACE_128_BIT_TRACEID_LOGGING_ENABLED", "false") // Re-initialize to account for race condition between setting env var in the test and reading it in the contrib + oldCfg := cfg + t.Cleanup(func() { cfg = oldCfg }) cfg = newConfig() tracer.Start() diff --git a/scripts/ci_test_contrib.sh b/scripts/ci_test_contrib.sh index d9ad0cdd2f..b85bd95379 100755 --- a/scripts/ci_test_contrib.sh +++ b/scripts/ci_test_contrib.sh @@ -42,7 +42,7 @@ for contrib in $CONTRIBS; do go get k8s.io/kube-openapi@v0.0.0-20250628140032-d90c4fd18f59 fi go mod tidy - gotestsum --junitfile "${TEST_RESULTS}/gotestsum-report-$contrib_id.xml" -- ./... -v -race -coverprofile="coverage-$contrib_id.txt" -covermode=atomic + gotestsum --junitfile "${TEST_RESULTS}/gotestsum-report-$contrib_id.xml" -- ./... -v -race -coverprofile="coverage-$contrib_id.txt" -covermode=atomic --shuffle=on test_exit=$? [[ $test_exit -ne 0 ]] && report_error=1 cd - > /dev/null || exit 1 @@ -58,7 +58,7 @@ for mod in $INSTRUMENTATION_SUBMODULES; do # When the issue is resolved, this line can be removed. go get k8s.io/kube-openapi@v0.0.0-20250628140032-d90c4fd18f59 fi - gotestsum --junitfile "${TEST_RESULTS}/gotestsum-report-$mod_id.xml" -- ./... -v -race -coverprofile="coverage-$mod_id.txt" -covermode=atomic + gotestsum --junitfile "${TEST_RESULTS}/gotestsum-report-$mod_id.xml" -- ./... -v -race -coverprofile="coverage-$mod_id.txt" -covermode=atomic --shuffle=on test_exit=$? [[ $test_exit -ne 0 ]] && report_error=1 cd - > /dev/null || exit 1