From b9e3f32a83f8384fcaefc47d8e3f06050af638ce Mon Sep 17 00:00:00 2001 From: Damien Mathieu <42@dmathieu.com> Date: Wed, 23 Apr 2025 09:53:02 +0200 Subject: [PATCH] Relax grpc errors to allow for upgrade (#6685) #6679 is changing the gRPC errors, which fails our tests. This change allows those tests to pass so the upgrade can happen. --- exporters/otlp/otlplog/otlploggrpc/internal/retry/retry_test.go | 2 +- exporters/otlp/otlplog/otlploghttp/internal/retry/retry_test.go | 2 +- exporters/otlp/otlpmetric/otlpmetricgrpc/client_test.go | 2 +- .../otlp/otlpmetric/otlpmetricgrpc/internal/retry/retry_test.go | 2 +- .../otlp/otlpmetric/otlpmetrichttp/internal/retry/retry_test.go | 2 +- .../otlp/otlptrace/otlptracegrpc/internal/retry/retry_test.go | 2 +- .../otlp/otlptrace/otlptracehttp/internal/retry/retry_test.go | 2 +- internal/shared/otlp/retry/retry_test.go.tmpl | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/exporters/otlp/otlplog/otlploggrpc/internal/retry/retry_test.go b/exporters/otlp/otlplog/otlploggrpc/internal/retry/retry_test.go index 10f6ec51a..79046ee47 100644 --- a/exporters/otlp/otlplog/otlploggrpc/internal/retry/retry_test.go +++ b/exporters/otlp/otlplog/otlploggrpc/internal/retry/retry_test.go @@ -200,7 +200,7 @@ func TestMaxElapsedTime(t *testing.T) { ctx := context.Background() assert.Contains(t, reqFunc(ctx, func(context.Context) error { return assert.AnError - }).Error(), "max retry time elapsed: ") + }).Error(), "max retry time") } func TestRetryNotEnabled(t *testing.T) { diff --git a/exporters/otlp/otlplog/otlploghttp/internal/retry/retry_test.go b/exporters/otlp/otlplog/otlploghttp/internal/retry/retry_test.go index 10f6ec51a..79046ee47 100644 --- a/exporters/otlp/otlplog/otlploghttp/internal/retry/retry_test.go +++ b/exporters/otlp/otlplog/otlploghttp/internal/retry/retry_test.go @@ -200,7 +200,7 @@ func TestMaxElapsedTime(t *testing.T) { ctx := context.Background() assert.Contains(t, reqFunc(ctx, func(context.Context) error { return assert.AnError - }).Error(), "max retry time elapsed: ") + }).Error(), "max retry time") } func TestRetryNotEnabled(t *testing.T) { diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/client_test.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/client_test.go index 54b99ae50..8b1c20c8f 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/client_test.go +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/client_test.go @@ -236,7 +236,7 @@ func TestConfig(t *testing.T) { ctx := context.Background() t.Cleanup(func() { require.NoError(t, exp.Shutdown(ctx)) }) err := exp.Export(ctx, &metricdata.ResourceMetrics{}) - assert.ErrorContains(t, err, context.DeadlineExceeded.Error()) + assert.ErrorContains(t, err, "DeadlineExceeded") }) t.Run("WithCustomUserAgent", func(t *testing.T) { diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/retry/retry_test.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/retry/retry_test.go index 10f6ec51a..79046ee47 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/retry/retry_test.go +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/retry/retry_test.go @@ -200,7 +200,7 @@ func TestMaxElapsedTime(t *testing.T) { ctx := context.Background() assert.Contains(t, reqFunc(ctx, func(context.Context) error { return assert.AnError - }).Error(), "max retry time elapsed: ") + }).Error(), "max retry time") } func TestRetryNotEnabled(t *testing.T) { diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/internal/retry/retry_test.go b/exporters/otlp/otlpmetric/otlpmetrichttp/internal/retry/retry_test.go index 10f6ec51a..79046ee47 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/internal/retry/retry_test.go +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/internal/retry/retry_test.go @@ -200,7 +200,7 @@ func TestMaxElapsedTime(t *testing.T) { ctx := context.Background() assert.Contains(t, reqFunc(ctx, func(context.Context) error { return assert.AnError - }).Error(), "max retry time elapsed: ") + }).Error(), "max retry time") } func TestRetryNotEnabled(t *testing.T) { diff --git a/exporters/otlp/otlptrace/otlptracegrpc/internal/retry/retry_test.go b/exporters/otlp/otlptrace/otlptracegrpc/internal/retry/retry_test.go index 10f6ec51a..79046ee47 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/internal/retry/retry_test.go +++ b/exporters/otlp/otlptrace/otlptracegrpc/internal/retry/retry_test.go @@ -200,7 +200,7 @@ func TestMaxElapsedTime(t *testing.T) { ctx := context.Background() assert.Contains(t, reqFunc(ctx, func(context.Context) error { return assert.AnError - }).Error(), "max retry time elapsed: ") + }).Error(), "max retry time") } func TestRetryNotEnabled(t *testing.T) { diff --git a/exporters/otlp/otlptrace/otlptracehttp/internal/retry/retry_test.go b/exporters/otlp/otlptrace/otlptracehttp/internal/retry/retry_test.go index 10f6ec51a..79046ee47 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/internal/retry/retry_test.go +++ b/exporters/otlp/otlptrace/otlptracehttp/internal/retry/retry_test.go @@ -200,7 +200,7 @@ func TestMaxElapsedTime(t *testing.T) { ctx := context.Background() assert.Contains(t, reqFunc(ctx, func(context.Context) error { return assert.AnError - }).Error(), "max retry time elapsed: ") + }).Error(), "max retry time") } func TestRetryNotEnabled(t *testing.T) { diff --git a/internal/shared/otlp/retry/retry_test.go.tmpl b/internal/shared/otlp/retry/retry_test.go.tmpl index 10f6ec51a..79046ee47 100644 --- a/internal/shared/otlp/retry/retry_test.go.tmpl +++ b/internal/shared/otlp/retry/retry_test.go.tmpl @@ -200,7 +200,7 @@ func TestMaxElapsedTime(t *testing.T) { ctx := context.Background() assert.Contains(t, reqFunc(ctx, func(context.Context) error { return assert.AnError - }).Error(), "max retry time elapsed: ") + }).Error(), "max retry time") } func TestRetryNotEnabled(t *testing.T) {